From 4789f4214261e944fa0824f0a536debc8bc45897 Mon Sep 17 00:00:00 2001
From: Neil
Date: Sat, 20 Aug 2016 14:48:31 +1000
Subject: Bug [#1648]: Option added to prevent left arrow movement and
selection wrapping to previous line.
---
doc/ScintillaDoc.html | 9 +++++++--
doc/ScintillaHistory.html | 5 +++++
include/Scintilla.h | 1 +
include/Scintilla.iface | 1 +
src/Editor.cxx | 4 ++--
5 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index 93b9a9e70..6e94e52e3 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -1696,9 +1696,14 @@ struct Sci_TextToFind {
SCI_SETVIRTUALSPACEOPTIONS(int virtualSpace)
SCI_GETVIRTUALSPACEOPTIONS
Virtual space can be enabled or disabled for rectangular selections or in other circumstances or in both.
- There are two bit flags SCVS_RECTANGULARSELECTION=1 and
- SCVS_USERACCESSIBLE=2 which can be set independently.
+ There are three bit flags SCVS_RECTANGULARSELECTION=1,
+ SCVS_USERACCESSIBLE=2, and
+ SCVS_NOWRAPLINESTART=4 which can be set independently.
SCVS_NONE=0, the default, disables all use of virtual space.
+ SCVS_NOWRAPLINESTART prevents left arrow movement and selection
+ from wrapping to the previous line.
+ This is most commonly desired in conjunction with virtual space but is an independent
+ setting so works without virtual space.
SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index e8d806040..04acc3ca4 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -512,6 +512,11 @@
Released 24 May 2016.
+ SCVS_NOWRAPLINESTART option stops left arrow from wrapping to the previous line.
+ Most commonly wanted when virtual space is used.
+ Bug #1648.
+
+
The HTML lexer no longer treats "<?" inside a string in a script as potentially starting an XML document.
Bug #767.
diff --git a/include/Scintilla.h b/include/Scintilla.h
index 99bc6e7b1..8f0cd44b1 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -895,6 +895,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCVS_NONE 0
#define SCVS_RECTANGULARSELECTION 1
#define SCVS_USERACCESSIBLE 2
+#define SCVS_NOWRAPLINESTART 4
#define SCI_SETVIRTUALSPACEOPTIONS 2596
#define SCI_GETVIRTUALSPACEOPTIONS 2597
#define SCI_SETRECTANGULARSELECTIONMODIFIER 2598
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index 310d877a9..140cb70f4 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -2331,6 +2331,7 @@ enu VirtualSpace=SCVS_
val SCVS_NONE=0
val SCVS_RECTANGULARSELECTION=1
val SCVS_USERACCESSIBLE=2
+val SCVS_NOWRAPLINESTART=4
set void SetVirtualSpaceOptions=2596(int virtualSpaceOptions,)
get int GetVirtualSpaceOptions=2597(,)
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 3fbf4b341..bcba9bdf4 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -3283,7 +3283,7 @@ int Editor::HorizontalMove(unsigned int iMessage) {
case SCI_CHARLEFTRECTEXTEND:
if (pdoc->IsLineEndPosition(spCaret.Position()) && spCaret.VirtualSpace()) {
spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1);
- } else {
+ } else if ((virtualSpaceOptions & SCVS_NOWRAPLINESTART) == 0 || pdoc->GetColumn(spCaret.Position()) > 0) {
spCaret = SelectionPosition(spCaret.Position() - 1);
}
break;
@@ -3328,7 +3328,7 @@ int Editor::HorizontalMove(unsigned int iMessage) {
case SCI_CHARLEFTEXTEND:
if (spCaret.VirtualSpace()) {
spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1);
- } else {
+ } else if ((virtualSpaceOptions & SCVS_NOWRAPLINESTART) == 0 || pdoc->GetColumn(spCaret.Position()) > 0) {
spCaret = SelectionPosition(spCaret.Position() - 1);
}
break;
--
cgit v1.2.3