aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexlib/LexAccessor.h
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2013-06-27 17:22:43 +1000
committernyamatongwe <devnull@localhost>2013-06-27 17:22:43 +1000
commite4e994107dfed34034380947b2b1911d3f614045 (patch)
tree81578c7d2a39d5c376e75b2825c8d00be62d5451 /lexlib/LexAccessor.h
parent915a2dba75e8eabe945d9da033fb32603a82d61b (diff)
downloadscintilla-mirror-e4e994107dfed34034380947b2b1911d3f614045.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);
}