From 79466951bb5b1a410b6080a7ebd993f757c0d82a Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 24 Aug 2002 12:41:12 +0000 Subject: Changed autocomplete to only cancel at start when deleting characters. --- src/ScintillaBase.cxx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/ScintillaBase.cxx') 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(); -- cgit v1.2.3