diff options
Diffstat (limited to 'src/ScintillaBase.cxx')
-rw-r--r-- | src/ScintillaBase.cxx | 56 |
1 files changed, 42 insertions, 14 deletions
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 9736c52f0..d42dfc7ff 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -8,8 +8,8 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> -#include <ctype.h> #include <assert.h> +#include <ctype.h> #include <string> #include <vector> @@ -21,12 +21,17 @@ #include "ILexer.h" #include "Scintilla.h" -#include "PropSetSimple.h" #ifdef SCI_LEXER #include "SciLexer.h" +#endif + +#include "PropSetSimple.h" + +#ifdef SCI_LEXER #include "LexerModule.h" #include "Catalogue.h" #endif + #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" @@ -39,7 +44,6 @@ #include "LineMarker.h" #include "Style.h" #include "ViewStyle.h" -#include "AutoComplete.h" #include "CharClassify.h" #include "Decoration.h" #include "CaseFolder.h" @@ -47,6 +51,7 @@ #include "Selection.h" #include "PositionCache.h" #include "Editor.h" +#include "AutoComplete.h" #include "ScintillaBase.h" #ifdef SCI_NAMESPACE @@ -57,6 +62,7 @@ ScintillaBase::ScintillaBase() { displayPopupMenu = true; listType = 0; maxListWidth = 0; + multiAutoCMode = SC_MULTIAUTOC_ONCE; } ScintillaBase::~ScintillaBase() { @@ -197,9 +203,30 @@ void ScintillaBase::AutoCompleteDoubleClick(void *p) { void ScintillaBase::AutoCompleteInsert(Position startPos, int removeLen, const char *text, int textLen) { UndoGroup ug(pdoc); - pdoc->DeleteChars(startPos, removeLen); - const int lengthInserted = pdoc->InsertString(startPos, text, textLen); - SetEmptySelection(startPos + lengthInserted); + if (multiAutoCMode == SC_MULTIAUTOC_ONCE) { + pdoc->DeleteChars(startPos, removeLen); + const int lengthInserted = pdoc->InsertString(startPos, text, textLen); + SetEmptySelection(startPos + lengthInserted); + } else { + // SC_MULTIAUTOC_EACH + for (size_t r=0; r<sel.Count(); r++) { + if (!RangeContainsProtected(sel.Range(r).Start().Position(), + sel.Range(r).End().Position())) { + int positionInsert = sel.Range(r).Start().Position(); + positionInsert = InsertSpace(positionInsert, sel.Range(r).caret.VirtualSpace()); + if (positionInsert - removeLen >= 0) { + positionInsert -= removeLen; + pdoc->DeleteChars(positionInsert, removeLen); + } + const int lengthInserted = pdoc->InsertString(positionInsert, text, textLen); + if (lengthInserted > 0) { + sel.Range(r).caret.SetPosition(positionInsert + lengthInserted); + sel.Range(r).anchor.SetPosition(positionInsert + lengthInserted); + } + sel.Range(r).ClearVirtualSpace(); + } + } + } } void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { @@ -492,7 +519,6 @@ public: void SetLexerLanguage(const char *languageName); const char *DescribeWordListSets(); void SetWordList(int n, const char *wl); - int GetStyleBitsNeeded() const; const char *GetName() const; void *PrivateCall(int operation, void *pointer); const char *PropertyNames(); @@ -594,10 +620,6 @@ void LexState::SetWordList(int n, const char *wl) { } } -int LexState::GetStyleBitsNeeded() const { - return lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5; -} - const char *LexState::GetName() const { return lexCurrent ? lexCurrent->languageName : ""; } @@ -740,8 +762,7 @@ void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) { void ScintillaBase::NotifyLexerChanged(Document *, void *) { #ifdef SCI_LEXER - int bits = DocumentLexState()->GetStyleBitsNeeded(); - vs.EnsureStyle((1 << bits) - 1); + vs.EnsureStyle(0xff); #endif } @@ -819,6 +840,13 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara case SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR: return ac.ignoreCaseBehaviour; + case SCI_AUTOCSETMULTI: + multiAutoCMode = static_cast<int>(wParam); + break; + + case SCI_AUTOCGETMULTI: + return multiAutoCMode; + case SCI_AUTOCSETORDER: ac.autoSort = static_cast<int>(wParam); break; @@ -982,7 +1010,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara DocumentLexState()->PrivateCall(wParam, reinterpret_cast<void *>(lParam))); case SCI_GETSTYLEBITSNEEDED: - return DocumentLexState()->GetStyleBitsNeeded(); + return 8; case SCI_PROPERTYNAMES: return StringResult(lParam, DocumentLexState()->PropertyNames()); |