diff options
-rw-r--r-- | core/.buffer.luadoc | 10 | ||||
-rw-r--r-- | src/Makefile | 2 | ||||
-rw-r--r-- | src/scintilla.patch | 84 |
3 files changed, 95 insertions, 1 deletions
diff --git a/core/.buffer.luadoc b/core/.buffer.luadoc index 9170dc37..7a4529da 100644 --- a/core/.buffer.luadoc +++ b/core/.buffer.luadoc @@ -111,6 +111,15 @@ -- user lists. -- The default value is `0`, which automatically sizes the width to fit the -- longest item. +-- @field auto_c_multi (number) +-- The multiple selection autocomplete mode. +-- +-- * `buffer.MULTIAUTOC_ONCE` +-- Autocomplete into only the main selection. +-- * `buffer.MULTIAUTOC_EACH` +-- Autocomplete into all selections. +-- +-- The default value is `buffer.MULTIAUTOC_ONCE`. -- @field auto_c_order (number) -- The order setting for autocompletion and user lists. -- @@ -2781,6 +2790,7 @@ function set_lexer(buffer, lexer) end -- * allocate_sub_styles -- * assign_cmd_key -- * can_paste +-- * change_insertion -- * change_lexer_state -- * char_position_from_point -- * char_position_from_point_close diff --git a/src/Makefile b/src/Makefile index 3c1e522e..4d1537ce 100644 --- a/src/Makefile +++ b/src/Makefile @@ -437,7 +437,7 @@ osx-app: ../textadept ../textadeptjit ../textadept-curses \ # External dependencies. -scintilla_tgz = scintilla341.tgz +scintilla_tgz = scintilla342.tgz scinterm_zip = scinterm.zip scintillua_zip = scintillua.zip lua_tgz = lua-5.2.3.tar.gz diff --git a/src/scintilla.patch b/src/scintilla.patch index 3b30a825..837923da 100644 --- a/src/scintilla.patch +++ b/src/scintilla.patch @@ -18,3 +18,87 @@ diff -r 5693714a8b0b src/Catalogue.cxx return 1; } +diff -r a4286bbf7081 include/Scintilla.h +--- a/include/Scintilla.h Thu May 22 09:18:18 2014 +1000 ++++ b/include/Scintilla.h Sun May 25 17:30:19 2014 -0400 +@@ -717,6 +717,10 @@ + #define SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1 + #define SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR 2634 + #define SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR 2635 ++#define SC_MULTIAUTOC_ONCE 0 ++#define SC_MULTIAUTOC_EACH 1 ++#define SCI_AUTOCSETMULTI 2636 ++#define SCI_AUTOCGETMULTI 2637 + #define SC_ORDER_PRESORTED 0 + #define SC_ORDER_PERFORMSORT 1 + #define SC_ORDER_CUSTOM 2 +diff -r a4286bbf7081 src/ScintillaBase.cxx +--- a/src/ScintillaBase.cxx Thu May 22 09:18:18 2014 +1000 ++++ b/src/ScintillaBase.cxx Sun May 25 17:30:19 2014 -0400 +@@ -57,6 +57,7 @@ + displayPopupMenu = true; + listType = 0; + maxListWidth = 0; ++ multiAutoCMode = SC_MULTIAUTOC_ONCE; + } + + ScintillaBase::~ScintillaBase() { +@@ -197,9 +198,30 @@ + + 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) { +@@ -819,6 +841,13 @@ + 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; +diff -r a4286bbf7081 src/ScintillaBase.h +--- a/src/ScintillaBase.h Thu May 22 09:18:18 2014 +1000 ++++ b/src/ScintillaBase.h Sun May 25 17:30:19 2014 -0400 +@@ -46,6 +46,7 @@ + + int listType; ///< 0 is an autocomplete list + int maxListWidth; /// Maximum width of list, in average character widths ++ int multiAutoCMode; /// Mode for autocompleting when multiple selections are present + + #ifdef SCI_LEXER + LexState *DocumentLexState(); |