mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-14 05:12:48 +08:00
Fix regression causing builtin commandline to report wrong relative cursor
Regressed in 55fd43d86c
(Port reader, 2023-12-22).
Fixes #11085
This commit is contained in:
parent
4c28a7771e
commit
c651a79cb6
|
@ -643,7 +643,9 @@ pub fn commandline(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr])
|
||||||
);
|
);
|
||||||
commandline_set_buffer(None, Some(new_pos));
|
commandline_set_buffer(None, Some(new_pos));
|
||||||
} else {
|
} else {
|
||||||
streams.out.append(sprintf!("%lu\n", current_cursor_pos));
|
streams
|
||||||
|
.out
|
||||||
|
.append(sprintf!("%lu\n", current_cursor_pos - range.start));
|
||||||
}
|
}
|
||||||
return STATUS_CMD_OK;
|
return STATUS_CMD_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ set -g isolated_tmux_fish_extra_args -C '
|
||||||
bind ctrl-q "functions --erase fish_right_prompt" "commandline \'\'" clear-screen
|
bind ctrl-q "functions --erase fish_right_prompt" "commandline \'\'" clear-screen
|
||||||
set -g fish_autosuggestion_enabled 0
|
set -g fish_autosuggestion_enabled 0
|
||||||
bind ctrl-g "__fish_echo commandline --current-job"
|
bind ctrl-g "__fish_echo commandline --current-job"
|
||||||
|
bind ctrl-t \'__fish_echo echo cursor is at offset $(commandline --cursor --current-token) in token\'
|
||||||
'
|
'
|
||||||
isolated-tmux-start
|
isolated-tmux-start
|
||||||
|
|
||||||
|
@ -61,3 +62,10 @@ isolated-tmux capture-pane -p
|
||||||
# CHECK: another job
|
# CHECK: another job
|
||||||
# CHECK: prompt {{\d+}}> echo | echo;
|
# CHECK: prompt {{\d+}}> echo | echo;
|
||||||
# CHECK: another job
|
# CHECK: another job
|
||||||
|
|
||||||
|
isolated-tmux send-keys C-q 'echo foobar' Left Left Left C-t
|
||||||
|
tmux-sleep
|
||||||
|
# CHECK: prompt {{\d+}}> echo foobar
|
||||||
|
# CHECK: cursor is at offset 3 in token
|
||||||
|
# CHECK: prompt {{\d+}}> echo foobar
|
||||||
|
isolated-tmux capture-pane -p
|
||||||
|
|
Loading…
Reference in New Issue
Block a user