Commit 716e732469

716e732469ab66ca2e4c615d021cb3a83cc37a5b

parent: c347aad699

Unsigned

Vaibhav Mattoo <vaibhavmattoo1@gmail.com> · 2025-08-16 07:30 UTC

fix: solved thread 'main' panic due to incorrect cursor position after scrolling up and down through command history

Layout: unified · split

src/global/functions/command_capture.rs +4
@@ -137,6 +137,10 @@ pub fn command_capture(framework: &mut FrameworkClean, key: KeyEvent) -> bool {
137137 let text_field = status.command_capture.as_mut().unwrap();
138138 status.command_history_index = None;
139139 text_field.content = status.command_editing_cache.clone();
140 text_field.cursor = text_field.cursor.min(text_field.content.len());
141 if !text_field.content.is_empty() {
142 let _ = text_field.last();
143 }
140144 } else {
141145 let new_index = status.command_history_index.unwrap_or(history.0.len()) + 1;
142146 let new_content = history.0[new_index].clone();
src/run.rs +5
@@ -174,6 +174,11 @@ pub fn run(
174174 status.command_history_index = None;
175175 text_field.content =
176176 status.command_editing_cache.clone();
177 text_field.cursor =
178 text_field.cursor.min(text_field.content.len());
179 if !text_field.content.is_empty() {
180 let _ = text_field.last();
181 }
177182 } else {
178183 let new_index = status
179184 .command_history_index