diff options
author | nyamatongwe <unknown> | 2005-02-10 12:46:17 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2005-02-10 12:46:17 +0000 |
commit | 6eee037fe180acd217d783aebb1e0aafda3b64b2 (patch) | |
tree | f555711b7515758f97d4cacab0694579d61f69c0 /src | |
parent | 85c1f8645c626b914a9f0046dd3f70335ef15dac (diff) | |
download | scintilla-mirror-6eee037fe180acd217d783aebb1e0aafda3b64b2.tar.gz |
Patch from Suzumizaki-Kimitaka to add character wrap mode.
Diffstat (limited to 'src')
-rw-r--r-- | src/Editor.cxx | 19 | ||||
-rw-r--r-- | src/Editor.h | 2 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 59bc76e9d..e049485f2 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2063,7 +2063,12 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou continue; } if (p > 0) { - if (ll->styles[p] != ll->styles[p - 1]) { + if (wrapState == eWrapChar){ + lastGoodBreak = pdoc->MovePositionOutsideChar(p + posLineStart, -1) + - posLineStart; + p = pdoc->MovePositionOutsideChar(p + 1 + posLineStart, 1) - posLineStart; + continue; + } else if (ll->styles[p] != ll->styles[p - 1]) { lastGoodBreak = p; } else if (IsSpaceOrTab(ll->chars[p - 1]) && !IsSpaceOrTab(ll->chars[p])) { lastGoodBreak = p; @@ -6231,7 +6236,17 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return pdoc->ExtendWordSelect(wParam, 1, lParam != 0); case SCI_SETWRAPMODE: - wrapState = (wParam == SC_WRAP_WORD) ? eWrapWord : eWrapNone; + switch(wParam){ + case SC_WRAP_WORD: + wrapState = eWrapWord; + break; + case SC_WRAP_CHAR: + wrapState = eWrapChar; + break; + default: + wrapState = eWrapNone; + break; + } xOffset = 0; InvalidateStyleRedraw(); ReconfigureScrollBars(); diff --git a/src/Editor.h b/src/Editor.h index e14cb5ed9..bace500bd 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -301,7 +301,7 @@ protected: // ScintillaBase subclass needs access to much of Editor int hsEnd; // Wrapping support - enum { eWrapNone, eWrapWord } wrapState; + enum { eWrapNone, eWrapWord, eWrapChar } wrapState; bool backgroundWrapEnabled; int wrapWidth; int docLineLastWrapped; |