aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexlib/LexAccessor.h
diff options
context:
space:
mode:
authornyamatongwe <unknown>2013-06-27 17:22:43 +1000
committernyamatongwe <unknown>2013-06-27 17:22:43 +1000
commit35639b0cec5c5e293355c8660a7f36dfb71b5651 (patch)
tree0f9d1f7d614ffda7ff98d5246aca5bfaaa013fd5 /lexlib/LexAccessor.h
parent02e0b189ea2eb78f301b98fa2363943980a96a28 (diff)
downloadscintilla-mirror-35639b0cec5c5e293355c8660a7f36dfb71b5651.tar.gz
Bug: [#1483]. Adding StyleContext::GetRelativeCharacter for character-oriented access.
Implemented using new method IDocumentWithLineEnd::GetRelativePosition.
Diffstat (limited to 'lexlib/LexAccessor.h')
-rw-r--r--lexlib/LexAccessor.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/lexlib/LexAccessor.h b/lexlib/LexAccessor.h
index 4223f302d..92e719360 100644
--- a/lexlib/LexAccessor.h
+++ b/lexlib/LexAccessor.h
@@ -126,6 +126,21 @@ public:
return startNext - 1;
}
}
+ int GetRelativePosition(int start, int characterOffset, int *character, int *width) {
+ if (documentVersion >= dvLineEnd) {
+ return (static_cast<IDocumentWithLineEnd *>(pAccess))->GetRelativePosition(
+ start, characterOffset, character, width);
+ } else {
+ // Old version -> byte-oriented only
+ // Handle doc range overflow
+ int posNew = start + characterOffset;
+ if ((posNew < 0) || (posNew > Length()))
+ return -1;
+ *character = SafeGetCharAt(posNew, 0);
+ *width = 1;
+ return start + characterOffset;
+ }
+ }
int LevelAt(int line) const {
return pAccess->GetLevel(line);
}