From c661db82798238c9e9d7f0cec9c6acf55e14c85e Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Wed, 9 Jun 2021 22:44:07 +0200 Subject: [PATCH] Macro IDE: completer catches more words --- src/lay/lay/layMacroEditorPage.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lay/lay/layMacroEditorPage.cc b/src/lay/lay/layMacroEditorPage.cc index 81c30719a..4efe7de39 100644 --- a/src/lay/lay/layMacroEditorPage.cc +++ b/src/lay/lay/layMacroEditorPage.cc @@ -652,6 +652,15 @@ void MacroEditorPage::fill_completer_list () int pos = c.anchor (); c.select (QTextCursor::WordUnderCursor); int pos0 = c.selectionStart (); + + if (pos0 >= pos) { + // if there is no word before, move to left to catch one + c = mp_text->textCursor (); + c.movePosition (QTextCursor::WordLeft, QTextCursor::KeepAnchor); + pos = c.anchor (); + pos0 = c.selectionStart (); + } + if (pos0 >= pos) { return; }