From 66b59314388aafc822d812d1047b3fbb1aeda1c5 Mon Sep 17 00:00:00 2001 From: Steven Xu Date: Wed, 26 Apr 2023 09:08:11 +1000 Subject: [PATCH] fix: set the initial repl cursor pos, fixes #8943 (#8955) # Description Set the initial repl cursor pos, so running `commandline --insert` inserts at the current cursor position of the input buffer. Co-authored-by: sholderbach --- crates/nu-cli/src/repl.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/nu-cli/src/repl.rs b/crates/nu-cli/src/repl.rs index a1dbb9b63..563a9da86 100644 --- a/crates/nu-cli/src/repl.rs +++ b/crates/nu-cli/src/repl.rs @@ -477,6 +477,12 @@ pub fn evaluate_repl( } } + let mut repl_cursor = engine_state + .repl_cursor_pos + .lock() + .expect("repl cursor pos mutex"); + *repl_cursor = line_editor.current_insertion_point(); + drop(repl_cursor); let mut repl_buffer = engine_state .repl_buffer_state .lock()