- enhancement: show caret when show code/header completions

This commit is contained in:
royqh1979 2021-09-29 19:40:03 +08:00
parent fac8c10f0c
commit 0940777f15
5 changed files with 31 additions and 2 deletions

View File

@ -10,6 +10,7 @@ Version 0.2.2
- enhancement: redesign charset selection in the project options dialog's file widget - 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 correctly load last open files / project with non-asii characters in path
- fix: can't coorectly load last open project - fix: can't coorectly load last open project
- enhancement: show caret when show code/header completions
Version 0.2.1 Version 0.2.1
- fix: crash when load last opens - fix: crash when load last opens

View File

@ -1502,10 +1502,19 @@ QStringList DebugReader::tokenize(const QString &s)
} }
tEnd = std::min(i,s.length()); tEnd = std::min(i,s.length());
result.append(s.mid(tStart,tEnd-tStart)); result.append(s.mid(tStart,tEnd-tStart));
} else if (ch == '_' || ch.isLetterOrNumber()) { } else if (ch == '_' ||
ch == '.' ||
ch == '+' ||
ch == '-' ||
ch.isLetterOrNumber() ) {
tStart = i; tStart = i;
while (i<s.length()) { while (i<s.length()) {
if ((s[i]!='_') &&(!s[i].isLetterOrNumber())) ch = s[i];
if (!(ch == '_' ||
ch == '.' ||
ch == '+' ||
ch == '-' ||
ch.isLetterOrNumber() ))
break; break;
i++; i++;
} }

View File

@ -1,4 +1,7 @@
#include "codecompletionlistview.h" #include "codecompletionlistview.h"
#include "../mainwindow.h"
#include "../editor.h"
#include "../editorlist.h"
CodeCompletionListView::CodeCompletionListView(QWidget *parent) : QListView(parent) CodeCompletionListView::CodeCompletionListView(QWidget *parent) : QListView(parent)
{ {
@ -17,6 +20,15 @@ void CodeCompletionListView::keyPressEvent(QKeyEvent *event)
} }
} }
void CodeCompletionListView::focusInEvent(QFocusEvent *event)
{
Editor *editor = pMainWindow->editorList()->getEditor();
if (editor) {
qDebug()<<"popup:show caret";
editor->showCaret();
}
}
const KeyPressedCallback &CodeCompletionListView::keypressedCallback() const const KeyPressedCallback &CodeCompletionListView::keypressedCallback() const
{ {
return mKeypressedCallback; return mKeypressedCallback;

View File

@ -19,6 +19,10 @@ protected:
void keyPressEvent(QKeyEvent *event) override; void keyPressEvent(QKeyEvent *event) override;
private: private:
KeyPressedCallback mKeypressedCallback; KeyPressedCallback mKeypressedCallback;
// QWidget interface
protected:
void focusInEvent(QFocusEvent *event) override;
}; };

View File

@ -1,5 +1,8 @@
#include "codecompletionpopup.h" #include "codecompletionpopup.h"
#include "../utils.h" #include "../utils.h"
#include "../mainwindow.h"
#include "../editor.h"
#include "../editorlist.h"
#include <QKeyEvent> #include <QKeyEvent>
#include <QVBoxLayout> #include <QVBoxLayout>