mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-08 19:11:12 -03:00
Add hack to fix off-by-one error in Vi-mode cancel-commandline
The new cursor-end-mode "inclusive" (which is active in Vi mode) is causing
many issues.
One of them is because cancel-commandline wants to move to the end of the
command line before printing "^C". Since "inclusive" cursor mode prevents
the cursor from moving past the last character, that one will be overwritten
with a "^". Hack around this.
Closes #11261
(cherry picked from commit b08ff33291)
This commit is contained in:
@@ -2347,7 +2347,12 @@ fn handle_readline_command(&mut self, c: ReadlineCmd) {
|
||||
if c == rl::CancelCommandline {
|
||||
// Move cursor to the end of the line.
|
||||
let end = self.command_line.len();
|
||||
self.update_buff_pos(EditableLineTag::Commandline, Some(end));
|
||||
{
|
||||
let tmp =
|
||||
std::mem::replace(&mut self.cursor_end_mode, CursorEndMode::Exclusive);
|
||||
self.update_buff_pos(EditableLineTag::Commandline, Some(end));
|
||||
self.cursor_end_mode = tmp;
|
||||
}
|
||||
|
||||
self.autosuggestion.clear();
|
||||
// Repaint also changes the actual cursor position
|
||||
|
||||
Reference in New Issue
Block a user