Debugger: Fix off-by-one line in tooltip context

The first function line (usually containing the function
parameter) was attributed to the preceding function.

Change-Id: Ia2b394cfa5a0edc909bc998bcce6bd92ae5b5b87
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
hjk
2015-02-10 16:16:31 +01:00
parent b8ec2d8e73
commit c59c415780

View File

@@ -282,7 +282,6 @@ QString cppExpressionAt(TextEditorWidget *editorWidget, int pos,
int *line, int *column, QString *function, int *line, int *column, QString *function,
int *scopeFromLine, int *scopeToLine) int *scopeFromLine, int *scopeToLine)
{ {
*line = *column = 0;
if (function) if (function)
function->clear(); function->clear();
@@ -297,13 +296,11 @@ QString cppExpressionAt(TextEditorWidget *editorWidget, int pos,
// Fetch the expression's code. // Fetch the expression's code.
ExpressionUnderCursor expressionUnderCursor; ExpressionUnderCursor expressionUnderCursor;
expr = expressionUnderCursor(tc); expr = expressionUnderCursor(tc);
*column = tc.positionInBlock();
*line = tc.blockNumber();
} else {
*column = tc.positionInBlock();
*line = tc.blockNumber();
} }
*column = tc.positionInBlock();
*line = tc.blockNumber() + 1;
if (!expr.isEmpty()) { if (!expr.isEmpty()) {
QString fileName = editorWidget->textDocument()->filePath().toString(); QString fileName = editorWidget->textDocument()->filePath().toString();
const Snapshot snapshot = CppModelManager::instance()->snapshot(); const Snapshot snapshot = CppModelManager::instance()->snapshot();