From 0940777f15ada608a0d4cfa2ca049b4f114ad736 Mon Sep 17 00:00:00 2001 From: royqh1979 Date: Wed, 29 Sep 2021 19:40:03 +0800 Subject: [PATCH] - enhancement: show caret when show code/header completions --- NEWS.md | 1 + RedPandaIDE/debugger.cpp | 13 +++++++++++-- RedPandaIDE/widgets/codecompletionlistview.cpp | 12 ++++++++++++ RedPandaIDE/widgets/codecompletionlistview.h | 4 ++++ RedPandaIDE/widgets/codecompletionpopup.cpp | 3 +++ 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 53de9ea9..d943cc02 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,6 +10,7 @@ Version 0.2.2 - enhancement: redesign charset selection in the project options dialog's file widget - fix: can't correctly load last open files / project with non-asii characters in path - fix: can't coorectly load last open project + - enhancement: show caret when show code/header completions Version 0.2.1 - fix: crash when load last opens diff --git a/RedPandaIDE/debugger.cpp b/RedPandaIDE/debugger.cpp index 90a0ef55..0ba855a4 100644 --- a/RedPandaIDE/debugger.cpp +++ b/RedPandaIDE/debugger.cpp @@ -1502,10 +1502,19 @@ QStringList DebugReader::tokenize(const QString &s) } tEnd = std::min(i,s.length()); result.append(s.mid(tStart,tEnd-tStart)); - } else if (ch == '_' || ch.isLetterOrNumber()) { + } else if (ch == '_' || + ch == '.' || + ch == '+' || + ch == '-' || + ch.isLetterOrNumber() ) { tStart = i; while (ieditorList()->getEditor(); + if (editor) { + qDebug()<<"popup:show caret"; + editor->showCaret(); + } +} + const KeyPressedCallback &CodeCompletionListView::keypressedCallback() const { return mKeypressedCallback; diff --git a/RedPandaIDE/widgets/codecompletionlistview.h b/RedPandaIDE/widgets/codecompletionlistview.h index 36f22473..d84e79ba 100644 --- a/RedPandaIDE/widgets/codecompletionlistview.h +++ b/RedPandaIDE/widgets/codecompletionlistview.h @@ -19,6 +19,10 @@ protected: void keyPressEvent(QKeyEvent *event) override; private: KeyPressedCallback mKeypressedCallback; + + // QWidget interface +protected: + void focusInEvent(QFocusEvent *event) override; }; diff --git a/RedPandaIDE/widgets/codecompletionpopup.cpp b/RedPandaIDE/widgets/codecompletionpopup.cpp index aa2ab438..7c750695 100644 --- a/RedPandaIDE/widgets/codecompletionpopup.cpp +++ b/RedPandaIDE/widgets/codecompletionpopup.cpp @@ -1,5 +1,8 @@ #include "codecompletionpopup.h" #include "../utils.h" +#include "../mainwindow.h" +#include "../editor.h" +#include "../editorlist.h" #include #include