File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -265,6 +265,34 @@ impl UserInput {
265265
266266 frame. render_widget ( Clear , block) ;
267267 frame. render_widget ( table, block) ;
268+
269+ match self . focus_input {
270+ FocusedInput :: Name => {
271+ let content_width = self . name . field . visual_cursor ( ) as u16 ;
272+ let cursor_x = block. x + 2 + content_width;
273+ let cursor_y = block. y + 4 ;
274+ frame. set_cursor_position ( ( cursor_x, cursor_y) ) ;
275+ }
276+ FocusedInput :: Ip => {
277+ let content_width = self . ip . field . visual_cursor ( ) as u16 ;
278+ let mut cursor_x = block. x + block. width / 4 + 1 + content_width;
279+ if !block. width . is_multiple_of ( 2 ) {
280+ cursor_x += 1 ;
281+ }
282+ let cursor_y = block. y + 4 ;
283+ frame. set_cursor_position ( ( cursor_x, cursor_y) ) ;
284+ }
285+ FocusedInput :: Port => {
286+ let content_width = self . port . field . visual_cursor ( ) as u16 ;
287+ let mut cursor_x = block. x + block. width / 2 + 1 + content_width;
288+ if !block. width . is_multiple_of ( 2 ) {
289+ cursor_x += 1 ;
290+ }
291+ let cursor_y = block. y + 4 ;
292+ frame. set_cursor_position ( ( cursor_x, cursor_y) ) ;
293+ }
294+ _ => { }
295+ } ;
268296 }
269297}
270298
Original file line number Diff line number Diff line change @@ -476,6 +476,16 @@ impl Metrics {
476476 vertical : 0 ,
477477 } ) ,
478478 ) ;
479+
480+ let content_width = self . user_input . input . visual_cursor ( ) as u16 ;
481+ let mut cursor_x = form_block. x + block. width / 2 + 1 + content_width;
482+ if !block. width . is_multiple_of ( 2 ) {
483+ cursor_x += 1 ;
484+ }
485+
486+ let cursor_y = form_block. y + 2 ;
487+ frame. set_cursor_position ( ( cursor_x, cursor_y) ) ;
488+
479489 frame. render_widget (
480490 help_message,
481491 message_block. inner ( Margin {
You can’t perform that action at this time.
0 commit comments