From 6d82fda3c167c1ebdc7242f9ee6d42de2a47e838 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 7 Apr 2007 00:57:03 +0000 Subject: More decoration code, with modifications reported from document to views although this isn't optimal. Some checking for null changes. Messages documented. Methods for changing indicators in Accessor so can be used by lexers. --- src/RunStyles.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/RunStyles.cxx') diff --git a/src/RunStyles.cxx b/src/RunStyles.cxx index a7cf40e81..9a644b1b4 100644 --- a/src/RunStyles.cxx +++ b/src/RunStyles.cxx @@ -106,11 +106,17 @@ int RunStyles::EndRun(int position) { return starts->PositionFromPartition(starts->PartitionFromPosition(position) + 1); } -void RunStyles::FillRange(int position, int value, int fillLength) { +bool RunStyles::FillRange(int position, int value, int fillLength) { int end = position + fillLength; - SplitRun(end); int runStart = RunFromPosition(position); - if (styles->ValueAt(runStart) != value) { + if (styles->ValueAt(runStart) == value) { + if (end <= starts->PositionFromPartition(runStart + 1)) { + // Whole range is already same as value + return false; + } + SplitRun(end); + } else { + SplitRun(end); SplitRun(position); runStart = RunFromPosition(position); styles->SetValueAt(runStart, value); @@ -123,6 +129,7 @@ void RunStyles::FillRange(int position, int value, int fillLength) { runEnd = RunFromPosition(end); RemoveRunIfSameAsPrevious(runEnd); RemoveRunIfSameAsPrevious(runStart); + return true; } void RunStyles::InsertSpace(int position, int insertLength) { -- cgit v1.2.3