Skip to content

Clamp selection text bounds#9

Open
jchristn wants to merge 1 commit into
tomlm:mainfrom
jchristn:fix/selection-bounds
Open

Clamp selection text bounds#9
jchristn wants to merge 1 commit into
tomlm:mainfrom
jchristn:fix/selection-bounds

Conversation

@jchristn
Copy link
Copy Markdown

@jchristn jchristn commented Jun 1, 2026

Summary

This prevents SelectionManager.GetSelectionText() from passing out-of-range columns into BufferLine.TranslateToString().

Selection coordinates can come from pointer positions outside the terminal cell grid, for example dragging slightly left of the terminal before copying. A negative start column can currently produce an IndexOutOfRangeException while translating the selected line.

The fix clamps start and end columns to the valid terminal column range before translating each selected line.

Validation

  • dotnet test src\XTerm.NET.slnx
    • 586 passed, 0 failed

@jchristn jchristn marked this pull request as ready for review June 1, 2026 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant