File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -361,10 +361,15 @@ class _TerminalViewState extends State<TerminalView> {
361
361
final col = ((px - widget.padding) / _cellSize.cellWidth).floor ();
362
362
final row = ((py - widget.padding) / _cellSize.cellHeight).floor ();
363
363
364
- final x = col;
365
- final y = widget.terminal.convertViewLineToRawLine (row) -
364
+ var x = col;
365
+ var y = widget.terminal.convertViewLineToRawLine (row) -
366
366
widget.terminal.scrollOffsetFromBottom;
367
367
368
+ // The mouse position could be outside the terminal area,
369
+ // in this case it is clamped back into the terminal area.
370
+ x = math.min (math.max (x, 0 ), widget.terminal.terminalWidth - 1 );
371
+ y = math.min (math.max (y, 0 ), widget.terminal.terminalHeight - 1 );
372
+
368
373
return Position (x, y);
369
374
}
370
375
You can’t perform that action at this time.
0 commit comments