aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ScintillaBase.cxx20
-rw-r--r--src/ScintillaBase.h3
2 files changed, 15 insertions, 8 deletions
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx
index 1238e2ecb..63f962cd5 100644
--- a/src/ScintillaBase.cxx
+++ b/src/ScintillaBase.cxx
@@ -69,7 +69,7 @@ void ScintillaBase::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
Editor::AddCharUTF(s, len, treatAsDBCS);
}
if (ac.Active()) {
- AutoCompleteChanged(s[0]);
+ AutoCompleteCharacterAdded(s[0]);
// For fill ups add the character after the autocompletion has
// triggered so containers see the key so can display a calltip.
if (isFillUp) {
@@ -145,12 +145,12 @@ int ScintillaBase::KeyCommand(unsigned int iMessage) {
return 0;
case SCI_DELETEBACK:
DelCharBack(true);
- AutoCompleteChanged();
+ AutoCompleteCharacterDeleted();
EnsureCaretVisible();
return 0;
case SCI_DELETEBACKNOTLINE:
DelCharBack(false);
- AutoCompleteChanged();
+ AutoCompleteCharacterDeleted();
EnsureCaretVisible();
return 0;
case SCI_TAB:
@@ -283,14 +283,20 @@ void ScintillaBase::AutoCompleteMoveToCurrentWord() {
ac.Select(wordCurrent);
}
-void ScintillaBase::AutoCompleteChanged(char ch) {
+void ScintillaBase::AutoCompleteCharacterAdded(char ch) {
if (ac.IsFillUpChar(ch)) {
AutoCompleteCompleted();
- } else if (currentPos <= ac.posStart - ac.startLen) {
+ } else if (ac.IsStopChar(ch)) {
ac.Cancel();
- } else if (ac.cancelAtStartPos && currentPos <= ac.posStart) {
+ } else {
+ AutoCompleteMoveToCurrentWord();
+ }
+}
+
+void ScintillaBase::AutoCompleteCharacterDeleted() {
+ if (currentPos <= ac.posStart - ac.startLen) {
ac.Cancel();
- } else if (ac.IsStopChar(ch)) {
+ } else if (ac.cancelAtStartPos && (currentPos <= ac.posStart)) {
ac.Cancel();
} else {
AutoCompleteMoveToCurrentWord();
diff --git a/src/ScintillaBase.h b/src/ScintillaBase.h
index 28c089edd..e68aeb608 100644
--- a/src/ScintillaBase.h
+++ b/src/ScintillaBase.h
@@ -65,7 +65,8 @@ protected:
void AutoCompleteStart(int lenEntered, const char *list);
void AutoCompleteCancel();
void AutoCompleteMove(int delta);
- void AutoCompleteChanged(char ch=0);
+ void AutoCompleteCharacterAdded(char ch);
+ void AutoCompleteCharacterDeleted();
void AutoCompleteCompleted();
void AutoCompleteMoveToCurrentWord();
static void AutoCompleteDoubleClick(void* p);