diff options
author | nyamatongwe <devnull@localhost> | 2011-11-16 10:43:52 +1100 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2011-11-16 10:43:52 +1100 |
commit | 445cc61d3c5dead15aeca9c363ccbbe57018d744 (patch) | |
tree | 47688bbd73047e85901aec3b576383b621c6ecc8 /src/Document.cxx | |
parent | 1def08bb984e864f4d34064bdb38db2e47e7bd86 (diff) | |
download | scintilla-mirror-445cc61d3c5dead15aeca9c363ccbbe57018d744.tar.gz |
Bug #3283519. CountCharacters added to count the number of
characters between two positions. From Andrey Moskalyov.
Diffstat (limited to 'src/Document.cxx')
-rw-r--r-- | src/Document.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 86d5c6077..c721c88ff 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -1094,6 +1094,20 @@ int Document::GetColumn(int pos) { return column; } +int Document::CountCharacters(int startPos, int endPos) { + startPos = MovePositionOutsideChar(startPos, 1, false); + endPos = MovePositionOutsideChar(endPos, -1, false); + int count = 0; + int i = startPos; + while (i < endPos) { + count++; + if (IsCrLf(i)) + i++; + i = NextPosition(i, 1); + } + return count; +} + int Document::FindColumn(int line, int column) { int position = LineStart(line); if ((line >= 0) && (line < LinesTotal())) { |