diff options
Diffstat (limited to 'src/Document.cxx')
-rw-r--r-- | src/Document.cxx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 3f14335c0..7f4893711 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -1335,14 +1335,18 @@ int Document::WordPartRight(int pos) { return pos; } -int Document::ExtendStyleRange(int pos, int delta) { +bool IsLineEndChar(char c) { + return (c == '\n' || c == '\r'); +} + +int Document::ExtendStyleRange(int pos, int delta, bool singleLine) { int sStart = cb.StyleAt(pos); if (delta < 0) { - while (pos > 0 && (cb.StyleAt(pos) == sStart)) + while (pos > 0 && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))) ) pos--; pos++; } else { - while (pos < (Length()) && (cb.StyleAt(pos) == sStart)) + while (pos < (Length()) && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))) ) pos++; } return pos; |