diff options
author | nyamatongwe <unknown> | 2002-01-13 01:10:10 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2002-01-13 01:10:10 +0000 |
commit | e468d988b369e61696608fc9ccd52c6d746cb735 (patch) | |
tree | 7a1bd0b59cc23e517090aed5a2616b4f0a2126ed /src/ScintillaBase.cxx | |
parent | 3e4b3fd45dfd68e74824320f909ef19c67f1b6d2 (diff) | |
download | scintilla-mirror-e468d988b369e61696608fc9ccd52c6d746cb735.tar.gz |
Added option to autocompletion AutoCSetDropRestOfWord which removes any
word characters following an insertion made by auto-completion.
Bundled the changes made by an autocompletion into one undo action.
Diffstat (limited to 'src/ScintillaBase.cxx')
-rw-r--r-- | src/ScintillaBase.cxx | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 2994f42db..4a9b87670 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -307,14 +307,18 @@ void ScintillaBase::AutoCompleteCompleted(char fillUp/*='\0'*/) { scn.lParam = 0; scn.text = userListSelected.c_str(); NotifyParent(scn); - return ; + return; } Position firstPos = ac.posStart - ac.startLen; - if (currentPos < firstPos) - return ; - if (currentPos != firstPos) { - pdoc->DeleteChars(firstPos, currentPos - firstPos); + Position endPos = currentPos; + if (ac.dropRestOfWord) + endPos = pdoc->ExtendWordSelect(endPos, 1, true); + if (endPos < firstPos) + return; + pdoc->BeginUndoAction(); + if (endPos != firstPos) { + pdoc->DeleteChars(firstPos, endPos - firstPos); } SetEmptySelection(ac.posStart); if (item != -1) { @@ -324,6 +328,7 @@ void ScintillaBase::AutoCompleteCompleted(char fillUp/*='\0'*/) { pdoc->InsertString(firstPos, piece.c_str()); SetEmptySelection(firstPos + piece.length()); } + pdoc->EndUndoAction(); } void ScintillaBase::ContextMenu(Point pt) { @@ -404,7 +409,7 @@ void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) { int lineEndStyled = WndProc(SCI_LINEFROMPOSITION, endStyled, 0); endStyled = WndProc(SCI_POSITIONFROMLINE, lineEndStyled, 0); Colourise(endStyled, endStyleNeeded); - return ; + return; } #endif Editor::NotifyStyleToNeeded(endStyleNeeded); @@ -483,6 +488,13 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara case SCI_AUTOCGETAUTOHIDE: return ac.autoHide; + case SCI_AUTOCSETDROPRESTOFWORD: + ac.dropRestOfWord = wParam != 0; + break; + + case SCI_AUTOCGETDROPRESTOFWORD: + return ac.dropRestOfWord; + case SCI_CALLTIPSHOW: { AutoCompleteCancel(); if (!ct.wCallTip.Created()) { |