diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Decoration.cxx | 7 | ||||
-rw-r--r-- | src/Decoration.h | 3 | ||||
-rw-r--r-- | src/Document.cxx | 11 | ||||
-rw-r--r-- | src/Document.h | 1 | ||||
-rw-r--r-- | src/DocumentAccessor.cxx | 4 | ||||
-rw-r--r-- | src/DocumentAccessor.h | 1 | ||||
-rw-r--r-- | src/Editor.cxx | 6 | ||||
-rw-r--r-- | src/RunStyles.cxx | 13 | ||||
-rw-r--r-- | src/RunStyles.h | 3 | ||||
-rw-r--r-- | src/WindowAccessor.cxx | 9 |
10 files changed, 46 insertions, 12 deletions
diff --git a/src/Decoration.cxx b/src/Decoration.cxx index f1c9c5ae3..3d23833cc 100644 --- a/src/Decoration.cxx +++ b/src/Decoration.cxx @@ -104,20 +104,21 @@ void DecorationList::SetCurrentIndicator(int indicator) { } void DecorationList::SetCurrentValue(int value) { - currentValue = value; + currentValue = value ? value : 1; } -void DecorationList::FillRange(int position, int value, int fillLength) { +bool DecorationList::FillRange(int position, int value, int fillLength) { if (!current) { current = DecorationFromIndicator(currentIndicator); if (!current) { current = Create(currentIndicator, lengthDocument); } } - current->rs.FillRange(position, value, fillLength); + bool changed = current->rs.FillRange(position, value, fillLength); if (current->Empty()) { Delete(currentIndicator); } + return changed; } void DecorationList::InsertSpace(int position, int insertLength) { diff --git a/src/Decoration.h b/src/Decoration.h index 1810b0fb3..03c06c0e0 100644 --- a/src/Decoration.h +++ b/src/Decoration.h @@ -41,7 +41,8 @@ public: void SetCurrentValue(int value); int GetCurrentValue() { return currentValue; } - void FillRange(int position, int value, int fillLength); + // Returns true if some values may have changed + bool FillRange(int position, int value, int fillLength); void InsertSpace(int position, int insertLength); void DeleteRange(int position, int deleteLength); diff --git a/src/Document.cxx b/src/Document.cxx index 964d4808b..a25e3070d 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -1340,6 +1340,17 @@ void Document::IncrementStyleClock() { } } +void Document::DecorationFillRange(int position, int value, int fillLength) { + if (decorations.FillRange(position, value, fillLength)) { + DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, + position, fillLength); + NotifyModified(mh); + } else { + DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, + position, fillLength); + } +} + bool Document::AddWatcher(DocWatcher *watcher, void *userData) { for (int i = 0; i < lenWatchers; i++) { if ((watchers[i].watcher == watcher) && diff --git a/src/Document.h b/src/Document.h index 90b4fe1b5..3659f86a4 100644 --- a/src/Document.h +++ b/src/Document.h @@ -218,6 +218,7 @@ public: void EnsureStyledTo(int pos); int GetStyleClock() { return styleClock; } void IncrementStyleClock(); + void DecorationFillRange(int position, int value, int fillLength); int SetLineState(int line, int state) { return cb.SetLineState(line, state); } int GetLineState(int line) { return cb.GetLineState(line); } diff --git a/src/DocumentAccessor.cxx b/src/DocumentAccessor.cxx index afe4670a4..e28264f73 100644 --- a/src/DocumentAccessor.cxx +++ b/src/DocumentAccessor.cxx @@ -190,3 +190,7 @@ int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnI return indent; } +void DocumentAccessor::IndicatorFill(int start, int end, int indicator, int value) { + pdoc->decorations.SetCurrentIndicator(indicator); + pdoc->DecorationFillRange(start, value, end - start); +} diff --git a/src/DocumentAccessor.h b/src/DocumentAccessor.h index 740652045..28f676db3 100644 --- a/src/DocumentAccessor.h +++ b/src/DocumentAccessor.h @@ -64,4 +64,5 @@ public: void ColourTo(unsigned int pos, int chAttr); void SetLevel(int line, int level); int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); + void IndicatorFill(int start, int end, int indicator, int value); }; diff --git a/src/Editor.cxx b/src/Editor.cxx index cdbd81474..6f381a8ef 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -7147,13 +7147,11 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return pdoc->decorations.GetCurrentValue(); case SCI_INDICATORFILLRANGE: - pdoc->decorations.FillRange(wParam, pdoc->decorations.GetCurrentValue(), lParam); - InvalidateRange(wParam, wParam + lParam); + pdoc->DecorationFillRange(wParam, pdoc->decorations.GetCurrentValue(), lParam); break; case SCI_INDICATORCLEARRANGE: - pdoc->decorations.FillRange(wParam, 0, lParam); - InvalidateRange(wParam, wParam + lParam); + pdoc->DecorationFillRange(wParam, 0, lParam); break; case SCI_INDICATORALLONFOR: 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) { diff --git a/src/RunStyles.h b/src/RunStyles.h index 539e5de47..8d5022cb4 100644 --- a/src/RunStyles.h +++ b/src/RunStyles.h @@ -24,7 +24,8 @@ public: int FindNextChange(int position, int end); int StartRun(int position); int EndRun(int position); - void FillRange(int position, int value, int fillLength); + // Returns true if some values may have changed + bool FillRange(int position, int value, int fillLength); void InsertSpace(int position, int insertLength); void DeleteAll(); void DeleteRange(int position, int deleteLength); diff --git a/src/WindowAccessor.cxx b/src/WindowAccessor.cxx index ce42534e7..8132b584e 100644 --- a/src/WindowAccessor.cxx +++ b/src/WindowAccessor.cxx @@ -176,3 +176,12 @@ int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsC return indent; } +void WindowAccessor::IndicatorFill(int start, int end, int indicator, int value) { + Platform::SendScintilla(id, SCI_SETINDICATORCURRENT, indicator); + if (value) { + Platform::SendScintilla(id, SCI_SETINDICATORVALUE, value); + Platform::SendScintilla(id, SCI_INDICATORFILLRANGE, start, end - start); + } else { + Platform::SendScintilla(id, SCI_INDICATORCLEARRANGE, start, end - start); + } +} |