aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2015-09-04 11:06:59 +1000
committerNeil <nyamatongwe@gmail.com>2015-09-04 11:06:59 +1000
commit37c8cba55c4b6ad5fcefec97175072d73bb58743 (patch)
tree773d03ee69cc49ae25f6556fc55e7dc4afb92882
parent8baed11d7ef1fd794cbbdf250e96b7cefec34ca0 (diff)
downloadscintilla-mirror-37c8cba55c4b6ad5fcefec97175072d73bb58743.tar.gz
Bug [#1757]. Treat CRLF as two characters in SCI_COUNTCHARACTERS.
-rw-r--r--doc/ScintillaHistory.html4
-rw-r--r--src/Document.cxx2
-rw-r--r--test/simpleTests.py8
3 files changed, 12 insertions, 2 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 9711938d8..81a6755e2 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -515,6 +515,10 @@
VHDL folder supports "protected" keyword.
</li>
<li>
+ Treat CRLF line end as two characters in SCI_COUNTCHARACTERS.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1757/">Bug #1757</a>.
+ </li>
+ <li>
On GTK+ 3.x, fix height of lines in autocompletion lists to match the font.
Switch from deprecated style calls to CSS styling.
Removed setting list colours on GTK+ 3.16+ as no longer appears needed.
diff --git a/src/Document.cxx b/src/Document.cxx
index 102e42383..956664103 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -1325,8 +1325,6 @@ int Document::CountCharacters(int startPos, int endPos) const {
int i = startPos;
while (i < endPos) {
count++;
- if (IsCrLf(i))
- i++;
i = NextPosition(i, 1);
}
return count;
diff --git a/test/simpleTests.py b/test/simpleTests.py
index 9b7525066..c7240b269 100644
--- a/test/simpleTests.py
+++ b/test/simpleTests.py
@@ -1577,6 +1577,7 @@ class TestCharacterNavigation(unittest.TestCase):
tv = t.encode("UTF-8")
self.ed.SetContents(tv)
self.assertEquals(self.ed.PositionRelative(1, 2), 6)
+ self.assertEquals(self.ed.CountCharacters(1, 6), 2)
self.assertEquals(self.ed.PositionRelative(6, -2), 1)
pos = 0
previous = 0
@@ -1593,6 +1594,13 @@ class TestCharacterNavigation(unittest.TestCase):
self.assert_(after < previous)
previous = after
+ def testLineEnd(self):
+ t = "a\r\nb\nc"
+ tv = t.encode("UTF-8")
+ self.ed.SetContents(tv)
+ for i in range(0, len(t)):
+ self.assertEquals(self.ed.CountCharacters(0, i), i)
+
class TestCaseMapping(unittest.TestCase):
def setUp(self):
self.xite = Xite.xiteFrame