From 6525e3d11a27ce3c472a8bd4d7ccf92d645f8d2b Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Fri, 1 Nov 2024 19:01:50 +0100 Subject: [PATCH] edit_command_buffer: silence error when editor reports out-of-bounds line number This happens when using alt-e to edit the command buffer, adding some lines, leaving the cursor at the end and quitting the editor without saving. Let's avoid the noisy error that has sort of bad rendering (would need __fish_echo). --- share/functions/edit_command_buffer.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/functions/edit_command_buffer.fish b/share/functions/edit_command_buffer.fish index 31bfd9429..935ffee53 100644 --- a/share/functions/edit_command_buffer.fish +++ b/share/functions/edit_command_buffer.fish @@ -108,7 +108,7 @@ function edit_command_buffer --description 'Edit the command buffer in an extern eval set -l pos "$(cat $cursor_from_editor)" if set -q pos[1] && test $pos[1] = $f set -l line $pos[2] - set -l indent (math (string length -- $raw_lines[$line]) - (string length -- $unindented_lines[$line])) + set -l indent (math (string length -- "$raw_lines[$line]") - (string length -- "$unindented_lines[$line]")) set -l column (math $pos[3] - $indent) commandline -C 0 for _line in (seq $line)[2..]