aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/RunStyles.cxx
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2011-06-07 11:47:11 +1000
committernyamatongwe <devnull@localhost>2011-06-07 11:47:11 +1000
commit991dbfef722926eb5c919d90ab4e1e6a93b5ed51 (patch)
tree3f137c47d78f5fb49f50684cb5e6ad5a8cc1f72f /src/RunStyles.cxx
parentd220ba3aa321d58d1ab1bb7b07305c825ba53e16 (diff)
downloadscintilla-mirror-991dbfef722926eb5c919d90ab4e1e6a93b5ed51.tar.gz
Add Find method on RunStyles.
Diffstat (limited to 'src/RunStyles.cxx')
-rw-r--r--src/RunStyles.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/RunStyles.cxx b/src/RunStyles.cxx
index 93688b3f9..643d2fb2d 100644
--- a/src/RunStyles.cxx
+++ b/src/RunStyles.cxx
@@ -233,3 +233,18 @@ bool RunStyles::AllSame() const {
bool RunStyles::AllSameAs(int value) const {
return AllSame() && (styles->ValueAt(0) == value);
}
+
+int RunStyles::Find(int value, int start) const {
+ if (start < Length()) {
+ int run = start ? RunFromPosition(start) : 0;
+ if (styles->ValueAt(run) == value)
+ return start;
+ run++;
+ while (run < starts->Partitions()) {
+ if (styles->ValueAt(run) == value)
+ return starts->PositionFromPartition(run);
+ run++;
+ }
+ }
+ return -1;
+}