diff options
-rw-r--r-- | doc/ScintillaDoc.html | 13 | ||||
-rw-r--r-- | include/Scintilla.h | 1 | ||||
-rw-r--r-- | include/Scintilla.iface | 24 | ||||
-rw-r--r-- | src/Editor.cxx | 19 | ||||
-rw-r--r-- | src/Editor.h | 2 |
5 files changed, 53 insertions, 6 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 51c40b36a..495d93dff 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -3582,11 +3582,15 @@ struct RangeToFormat { <p><b id="SCI_SETPRINTWRAPMODE">SCI_SETPRINTWRAPMODE(int wrapMode)</b><br /> <b id="SCI_GETPRINTWRAPMODE">SCI_GETPRINTWRAPMODE</b><br /> These two functions get and set the printer wrap mode. <code>wrapMode</code> can be - set to <code>SC_WRAP_NONE</code> (0) or <code>SC_WRAP_WORD</code> (1). The default is + set to <code>SC_WRAP_NONE</code> (0), <code>SC_WRAP_WORD</code> (1) or + <code>SC_WRAP_CHAR</code> (2). The default is <code>SC_WRAP_WORD</code>, which wraps printed output so that all characters fit into the print rectangle. If you set <code>SC_WRAP_NONE</code>, each line of text generates one line of output and the line is truncated if it is too long to fit - into the print area.</p> + into the print area.<br />It is important that <code>SC_WRAP_WORD</code> is + not only for low spec computers but for some languages/situations. This makes + wrapping after any characters but it is OK. Some language don't have whitespaces + between words.</p> <h2 id="DirectAccess">Direct access</h2> <code><a class="message" href="#SCI_GETDIRECTFUNCTION">SCI_GETDIRECTFUNCTION</a><br /> @@ -3928,7 +3932,10 @@ 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 line wrapping and to - <code>SC_WRAP_NONE</code> (0) to disable line wrapping.</p> + <code>SC_WRAP_NONE</code> (0) to disable line wrapping. And to + <code>SC_WRAP_CHAR</code> (2), it is highly recommended to implement for i18n + product, enables character wrapping mode.</p> + <p><b id="SCI_SETWRAPVISUALFLAGS">SCI_SETWRAPVISUALFLAGS(int wrapVisualFlags)</b><br /> <b id="SCI_GETWRAPVISUALFLAGS">SCI_GETWRAPVISUALFLAGS</b><br /> diff --git a/include/Scintilla.h b/include/Scintilla.h index f20f0de22..d263d5026 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -386,6 +386,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_WORDENDPOSITION 2267 #define SC_WRAP_NONE 0 #define SC_WRAP_WORD 1 +#define SC_WRAP_CHAR 2 #define SCI_SETWRAPMODE 2268 #define SCI_GETWRAPMODE 2269 #define SC_WRAPVISUALFLAG_NONE 0x0000 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index de1377847..eaebaaeca 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -994,6 +994,7 @@ fun int WordEndPosition=2267(position pos, bool onlyWordCharacters) enu Wrap=SC_WRAP_ val SC_WRAP_NONE=0 val SC_WRAP_WORD=1 +val SC_WRAP_CHAR=2 # Sets whether text is word wrapped. set void SetWrapMode=2268(int mode,) @@ -1751,6 +1752,9 @@ val SCLEX_APDL=61 val SCLEX_BASH=62 val SCLEX_ASN1=63 val SCLEX_VHDL=64 +val SCLEX_CAML=65 +val SCLEX_BLITZBASIC=66 +val SCLEX_PUREBASIC=67 # When a lexer specifies its language as SCLEX_AUTOMATIC it receives a # value assigned in sequence from SCLEX_AUTOMATIC+1. @@ -1977,6 +1981,10 @@ val SCE_B_KEYWORD3=11 val SCE_B_KEYWORD4=12 val SCE_B_CONSTANT=13 val SCE_B_ASM=14 +val SCE_B_LABEL=15 +val SCE_B_ERROR=16 +val SCE_B_HEXNUMBER=17 +val SCE_B_BINNUMBER=18 # Lexical states for SCLEX_PROPERTIES lex Properties=SCLEX_PROPERTIES SCE_PROPS_ val SCE_PROPS_DEFAULT=0 @@ -2579,6 +2587,22 @@ val SCE_VHDL_STDFUNCTION=11 val SCE_VHDL_STDPACKAGE=12 val SCE_VHDL_STDTYPE=13 val SCE_VHDL_USERWORD=14 +# Lexical states for SCLEX_CAML +lex Caml=SCLEX_CAML SCE_CAML_ +val SCE_CAML_DEFAULT=0 +val SCE_CAML_IDENTIFIER=1 +val SCE_CAML_TAGNAME=2 +val SCE_CAML_KEYWORD=3 +val SCE_CAML_KEYWORD2=4 +val SCE_CAML_LINENUM=5 +val SCE_CAML_OPERATOR=6 +val SCE_CAML_NUMBER=7 +val SCE_CAML_CHAR=8 +val SCE_CAML_STRING=9 +val SCE_CAML_COMMENT=10 +val SCE_CAML_COMMENT1=11 +val SCE_CAML_COMMENT2=12 +val SCE_CAML_COMMENT3=13 # Events 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; |