cursor changes
This commit is contained in:
@@ -54,6 +54,13 @@ impl EventHandler {
|
|||||||
self.edit_mode_cooldown = true;
|
self.edit_mode_cooldown = true;
|
||||||
self.command_message = "Read-only mode".to_string();
|
self.command_message = "Read-only mode".to_string();
|
||||||
app_terminal.set_cursor_style(SetCursorStyle::SteadyBlock)?;
|
app_terminal.set_cursor_style(SetCursorStyle::SteadyBlock)?;
|
||||||
|
|
||||||
|
let current_input = form_state.get_current_input();
|
||||||
|
if !current_input.is_empty() && form_state.current_cursor_pos >= current_input.len() {
|
||||||
|
form_state.current_cursor_pos = current_input.len() - 1;
|
||||||
|
self.ideal_cursor_column = form_state.current_cursor_pos;
|
||||||
|
}
|
||||||
|
|
||||||
return Ok((false, self.command_message.clone()));
|
return Ok((false, self.command_message.clone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,9 +362,17 @@ impl EventHandler {
|
|||||||
self.is_edit_mode = false;
|
self.is_edit_mode = false;
|
||||||
self.edit_mode_cooldown = true;
|
self.edit_mode_cooldown = true;
|
||||||
self.command_message = "Read-only mode".to_string();
|
self.command_message = "Read-only mode".to_string();
|
||||||
|
|
||||||
|
// ADD THIS CODE RIGHT HERE:
|
||||||
|
let current_input = form_state.get_current_input();
|
||||||
|
if !current_input.is_empty() && form_state.current_cursor_pos >= current_input.len() {
|
||||||
|
form_state.current_cursor_pos = current_input.len() - 1;
|
||||||
|
self.ideal_cursor_column = form_state.current_cursor_pos;
|
||||||
|
}
|
||||||
|
|
||||||
return Ok((false, self.command_message.clone()));
|
return Ok((false, self.command_message.clone()));
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
KeyCode::Down => {
|
KeyCode::Down => {
|
||||||
form_state.current_field = (form_state.current_field + 1) % form_state.fields.len();
|
form_state.current_field = (form_state.current_field + 1) % form_state.fields.len();
|
||||||
let current_input = form_state.get_current_input();
|
let current_input = form_state.get_current_input();
|
||||||
|
|||||||
Reference in New Issue
Block a user