From e098d9e7420a8deec3db17df31d9d7bb4dbcf22b Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 28 Sep 2003 22:06:23 +0000 Subject: Hotspot improvements from Simon, including setting to limit hotspots to a single line. --- src/Document.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/Document.cxx') 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; -- cgit v1.2.3