File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,18 @@ impl State {
137137 ..
138138 } ) => self . delete_next_char ( ) ,
139139
140+ Event :: Key ( KeyEvent {
141+ code : KeyCode :: Home ,
142+ modifiers : KeyModifiers :: NONE ,
143+ ..
144+ } ) => self . move_to_line_start ( ) ,
145+
146+ Event :: Key ( KeyEvent {
147+ code : KeyCode :: End ,
148+ modifiers : KeyModifiers :: NONE ,
149+ ..
150+ } ) => self . move_to_line_end ( ) ,
151+
140152 Event :: Key ( KeyEvent {
141153 code : KeyCode :: Enter ,
142154 modifiers : KeyModifiers :: NONE ,
@@ -270,7 +282,11 @@ impl State {
270282 ( line_index + 1 ) ,
271283 width = left_margin_width as usize
272284 ) ,
273- Style :: new( ) . dark_gray( ) ,
285+ if self . cursor. y as usize == line_index {
286+ Style :: new( ) . white( )
287+ } else {
288+ Style :: new( ) . dark_gray( )
289+ } ,
274290 ) ,
275291 Span :: raw( " " ) ,
276292 Span :: raw( content) ,
@@ -382,6 +398,14 @@ impl State {
382398 }
383399 }
384400
401+ fn move_to_line_start ( & mut self ) {
402+ self . cursor . x = 0 ;
403+ }
404+
405+ fn move_to_line_end ( & mut self ) {
406+ self . cursor . x = self . get_current_line ( ) . len ( ) as u16 ;
407+ }
408+
385409 fn lines_per_page ( & self ) -> u16 {
386410 // TODO
387411 return 10 ;
You can’t perform that action at this time.
0 commit comments