Closed workgroupengineering closed 2 months ago
The action of adding a snippet adds multiple lines and thus exposes the lack of checking whether the invalidated line range is out of bounds. The call stack shows that the exception is ultimately thrown by TextMateSharp because it attempts to read the line at the given index, without checking whether it's in bounds. This can be retrieved via the GetNumberOfLines()
method from the model, and evaluated such that InvalidateLineRange(int, int)
doesn't run the loop with out of bounds indexes.
@danipen Does this belong to https://github.com/danipen/TextMateSharp? Then this issue would track the respective issue in that repo.
I'd say this should be fixed at this layer: https://github.com/AvaloniaUI/AvaloniaEdit/blob/master/src/AvaloniaEdit.TextMate/TextEditorModel.cs
How to simulate:
AvaloniaEdit.sln
AvaloniaEdit.Demo
Enter
keyInsert Snipet
aaa
and pressEnter
key for confirm the changeCTRL+Z
four times