diff options
author | nyamatongwe <unknown> | 2000-07-12 03:20:19 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2000-07-12 03:20:19 +0000 |
commit | 372b4cbe4a43236de333d2b0dda964973b886bc8 (patch) | |
tree | 4b778b01098b96d73f86437e2ea3a35d0085453b /src/ScintillaBase.cxx | |
parent | d03640b271b24ef2ee59dd78157efae5c7ed3ea9 (diff) | |
download | scintilla-mirror-372b4cbe4a43236de333d2b0dda964973b886bc8.tar.gz |
John's changes to autocompletion.
Diffstat (limited to 'src/ScintillaBase.cxx')
-rw-r--r-- | src/ScintillaBase.cxx | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index ff2e001ec..f14426969 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -211,8 +211,10 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { } rcList.bottom = rcList.top + heightAlloced; ac.lb.SetPositionRelative(rcList, wMain); - //lbAutoComplete.SetPosition(rcList); ac.Show(); + if (lenEntered != 0) { + AutoCompleteMoveToCurrentWord(); + } } void ScintillaBase::AutoCompleteCancel() { @@ -223,19 +225,25 @@ void ScintillaBase::AutoCompleteMove(int delta) { ac.Move(delta); } +void ScintillaBase::AutoCompleteMoveToCurrentWord() { + char wordCurrent[1000]; + int i; + int startWord = ac.posStart - ac.startLen; + for (i = startWord; i < currentPos; i++) + wordCurrent[i - startWord] = pdoc->CharAt(i); + wordCurrent[i - startWord] = '\0'; + ac.Select(wordCurrent); +} + void ScintillaBase::AutoCompleteChanged(char ch) { - if (currentPos <= ac.posStart) { + if (currentPos <= ac.posStart - ac.startLen) { + ac.Cancel(); + } else if (ac.cancelAtStartPos && currentPos <= ac.posStart) { ac.Cancel(); } else if (ac.IsStopChar(ch)) { ac.Cancel(); } else { - char wordCurrent[1000]; - int i; - int startWord = ac.posStart - ac.startLen; - for (i = startWord; i < currentPos; i++) - wordCurrent[i - startWord] = pdoc->CharAt(i); - wordCurrent[i - startWord] = '\0'; - ac.Select(wordCurrent); + AutoCompleteMoveToCurrentWord(); } } |