From d6ac5bf56d40512ac0634d7a5bee6f7328b7d41f Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 19 Jan 2013 11:40:47 +1100 Subject: Support the three Unicode line ends NEL, LS, and PS in CellBuffer, Document, Editor and the message interface. Will only be turned on for lexers that support Unicode line ends. --- src/Document.cxx | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'src/Document.cxx') diff --git a/src/Document.cxx b/src/Document.cxx index 2036f383c..b75c754ac 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -87,6 +87,7 @@ Document::Document() { eolMode = SC_EOL_LF; #endif dbcsCodePage = 0; + lineEndBitSet = SC_LINE_END_TYPE_DEFAULT; stylingBits = 5; stylingBitsMask = 0x1F; stylingMask = 0; @@ -157,12 +158,29 @@ bool Document::SetDBCSCodePage(int dbcsCodePage_) { if (dbcsCodePage != dbcsCodePage_) { dbcsCodePage = dbcsCodePage_; SetCaseFolder(NULL); + cb.SetLineEndTypes(lineEndBitSet & LineEndTypesSupported()); return true; } else { return false; } } +bool Document::SetLineEndTypesAllowed(int lineEndBitSet_) { + if (lineEndBitSet != lineEndBitSet_) { + lineEndBitSet = lineEndBitSet_; + int lineEndBitSetActive = lineEndBitSet & LineEndTypesSupported(); + if (lineEndBitSetActive != cb.GetLineEndTypes()) { + ModifiedAt(0); + cb.SetLineEndTypes(lineEndBitSetActive); + return true; + } else { + return false; + } + } else { + return false; + } +} + void Document::InsertLine(int line) { for (int j=0; j(cb.CharAt(position-3)), + static_cast(cb.CharAt(position-2)), + static_cast(cb.CharAt(position-1)), + }; + if (UTF8IsSeparator(bytes)) { + return position - UTF8SeparatorLength; + } + if (UTF8IsNEL(bytes+1)) { + return position - UTF8NELLength; + } + } + position--; // Back over CR or LF // When line terminator is CR+LF, may need to go back one more if ((position > LineStart(line)) && (cb.CharAt(position - 1) == '\r')) { position--; -- cgit v1.2.3