aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2014-02-02 18:09:44 +1100
committerNeil <nyamatongwe@gmail.com>2014-02-02 18:09:44 +1100
commit687cd7a0e91208e97bd198cf13f416b0937dd6c3 (patch)
treea6d7f5846f990f253133af659524622292192736
parente9b3faa25f71650ed4c16aeeef893dd72d713525 (diff)
downloadscintilla-mirror-687cd7a0e91208e97bd198cf13f416b0937dd6c3.tar.gz
Added wrap mode SC_WRAP_WHITESPACE which only wraps on whitespace, not on style changes.
From Robert Gieseke.
-rw-r--r--doc/ScintillaDoc.html11
-rw-r--r--doc/ScintillaHistory.html5
-rw-r--r--include/Scintilla.h1
-rw-r--r--include/Scintilla.iface1
-rw-r--r--src/Editor.cxx2
-rw-r--r--src/ViewStyle.cxx3
-rw-r--r--src/ViewStyle.h2
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){
<p><b id="SCI_SETWRAPMODE">SCI_SETWRAPMODE(int wrapMode)</b><br />
<b id="SCI_GETWRAPMODE">SCI_GETWRAPMODE</b><br />
Set wrapMode to <code>SC_WRAP_WORD</code> (1) to enable wrapping
- on word boundaries, <code>SC_WRAP_CHAR</code> (2) to enable wrapping
- between any characters, and to <code>SC_WRAP_NONE</code> (0) to disable line
- wrapping. <code>SC_WRAP_CHAR</code> is preferred to
- <code>SC_WRAP_WORD</code> for Asian languages where there is no white space
- between words.</p>
+ on word or style boundaries, <code>SC_WRAP_CHAR</code> (2) to enable wrapping
+ between any characters, <code>SC_WRAP_WHITESPACE</code> (3) to enable
+ wrapping on whitespace, and <code>SC_WRAP_NONE</code> (0) to disable line
+ wrapping. <code>SC_WRAP_CHAR</code> is preferred for Asian languages where
+ there is no white space between words.
+ </p>
<p><b id="SCI_SETWRAPVISUALFLAGS">SCI_SETWRAPVISUALFLAGS(int wrapVisualFlags)</b><br />
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 @@
<td>felix</td>
<td>Christian Walther</td>
<td>Ebben</td>
+ </tr><tr>
+ <td>Robert Gieseke</td>
</tr>
</table>
<p>
@@ -459,6 +461,9 @@
Released 16 March 2014.
</li>
<li>
+ Added wrap mode SC_WRAP_WHITESPACE which only wraps on whitespace, not on style changes.
+ </li>
+ <li>
Fix bug on Windows when resizing autocompletion list with only short strings caused the list to move.
</li>
</ul>
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<FontSpecification, FontRealised *> FontMap;
-enum WrapMode { eWrapNone, eWrapWord, eWrapChar };
+enum WrapMode { eWrapNone, eWrapWord, eWrapChar, eWrapWhitespace };
class ColourOptional : public ColourDesired {
public: