From 81ee07355d50e3efef1c9866a6b39f5f61df17a1 Mon Sep 17 00:00:00 2001 From: mgrojo Date: Mon, 30 Dec 2019 20:29:44 +0100 Subject: [PATCH] Skip whitespace at the beginning of a failing query for the indication For the error indicators and scrolling to the failing query, all the whitespace present at the starting end of the query is skipped. Otherwise the point indicated to the user could be very far to the actual query. See issue #2073 --- src/MainWindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 9c9bc0e2..e8a47478 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1087,6 +1087,9 @@ void MainWindow::executeQuery() // Note that execute_from_index uses character positions and not byte positions, so text().length() must be used. if (editor->text(execute_from_line).length() == execute_from_index+1) { execute_from_line++; + // The next lines could be empty, so skip all of them too. + while(editor->text(execute_from_line).trimmed().isEmpty()) + execute_from_line++; execute_from_index = 0; }