Re: Change history markers confusion

"[email protected]" <[email protected]> Thu, 15 May 2025 10:07:37 -0700 (PDT)
Newsgroups gmane.comp.lib.scintilla.devel
Message-ID <[email protected]>
[image: changehistory.gif]
Here's an animated gif of what I was describing. I changed the green-yellow 
(revert to modified) to just yellow to make it more distinguishable from 
the green (saved).
On Thursday, May 15, 2025 at 9:35:47 AM UTC-5 [email protected] wrote:

> I'm a little confused by the behavior of the change history markers. I'm 
> seeing a modified and saved marker in situations where I would've expected 
> a reverted to modified marker. I am using only the markers and turned off 
> the indicators.
>
> If I open a file that contains the text
>
> *This is a test.*
>
> and edit it to
>
> *This was a test.*
>
> by moving the cursor to the right of the letter *i* in the word *is*, and 
> pressing delete to delete the *i*, the marker in the change history 
> margin turns orange. Typing the letters *w*, then *a* continue to make 
> the marker orange. When I save it, the marker turns green. If I undo once, 
> the marker turns green-yellow. If I undo once again, the marker turns cyan 
> as the line is now at its original state. This behaves exactly as expected.
>
> However, if I reopen the file and repeat the edits but after the first 
> undo where the marker turns green-yellow, I add a character and the marker 
> stays green-yellow instead of orange. The documentation states "The margin 
> shows a block indicating the overall state of the line, prioritizing the 
> more consequential modified states." but I still would've expected the line 
> to be considered modified.
>
> Now reopen the file and edit the line to
>
> *This as I rest.*
>
> by selecting the *i* in *is* and typing the letter *a* to replace the *I*, then 
> selecting the letter *a* in the word *a* and pressing the letter *I* to 
> replace it, then selecting the letter *t* in *test* and replacing it with 
> *r*, the marker turns orange as expected. Save the file and the marker 
> turns green. However, if undo once, the marker stays green instead of the 
> green-yellow I expected. Undo again and the marker stays green. Why did the 
> marker stay green instead of green-yellow? It appears that you get 
> different marker colors depending on whether you edited from a single 
> position on a saved line versus editing multiple positions on a saved line.
>
> Reopen the file and edit the line to
>
> *This 1 is 2 a 3 test.*
>
> by inserting the characters and saving results in the same behavior with 
> the marker staying green as you undo each change until you get back to the 
> original state of the line. If you redo all the changes, the marker is 
> green. Undo once and the marker stays green. Now type some text and the 
> marker turns orange as expected but that conflicts with the behavior from 
> my second behavior above where the marker stayed green-yellow after adding 
> some text after an undo.
>
> The documentation for SC_MARKNUM_HISTORY_SAVED (green marker) says "This 
> line was modified and saved. This line is the same as its state on disk." 
> but that's not the behavior that I'm seeing. I looked at Visual Studio and 
> their history markers only have 3 states where there is no reverted to 
> modified, it's just modified. I originally made reverted to modified and 
> modified the same color but a tester got confused by it so I made reverted 
> to modified its own color. I now see what the tester got confused by was 
> the marker actually turning green after an undo instead of orange.
>
> So is this all a bug or is it behaving as expected?
>
> Also, I put the change history markers in its own margin. If I have 
> markers on and indicators off, hiding the change history margin for some 
> reason changes the background color of each line of text to the history 
> marker color of each line.
>

-- 
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/scintilla-interest/8d603bf0-af11-458e-a76b-806819fcadc0n%40googlegroups.com.
changehistory.gif (image/gif, 587.2 KB) - not displayed