From 253bc4cd3a19e93f7090c74af92a871765afe002 Mon Sep 17 00:00:00 2001
From: Neil
Date: Sun, 2 Feb 2014 18:09:44 +1100
Subject: Added wrap mode SC_WRAP_WHITESPACE which only wraps on whitespace,
not on style changes. From Robert Gieseke.
---
doc/ScintillaDoc.html | 11 ++++++-----
doc/ScintillaHistory.html | 5 +++++
include/Scintilla.h | 1 +
include/Scintilla.iface | 1 +
src/Editor.cxx | 2 +-
src/ViewStyle.cxx | 3 +++
src/ViewStyle.h | 2 +-
7 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index 781695a14..306df840a 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -5625,11 +5625,12 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
SCI_SETWRAPMODE(int wrapMode)
SCI_GETWRAPMODE
Set wrapMode to SC_WRAP_WORD (1) to enable wrapping
- on word boundaries, SC_WRAP_CHAR (2) to enable wrapping
- between any characters, and to SC_WRAP_NONE (0) to disable line
- wrapping. SC_WRAP_CHAR is preferred to
- SC_WRAP_WORD for Asian languages where there is no white space
- between words.
+ on word or style boundaries, SC_WRAP_CHAR (2) to enable wrapping
+ between any characters, SC_WRAP_WHITESPACE (3) to enable
+ wrapping on whitespace, and SC_WRAP_NONE (0) to disable line
+ wrapping. SC_WRAP_CHAR is preferred for Asian languages where
+ there is no white space between words.
+
SCI_SETWRAPVISUALFLAGS(int wrapVisualFlags)
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 72aad759a..43b4b8327 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -440,6 +440,8 @@
felix |
Christian Walther |
Ebben |
+
+ | Robert Gieseke |
@@ -459,6 +461,9 @@
Released 16 March 2014.
+ Added wrap mode SC_WRAP_WHITESPACE which only wraps on whitespace, not on style changes.
+
+
Fix bug on Windows when resizing autocompletion list with only short strings caused the list to move.
diff --git a/include/Scintilla.h b/include/Scintilla.h
index ae1abc8e0..94a9d4b17 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -475,6 +475,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_WRAP_NONE 0
#define SC_WRAP_WORD 1
#define SC_WRAP_CHAR 2
+#define SC_WRAP_WHITESPACE 3
#define SCI_SETWRAPMODE 2268
#define SCI_GETWRAPMODE 2269
#define SC_WRAPVISUALFLAG_NONE 0x0000
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index 0728eadc0..77e932193 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -1189,6 +1189,7 @@ enu Wrap=SC_WRAP_
val SC_WRAP_NONE=0
val SC_WRAP_WORD=1
val SC_WRAP_CHAR=2
+val SC_WRAP_WHITESPACE=3
# Sets whether text is word wrapped.
set void SetWrapMode=2268(int mode,)
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 6694cbbb3..0f0eed80b 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -2400,7 +2400,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
- posLineStart;
p = pdoc->MovePositionOutsideChar(p + 1 + posLineStart, 1) - posLineStart;
continue;
- } else if (ll->styles[p] != ll->styles[p - 1]) {
+ } else if ((vstyle.wrapState == eWrapWord) && (ll->styles[p] != ll->styles[p - 1])) {
lastGoodBreak = p;
} else if (IsSpaceOrTab(ll->chars[p - 1]) && !IsSpaceOrTab(ll->chars[p])) {
lastGoodBreak = p;
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index 4b82c9c05..503775dbf 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -450,6 +450,9 @@ bool ViewStyle::SetWrapState(int wrapState_) {
case SC_WRAP_CHAR:
wrapStateWanted = eWrapChar;
break;
+ case SC_WRAP_WHITESPACE:
+ wrapStateWanted = eWrapWhitespace;
+ break;
default:
wrapStateWanted = eWrapNone;
break;
diff --git a/src/ViewStyle.h b/src/ViewStyle.h
index 3fbe2d751..da8b7e141 100644
--- a/src/ViewStyle.h
+++ b/src/ViewStyle.h
@@ -56,7 +56,7 @@ enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterInden
typedef std::map FontMap;
-enum WrapMode { eWrapNone, eWrapWord, eWrapChar };
+enum WrapMode { eWrapNone, eWrapWord, eWrapChar, eWrapWhitespace };
class ColourOptional : public ColourDesired {
public:
--
cgit v1.2.3