From 386d275a0a0ea5b2725ff872fe8811cebecd2422 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 27 Mar 2018 19:35:55 +1100 Subject: Backport: Return a FillResult struct from RunStyles::FillRange instead of modifying arguments as that is clumsy when converting types. Backport of changeset 6657:43515e7709c6. --- src/RunStyles.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/RunStyles.h') diff --git a/src/RunStyles.h b/src/RunStyles.h index c28621334..af2eb3ec6 100644 --- a/src/RunStyles.h +++ b/src/RunStyles.h @@ -12,6 +12,16 @@ namespace Scintilla { +// Return for RunStyles::FillRange reports if anything was changed and the +// range that was changed. This may be trimmed from the requested range +// when some of the requested range already had the requested value. +template +struct FillResult { + bool changed; + DISTANCE position; + DISTANCE fillLength; +}; + template class RunStyles { private: @@ -33,8 +43,8 @@ public: DISTANCE FindNextChange(DISTANCE position, DISTANCE end) const; DISTANCE StartRun(DISTANCE position) const; DISTANCE EndRun(DISTANCE position) const; - // Returns true if some values may have changed - bool FillRange(DISTANCE &position, STYLE value, DISTANCE &fillLength); + // Returns changed=true if some values may have changed + FillResult FillRange(DISTANCE position, STYLE value, DISTANCE fillLength); void SetValueAt(DISTANCE position, STYLE value); void InsertSpace(DISTANCE position, DISTANCE insertLength); void DeleteAll(); -- cgit v1.2.3