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. --- src/Editor.cxx | 2 +- src/ViewStyle.cxx | 3 +++ src/ViewStyle.h | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') 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