diff options
| author | Neil <nyamatongwe@gmail.com> | 2019-11-15 08:19:12 +1100 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2019-11-15 08:19:12 +1100 |
| commit | 3b72fe93906e4c6b8c800cf2c7b986bc2c2c89a2 (patch) | |
| tree | 9ec118225cfc6c07a3963a19e8cf6b8dbc46d763 | |
| parent | 03203843a7ccaef46938a7e54ff6c0fd838cafdf (diff) | |
| download | scintilla-mirror-3b72fe93906e4c6b8c800cf2c7b986bc2c2c89a2.tar.gz | |
Backport: Feature [feature-requests:#1316] Add access to virtual space at start and end of
multiple selections.
Backport of changeset 7767:80102fe650b2.
| -rw-r--r-- | doc/ScintillaDoc.html | 7 | ||||
| -rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
| -rw-r--r-- | include/Scintilla.h | 2 | ||||
| -rw-r--r-- | include/Scintilla.iface | 6 | ||||
| -rw-r--r-- | src/Editor.cxx | 6 | ||||
| -rw-r--r-- | test/simpleTests.py | 4 |
6 files changed, 28 insertions, 1 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 89214ffbd..e407689c1 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -116,7 +116,7 @@ <h1>Scintilla Documentation</h1> - <p>Last edited 22 June 2019 NH</p> + <p>Last edited 15 November 2019 NH</p> <p>There is <a class="jump" href="Design.html">an overview of the internal design of Scintilla</a>.<br /> @@ -1636,8 +1636,10 @@ struct Sci_TextToFind { <a class="message" href="#SCI_GETSELECTIONNANCHORVIRTUALSPACE">SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection) → position</a><br /> <a class="message" href="#SCI_SETSELECTIONNSTART">SCI_SETSELECTIONNSTART(int selection, position anchor)</a><br /> <a class="message" href="#SCI_GETSELECTIONNSTART">SCI_GETSELECTIONNSTART(int selection) → position</a><br /> + <a class="message" href="#SCI_GETSELECTIONNSTARTVIRTUALSPACE">SCI_GETSELECTIONNSTARTVIRTUALSPACE(int selection) → position</a><br /> <a class="message" href="#SCI_SETSELECTIONNEND">SCI_SETSELECTIONNEND(int selection, position caret)</a><br /> <a class="message" href="#SCI_GETSELECTIONNEND">SCI_GETSELECTIONNEND(int selection) → position</a><br /> + <a class="message" href="#SCI_GETSELECTIONNENDVIRTUALSPACE">SCI_GETSELECTIONNENDVIRTUALSPACE(int selection) → position</a><br /> <br /> <a class="message" href="#SCI_SETRECTANGULARSELECTIONCARET">SCI_SETRECTANGULARSELECTIONCARET(position caret)</a><br /> @@ -1787,9 +1789,12 @@ struct Sci_TextToFind { <p> <b id="SCI_SETSELECTIONNSTART">SCI_SETSELECTIONNSTART(int selection, position anchor)</b><br /> <b id="SCI_GETSELECTIONNSTART">SCI_GETSELECTIONNSTART(int selection) → position</b><br /> + <b id="SCI_GETSELECTIONNSTARTVIRTUALSPACE">SCI_GETSELECTIONNSTARTVIRTUALSPACE(int selection) → position</b><br /> <b id="SCI_SETSELECTIONNEND">SCI_SETSELECTIONNEND(int selection, position caret)</b><br /> <b id="SCI_GETSELECTIONNEND">SCI_GETSELECTIONNEND(int selection) → position</b><br /> + <b id="SCI_GETSELECTIONNENDVIRTUALSPACE">SCI_GETSELECTIONNENDVIRTUALSPACE(int selection) → position</b><br /> Set or query the start and end position of each already existing selection. + Query the virtual space at start and end of each selection. Mostly of use to query each range for its text. The selection parameter is zero-based. </p> <p> diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 87a0964fb..1668675a8 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -561,6 +561,10 @@ Released 24 October 2019. </li> <li> + Add methods for finding the virtual space at start and end of multiple selections. + <a href="https://sourceforge.net/p/scintilla/feature-requests/1316/">Feature #1316</a>. + </li> + <li> Lexer and folder added for Hollywood language. <a href="https://sourceforge.net/p/scintilla/feature-requests/1324/">Feature #1324</a>. </li> diff --git a/include/Scintilla.h b/include/Scintilla.h index fbbc173d6..693e8e460 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -933,7 +933,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETSELECTIONNANCHORVIRTUALSPACE 2583 #define SCI_SETSELECTIONNSTART 2584 #define SCI_GETSELECTIONNSTART 2585 +#define SCI_GETSELECTIONNSTARTVIRTUALSPACE 2726 #define SCI_SETSELECTIONNEND 2586 +#define SCI_GETSELECTIONNENDVIRTUALSPACE 2727 #define SCI_GETSELECTIONNEND 2587 #define SCI_SETRECTANGULARSELECTIONCARET 2588 #define SCI_GETRECTANGULARSELECTIONCARET 2589 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 5194828cb..2aec8d092 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -2606,9 +2606,15 @@ set void SetSelectionNStart=2584(int selection, position anchor) # Returns the position at the start of the selection. get position GetSelectionNStart=2585(int selection,) +# Returns the virtual space at the start of the selection. +get position GetSelectionNStartVirtualSpace=2726(int selection,) + # Sets the position that ends the selection - this becomes the currentPosition. set void SetSelectionNEnd=2586(int selection, position caret) +# Returns the virtual space at the end of the selection. +get position GetSelectionNEndVirtualSpace=2727(int selection,) + # Returns the position at the end of the selection. get position GetSelectionNEnd=2587(int selection,) diff --git a/src/Editor.cxx b/src/Editor.cxx index b26d19c8b..f11009d36 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -8145,9 +8145,15 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETSELECTIONNSTART: return sel.Range(wParam).Start().Position(); + case SCI_GETSELECTIONNSTARTVIRTUALSPACE: + return sel.Range(wParam).Start().VirtualSpace(); + case SCI_GETSELECTIONNEND: return sel.Range(wParam).End().Position(); + case SCI_GETSELECTIONNENDVIRTUALSPACE: + return sel.Range(wParam).End().VirtualSpace(); + case SCI_SETRECTANGULARSELECTIONCARET: if (!sel.IsRectangular()) sel.Clear(); diff --git a/test/simpleTests.py b/test/simpleTests.py index 6e7d10721..a4730980f 100644 --- a/test/simpleTests.py +++ b/test/simpleTests.py @@ -1407,10 +1407,14 @@ class TestMultiSelection(unittest.TestCase): self.assertEquals(self.ed.GetSelectionNCaretVirtualSpace(0), 3) self.ed.SetSelectionNAnchorVirtualSpace(0, 2) self.assertEquals(self.ed.GetSelectionNAnchorVirtualSpace(0), 2) + self.assertEquals(self.ed.GetSelectionNStartVirtualSpace(0), 3) + self.assertEquals(self.ed.GetSelectionNEndVirtualSpace(0), 2) # Does not check that virtual space is valid by being at end of line self.ed.SetSelection(1, 1) self.ed.SetSelectionNCaretVirtualSpace(0, 3) self.assertEquals(self.ed.GetSelectionNCaretVirtualSpace(0), 3) + self.assertEquals(self.ed.GetSelectionNStartVirtualSpace(0), 0) + self.assertEquals(self.ed.GetSelectionNEndVirtualSpace(0), 3) def testRectangularVirtualSpace(self): self.ed.VirtualSpaceOptions=1 |
