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 | 2ceaae0b1f19981706806cd71a1dff695b72cc1a (patch) | |
tree | ed11c4b4f901369c89fbec4cb5a91f16ad6c5e56 | |
parent | a085cc290740259d076f1e19c4b2d1002853f2b7 (diff) | |
download | scintilla-mirror-2ceaae0b1f19981706806cd71a1dff695b72cc1a.tar.gz |
Feature [feature-requests:#1316] Add access to virtual space at start and end of
multiple selections.
-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 aee54e206..9fa7f94c1 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -119,7 +119,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 /> @@ -1639,8 +1639,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 /> @@ -1790,9 +1792,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 02c8e8698..42bbd68f3 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -567,6 +567,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> SciTE on Win32 adds mouse button "Forward" and "Backward" key definitions for use in properties like user.shortcuts. <a href="https://sourceforge.net/p/scintilla/feature-requests/1317/">Feature #1317</a>. diff --git a/include/Scintilla.h b/include/Scintilla.h index 40a2c8eca..59ab2ff7a 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -931,7 +931,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 1daaf4b9d..9fa952f95 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -2599,9 +2599,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 d2b447d86..826824cbd 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -8158,9 +8158,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 |