aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2010-08-04 23:52:12 +1000
committernyamatongwe <unknown>2010-08-04 23:52:12 +1000
commit7f5c77d724edb3989e59b4dc2961fbf723ccc5ad (patch)
treeebdd2b6a1679cd39a2d0db84439cbb83d9713ee2
parentfd7f849fbe76cc2bd2cb243ac927c3c01d37cdd4 (diff)
downloadscintilla-mirror-7f5c77d724edb3989e59b4dc2961fbf723ccc5ad.tar.gz
Using NextPosition rather than MovePositionOutsideChar for column operations
and brace matching as it is much faster on DBCS text.
-rw-r--r--src/Document.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Document.cxx b/src/Document.cxx
index f9a1fede8..a58be8a0d 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -843,7 +843,7 @@ void Document::DelCharBack(int pos) {
} else if (IsCrLf(pos - 2)) {
DeleteChars(pos - 2, 2);
} else if (dbcsCodePage) {
- int startChar = MovePositionOutsideChar(pos - 1, -1, false);
+ int startChar = NextPosition(pos, -1);
DeleteChars(startChar, pos - startChar);
} else {
DeleteChars(pos - 1, 1);
@@ -936,7 +936,7 @@ int Document::GetColumn(int pos) {
return column;
} else {
column++;
- i = MovePositionOutsideChar(i + 1, 1, false);
+ i = NextPosition(i, 1);
}
}
}
@@ -958,7 +958,7 @@ int Document::FindColumn(int line, int column) {
return position;
} else {
columnCurrent++;
- position = MovePositionOutsideChar(position + 1, 1, false);
+ position = NextPosition(position, 1);
}
}
}
@@ -1821,9 +1821,8 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {
if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<')
direction = 1;
int depth = 1;
- position = position + direction;
+ position = NextPosition(position, direction);
while ((position >= 0) && (position < Length())) {
- position = MovePositionOutsideChar(position, direction, true);
char chAtPos = CharAt(position);
char styAtPos = static_cast<char>(StyleAt(position) & stylingBitsMask);
if ((position > GetEndStyled()) || (styAtPos == styBrace)) {
@@ -1834,7 +1833,10 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {
if (depth == 0)
return position;
}
- position = position + direction;
+ int positionBeforeMove = position;
+ position = NextPosition(position, direction);
+ if (position == positionBeforeMove)
+ break;
}
return - 1;
}