diff options
author | nyamatongwe <devnull@localhost> | 2000-07-12 03:20:19 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2000-07-12 03:20:19 +0000 |
commit | 762e9a08d98e8e1c8c67982259be3dacc3cd7f2c (patch) | |
tree | 4b778b01098b96d73f86437e2ea3a35d0085453b /src/ScintillaBase.cxx | |
parent | f2b6dc6cf2803a8bd76caac8cf05e60339fe7eae (diff) | |
download | scintilla-mirror-762e9a08d98e8e1c8c67982259be3dacc3cd7f2c.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(); } } |