How to clear change history markers?

50 views
Skip to first unread message

Mitchell

unread,
Apr 2, 2025, 9:57:35 PMApr 2
to scintilla-interest
Hi,

With change history enabled long enough, the margin eventually becomes all or mostly green. What is the recommended way to clear change history but preserve the ability to undo? Subsequent edits should still create modified markers. I can close and re-open a file, but I lose undo history. I suppose I could maybe use the new feature to save/restore undo history, but that seems a bit overkill.

Does anyone who is using change history have a way to deal with the “all green” margin scenario?

Cheers,
Mitchell

Neil Hodgson

unread,
Apr 3, 2025, 4:37:35 PMApr 3
to Scintilla mailing list
Mitchell:

> With change history enabled long enough, the margin eventually becomes all or mostly green. What is the recommended way to clear change history but preserve the ability to undo?

The change history implementation depends closely on the undo history and has to match exactly. The simplest approach for now is to turn off change history or just hide it.

> Subsequent edits should still create modified markers. I can close and re-open a file, but I lose undo history. I suppose I could maybe use the new feature to save/restore undo history, but that seems a bit overkill.

It would be possible to truncate both undo and change history at some point, removing both old change history markers and the ability to undo the changes they represent but this is similar to the save and reload case, just more selective.

There are possible future features like assigning an 'archaic' edition to changes before some point and then allowing choice of marker (including invisible) for that archaic edition. However, the implementation of change history was very complex and adding another edition that can still be undone correctly will increase complexity still further. I barely handled the original implementation effort.

Neil

Mitchell

unread,
Apr 4, 2025, 1:56:06 PMApr 4
to scintilla...@googlegroups.com
Hi Neil,

> On Apr 3, 2025, at 4:37 PM, 'Neil Hodgson' via scintilla-interest <scintilla...@googlegroups.com> wrote:
>
> Mitchell:
>
>> With change history enabled long enough, the margin eventually becomes all or mostly green. What is the recommended way to clear change history but preserve the ability to undo?
>
> The change history implementation depends closely on the undo history and has to match exactly. The simplest approach for now is to turn off change history or just hide it.

I’ve tried to turn it off and back on, but that didn’t work, because like you said, it’s dependent on undo history. (In this case, it has to be empty before turning it back on.)

>
>> Subsequent edits should still create modified markers. I can close and re-open a file, but I lose undo history. I suppose I could maybe use the new feature to save/restore undo history, but that seems a bit overkill.
>
> It would be possible to truncate both undo and change history at some point, removing both old change history markers and the ability to undo the changes they represent but this is similar to the save and reload case, just more selective.
>
> There are possible future features like assigning an 'archaic' edition to changes before some point and then allowing choice of marker (including invisible) for that archaic edition. However, the implementation of change history was very complex and adding another edition that can still be undone correctly will increase complexity still further. I barely handled the original implementation effort.

May I ask if you actually use this feature on a daily basis? Or did you implement it for someone other than yourself?

Cheers,
Mitchell

Neil Hodgson

unread,
Apr 4, 2025, 4:25:02 PMApr 4
to Scintilla mailing list
Hi Mitchell,

> May I ask if you actually use this feature on a daily basis?

Yes, I leave it turned on.

> Or did you implement it for someone other than yourself?

It has been a very common request over the years since other applications provide similar features. I wrote an inaccurate version of it long ago and people were prepared to use that despite its faults.

Neil

chinh...@gmail.com

unread,
Apr 21, 2025, 10:34:32 AMApr 21
to scintilla-interest
So I just want to confirm that once change history is enabled, there's no way to clear the markers? If I enable change history in my editor setup code and later set the text, emptying the undo buffer doesn't clear the markers and I still get the green markers even though there's nothing to undo.

Mitchell

unread,
Apr 21, 2025, 10:43:02 AMApr 21
to scintilla...@googlegroups.com
Hi,

> On Apr 21, 2025, at 10:34 AM, chinh...@gmail.com <chinh...@gmail.com> wrote:
>
> So I just want to confirm that once change history is enabled, there's no way to clear the markers? If I enable change history in my editor setup code and later set the text, emptying the undo buffer doesn't clear the markers and I still get the green markers even though there's nothing to undo.

If you are okay with emptying the undo buffer, then you’ll have to disable change history, clear the undo buffer, and then re-enable change history. Scintilla will start showing changes from this point forward.

Cheers,
Mitchell

chinh...@gmail.com

unread,
Apr 21, 2025, 2:53:46 PMApr 21
to scintilla-interest
Thank you, I thought I had tried that but evidently not because it's working now.
Reply all
Reply to author
Forward
0 new messages