From 2ceaae0b1f19981706806cd71a1dff695b72cc1a Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 15 Nov 2019 08:19:12 +1100 Subject: Feature [feature-requests:#1316] Add access to virtual space at start and end of multiple selections. --- doc/ScintillaDoc.html | 7 ++++++- doc/ScintillaHistory.html | 4 ++++ include/Scintilla.h | 2 ++ include/Scintilla.iface | 6 ++++++ src/Editor.cxx | 6 ++++++ test/simpleTests.py | 4 ++++ 6 files changed, 28 insertions(+), 1 deletion(-) 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 @@

Scintilla Documentation

-

Last edited 22 June 2019 NH

+

Last edited 15 November 2019 NH

There is an overview of the internal design of Scintilla.
@@ -1639,8 +1639,10 @@ struct Sci_TextToFind { SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection) → position
SCI_SETSELECTIONNSTART(int selection, position anchor)
SCI_GETSELECTIONNSTART(int selection) → position
+ SCI_GETSELECTIONNSTARTVIRTUALSPACE(int selection) → position
SCI_SETSELECTIONNEND(int selection, position caret)
SCI_GETSELECTIONNEND(int selection) → position
+ SCI_GETSELECTIONNENDVIRTUALSPACE(int selection) → position

SCI_SETRECTANGULARSELECTIONCARET(position caret)
@@ -1790,9 +1792,12 @@ struct Sci_TextToFind {

SCI_SETSELECTIONNSTART(int selection, position anchor)
SCI_GETSELECTIONNSTART(int selection) → position
+ SCI_GETSELECTIONNSTARTVIRTUALSPACE(int selection) → position
SCI_SETSELECTIONNEND(int selection, position caret)
SCI_GETSELECTIONNEND(int selection) → position
+ SCI_GETSELECTIONNENDVIRTUALSPACE(int selection) → position
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.

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.

  • + Add methods for finding the virtual space at start and end of multiple selections. + Feature #1316. +
  • +
  • SciTE on Win32 adds mouse button "Forward" and "Backward" key definitions for use in properties like user.shortcuts. Feature #1317. 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 -- cgit v1.2.3