Commit fb76b25 1 parent 1c49621 commit fb76b25 Copy full SHA for fb76b25
File tree 1 file changed +15
-1
lines changed
crates/turborepo-vt100/src
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -198,7 +198,21 @@ impl Grid {
198
198
}
199
199
200
200
pub fn visible_row ( & self , row : u16 ) -> Option < & crate :: row:: Row > {
201
- self . visible_rows ( ) . nth ( usize:: from ( row) )
201
+ // The number of rows that are in scrollback before the current screen
202
+ let scrollback_rows_before_screen =
203
+ self . scrollback . len ( ) . saturating_sub ( self . scrollback_offset ) ;
204
+ // The index for row if it is in the scrollback
205
+ let scrollback_idx = scrollback_rows_before_screen + usize:: from ( row) ;
206
+ // If this is a valid scrollback index, then return that row
207
+ if scrollback_idx < self . scrollback . len ( ) {
208
+ self . scrollback . get ( scrollback_idx)
209
+ } else {
210
+ // Need to subtract scrollback offset
211
+ // e.g. if we are showing 1 row of scrollback, and user requests 3rd visible row
212
+ // we should return the second row in self.rows
213
+ self . rows
214
+ . get ( usize:: from ( row) . saturating_sub ( self . scrollback_offset ) )
215
+ }
202
216
}
203
217
204
218
pub fn drawing_row ( & self , row : u16 ) -> Option < & crate :: row:: Row > {
You can’t perform that action at this time.
0 commit comments