diff options
author | nyamatongwe <unknown> | 2003-10-27 12:13:16 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2003-10-27 12:13:16 +0000 |
commit | eb8608f6b17d147ca3217e4237d602cf5933d9a2 (patch) | |
tree | b7792180becaeeba46b43bd476e503a349e6e57f /src/Document.cxx | |
parent | 696c95c34cc90a55e716ec070a3dd31ce958520c (diff) | |
download | scintilla-mirror-eb8608f6b17d147ca3217e4237d602cf5933d9a2.tar.gz |
Patches from Roy Wood:
Word movement to end of word.
Stuttered page movement.
User defined keyboard accelerators on GTK+.
Diffstat (limited to 'src/Document.cxx')
-rw-r--r-- | src/Document.cxx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 7f4893711..130a920e1 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -792,6 +792,40 @@ int Document::NextWordStart(int pos, int delta) { } /** + * Find the end of the next word in either a forward (delta >= 0) or backwards direction + * (delta < 0). + * This is looking for a transition between character classes although there is also some + * additional movement to transit white space. + * Used by cursor movement by word commands. + */ +int Document::NextWordEnd(int pos, int delta) { + if (delta < 0) { + if (pos > 0) { + charClassification ccStart = WordCharClass(cb.CharAt(pos-1)); + if (ccStart != ccSpace) { + while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccStart) { + pos--; + } + } + while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccSpace) { + pos--; + } + } + } else { + while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccSpace) { + pos++; + } + if (pos < Length()) { + charClassification ccStart = WordCharClass(cb.CharAt(pos)); + while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccStart) { + pos++; + } + } + } + return pos; +} + +/** * Check that the character at the given position is a word or punctuation character and that * the previous character is of a different character class. */ |