@@ -717,20 +717,19 @@ export class SelectionManager {
717717 // Key insight: we need to EXTEND the selection, not reset it to viewport edge
718718 if ( this . selectionEnd ) {
719719 const dims = this . wasmTerm . getDimensions ( ) ;
720- const viewportY = this . getViewportY ( ) ;
721720 if ( this . autoScrollDirection < 0 ) {
722721 // Scrolling up - extend selection upward (decrease absoluteRow)
723722 // Set to top of viewport, but only if it extends the selection
724- const topOfViewport = viewportY ;
725- if ( topOfViewport < this . selectionEnd . absoluteRow ) {
726- this . selectionEnd = { col : 0 , absoluteRow : topOfViewport } ;
723+ const topAbsoluteRow = this . viewportRowToAbsolute ( 0 ) ;
724+ if ( topAbsoluteRow < this . selectionEnd . absoluteRow ) {
725+ this . selectionEnd = { col : 0 , absoluteRow : topAbsoluteRow } ;
727726 }
728727 } else {
729728 // Scrolling down - extend selection downward (increase absoluteRow)
730729 // Set to bottom of viewport, but only if it extends the selection
731- const bottomOfViewport = viewportY + dims . rows - 1 ;
732- if ( bottomOfViewport > this . selectionEnd . absoluteRow ) {
733- this . selectionEnd = { col : dims . cols - 1 , absoluteRow : bottomOfViewport } ;
730+ const bottomAbsoluteRow = this . viewportRowToAbsolute ( dims . rows - 1 ) ;
731+ if ( bottomAbsoluteRow > this . selectionEnd . absoluteRow ) {
732+ this . selectionEnd = { col : dims . cols - 1 , absoluteRow : bottomAbsoluteRow } ;
734733 }
735734 }
736735 }
0 commit comments