migueldeicaza / XtermSharp

XTerm emulator as a .NET library
MIT License
161 stars 34 forks source link

Fix crash when resizing. #56

Closed sgmunn closed 4 years ago

sgmunn commented 4 years ago

When the user resizes the view a number of times, both vertically and horizontally, the terminal resizes the length of the lines and leave lines after length unadjusted.

This lets the buffer lines get into a state where there are lines that are not sized correctly because they are after the point in the buffer at which terminal thinks there is valid content. This seems to be valid, the issue I believe is that the the view updates the display it does not take into account the length of Buffer.Lines.

Maybe TerminalView should take into account the length of Buffer.Lines, but having the lines different and randomly different lengths in the array is also confusing when debugging and this isn't that much more expensive (since after the first full page of lines Length will start to approach MaxLength anyway).

sgmunn commented 4 years ago

FWIW, I added range checking in BuildAttributedString as well since we probably need more of this anyway.