mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 08:56:43 +08:00
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).
This commit is contained in:
parent
3710e98d65
commit
6525e3d11a
|
@ -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..]
|
||||
|
|
Loading…
Reference in New Issue
Block a user