@@ -850,11 +850,11 @@ impl Grid {
850
850
851
851
let mut new_cursor_y = self . canonical_line_y_coordinates ( cursor_canonical_line_index)
852
852
+ ( cursor_index_in_canonical_line / new_columns) ;
853
- let mut saved_cursor_y_coordinates = self . saved_cursor_position . as_ref ( )
854
- . map ( |saved_cursor|
853
+ let mut saved_cursor_y_coordinates =
854
+ self . saved_cursor_position . as_ref ( ) . map ( |saved_cursor| {
855
855
self . canonical_line_y_coordinates ( saved_cursor. y )
856
856
+ saved_cursor_index_in_canonical_line. as_ref ( ) . unwrap ( ) / new_columns
857
- ) ;
857
+ } ) ;
858
858
859
859
// A cursor at EOL has two equivalent positions - end of this line or beginning of
860
860
// next. If not already at the beginning of line, bias to EOL so add character logic
@@ -864,8 +864,8 @@ impl Grid {
864
864
new_cursor_y -= 1 ;
865
865
new_cursor_x = new_columns
866
866
}
867
- let saved_cursor_x_coordinates = saved_cursor_index_in_canonical_line. as_ref ( )
868
- . map ( |saved_cursor_index_in_canonical_line| {
867
+ let saved_cursor_x_coordinates = saved_cursor_index_in_canonical_line. as_ref ( ) . map (
868
+ |saved_cursor_index_in_canonical_line| {
869
869
let x = self . saved_cursor_position . as_ref ( ) . unwrap ( ) . x ;
870
870
let mut new_x = * saved_cursor_index_in_canonical_line % new_columns;
871
871
let new_y = saved_cursor_y_coordinates. as_mut ( ) . unwrap ( ) ;
@@ -874,7 +874,8 @@ impl Grid {
874
874
new_x = new_columns
875
875
}
876
876
new_x
877
- } ) ;
877
+ } ,
878
+ ) ;
878
879
879
880
let current_viewport_row_count = self . viewport . len ( ) ;
880
881
match current_viewport_row_count. cmp ( & self . height ) {
@@ -926,20 +927,25 @@ impl Grid {
926
927
saved_cursor_position. x = saved_cursor_x_coordinates;
927
928
saved_cursor_position. y = saved_cursor_y_coordinates;
928
929
} ,
929
- _ => unreachable ! ( "saved cursor {:?} {:?}" ,
930
- saved_cursor_x_coordinates,
931
- saved_cursor_y_coordinates) ,
930
+ _ => unreachable ! (
931
+ "saved cursor {:?} {:?}" ,
932
+ saved_cursor_x_coordinates, saved_cursor_y_coordinates
933
+ ) ,
932
934
}
933
935
} ;
934
936
}
935
937
if new_rows != self . height {
936
938
let mut new_cursor_y = self . cursor . y ;
937
- let mut saved_cursor_y_coordinates =
938
- self . saved_cursor_position . as_ref ( ) . map ( |saved_cursor| saved_cursor. y ) ;
939
+ let mut saved_cursor_y_coordinates = self
940
+ . saved_cursor_position
941
+ . as_ref ( )
942
+ . map ( |saved_cursor| saved_cursor. y ) ;
939
943
940
944
let new_cursor_x = self . cursor . x ;
941
- let saved_cursor_x_coordinates =
942
- self . saved_cursor_position . as_ref ( ) . map ( |saved_cursor| saved_cursor. x ) ;
945
+ let saved_cursor_x_coordinates = self
946
+ . saved_cursor_position
947
+ . as_ref ( )
948
+ . map ( |saved_cursor| saved_cursor. x ) ;
943
949
944
950
let current_viewport_row_count = self . viewport . len ( ) ;
945
951
match current_viewport_row_count. cmp ( & new_rows) {
@@ -990,9 +996,10 @@ impl Grid {
990
996
saved_cursor_position. x = saved_cursor_x_coordinates;
991
997
saved_cursor_position. y = saved_cursor_y_coordinates;
992
998
} ,
993
- _ => unreachable ! ( "saved cursor {:?} {:?}" ,
994
- saved_cursor_x_coordinates,
995
- saved_cursor_y_coordinates) ,
999
+ _ => unreachable ! (
1000
+ "saved cursor {:?} {:?}" ,
1001
+ saved_cursor_x_coordinates, saved_cursor_y_coordinates
1002
+ ) ,
996
1003
}
997
1004
} ;
998
1005
}
0 commit comments