From c59c415780ab2cee7e415bdbf2e7df6667b87be3 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 10 Feb 2015 16:16:31 +0100 Subject: [PATCH] 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 --- src/plugins/debugger/sourceutils.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/debugger/sourceutils.cpp b/src/plugins/debugger/sourceutils.cpp index d4deb12e550..ceed122caec 100644 --- a/src/plugins/debugger/sourceutils.cpp +++ b/src/plugins/debugger/sourceutils.cpp @@ -282,7 +282,6 @@ QString cppExpressionAt(TextEditorWidget *editorWidget, int pos, int *line, int *column, QString *function, int *scopeFromLine, int *scopeToLine) { - *line = *column = 0; if (function) function->clear(); @@ -297,13 +296,11 @@ QString cppExpressionAt(TextEditorWidget *editorWidget, int pos, // Fetch the expression's code. ExpressionUnderCursor expressionUnderCursor; 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()) { QString fileName = editorWidget->textDocument()->filePath().toString(); const Snapshot snapshot = CppModelManager::instance()->snapshot();