- fix: code completion popup not show after '->' inputted

This commit is contained in:
royqh1979@gmail.com 2021-10-10 20:20:43 +08:00
parent 443aa541fc
commit 9e0beb8046
2 changed files with 14 additions and 5 deletions

View File

@ -1,3 +1,6 @@
Version 0.6.4
- fix: code completion popup not show after '->' inputted
Version 0.6.3
- fix: should use c++ syntax to check ".h" files
- fix: can't copy contents in a readonly editor

View File

@ -703,10 +703,16 @@ void Editor::keyPressEvent(QKeyEvent *event)
case '[':
case ']':
case '<':
case '>':
case '*':
handled = handleSymbolCompletion(ch);
return;
case '>':
if ((caretX() <= 1) || lineText().isEmpty()
|| lineText()[caretX() - 2] != '-') {
handled = handleSymbolCompletion(ch);
return;
}
break;
}
}
@ -1750,14 +1756,14 @@ bool Editor::handleCodeCompletion(QChar key)
return true;
case '>':
setSelText(key);
if ((caretX() > 1) && (lineText().length() >= 1) &&
(lineText()[caretX() - 2] == '-'))
if ((caretX() > 2) && (lineText().length() >= 2) &&
(lineText()[caretX() - 3] == '-'))
showCompletion(false);
return true;
case ':':
setSelText(key);
if ((caretX() > 1) && (lineText().length() >= 1) &&
(lineText()[caretX() - 2] == ':'))
if ((caretX() > 2) && (lineText().length() >= 2) &&
(lineText()[caretX() - 3] == ':'))
showCompletion(false);
return true;
case '/':