mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-07-18 13:04:28 -04:00
fix: Fix off by one errors in getContext{Before,After}() (#94)
This also specifies what exactly getContext*() functions do. Before this commit linesCount was sometimes interpreted as exclusive of current line, which was confusing as linesCount + 1 lines were being returned.
This commit is contained in:
committed by
GitHub
parent
f9f2a86cea
commit
3dc0d910bf
@ -40,10 +40,31 @@ public:
|
||||
QTextDocument *m_document, const QString &mimeType, const QString &filePath);
|
||||
|
||||
QString getLineText(int lineNumber, int cursorPosition = -1) const;
|
||||
|
||||
/**
|
||||
* @brief Retrieves @c linesCount lines of context ending at @c lineNumber at
|
||||
* @c cursorPosition in that line. The line at @c lineNumber is inclusive regardless of
|
||||
* @c cursorPosition.
|
||||
*/
|
||||
QString getContextBefore(int lineNumber, int cursorPosition, int linesCount) const;
|
||||
|
||||
/**
|
||||
* @brief Retrieves @c linesCount lines of context starting at @c lineNumber at
|
||||
* @c cursorPosition in that line. The line at @c lineNumber is inclusive regardless of
|
||||
* @c cursorPosition.
|
||||
*/
|
||||
QString getContextAfter(int lineNumber, int cursorPosition, int linesCount) const;
|
||||
|
||||
/**
|
||||
* @brief Retrieves whole file ending at @c lineNumber at @c cursorPosition in that line.
|
||||
*/
|
||||
QString readWholeFileBefore(int lineNumber, int cursorPosition) const;
|
||||
|
||||
/**
|
||||
* @brief Retrieves whole file starting at @c lineNumber at @c cursorPosition in that line.
|
||||
*/
|
||||
QString readWholeFileAfter(int lineNumber, int cursorPosition) const;
|
||||
|
||||
QString getLanguageAndFileInfo() const;
|
||||
CopyrightInfo findCopyright();
|
||||
QString getContextBetween(
|
||||
|
Reference in New Issue
Block a user