2024-04-12 18:19:32 +08:00
|
|
|
#RUN: %fish %s
|
2024-03-10 16:40:44 +08:00
|
|
|
#REQUIRES: command -v tmux
|
2024-12-31 20:03:14 +08:00
|
|
|
# Somehow $LINES is borked on NetBSD?
|
|
|
|
#REQUIRES: test $(uname) != NetBSD
|
2025-01-15 03:29:48 +08:00
|
|
|
# Haunted under CI
|
|
|
|
#REQUIRES: test -z "$CI"
|
2024-03-10 16:40:44 +08:00
|
|
|
|
Fix regression causing crash in "commandline -j"
Commit 3fcc6482cb (Fix parse_util_process_extent including too much
on the left, 2024-12-24) changed the process extent based on the
observation that "A\n\n\nB" comprises three tokens with ranges 0..1,
1..2 and 4..5. Prior to that commit, the second process extent was
2..5, which seems a bit weird because it includes newlines.
Weirdness aside, the real reason for changing it was this snippet in
the autosuggestion performer, where we compute the process extent
around cursor, and check if the line at process start matches the
cached search string.
// Search history for a matching item unless this line is not a continuation line or quoted.
if range_of_line_at_cursor(
&command_line,
parse_util_process_extent(&command_line, cursor_pos, None).start,
) == search_string_range
Given "A\n\n\nB" and cursor_pos=1 commit 3fcc6482cb changed the output
from 2..5 to 4..5. This brings problems:
1. leading spaces will not be included (which is probably
inconsequential but still ugly).
2. the specified cursor position is not included in the given range.
We could paper over 2 by computing min(cursor_pos)
but that would leave 1.
For now let's revert and solve the autosuggestion issue in a less
brittle way.
2025-01-12 21:12:26 +08:00
|
|
|
set -g isolated_tmux_fish_extra_args -C '
|
|
|
|
bind ctrl-q "functions --erase fish_right_prompt" "commandline \'\'" clear-screen
|
|
|
|
set -g fish_autosuggestion_enabled 0
|
|
|
|
bind ctrl-g "__fish_echo commandline --current-job"
|
|
|
|
'
|
2024-03-10 16:40:44 +08:00
|
|
|
isolated-tmux-start
|
|
|
|
|
2025-01-07 23:41:37 +08:00
|
|
|
isolated-tmux send-keys 'echo LINES $LINES' Enter
|
|
|
|
tmux-sleep
|
|
|
|
isolated-tmux capture-pane -p
|
|
|
|
# CHECK: prompt 0> echo LINES $LINES
|
|
|
|
# CHECK: LINES 10
|
|
|
|
# CHECK: prompt 1>
|
|
|
|
|
2024-03-30 23:10:12 +08:00
|
|
|
isolated-tmux send-keys 'bind alt-g "commandline -p -C -- -4"' Enter C-l
|
2024-03-10 16:40:44 +08:00
|
|
|
isolated-tmux send-keys 'echo bar|cat' \eg foo
|
|
|
|
tmux-sleep
|
|
|
|
isolated-tmux capture-pane -p
|
2025-01-07 23:41:37 +08:00
|
|
|
# CHECK: prompt 2> echo foobar|cat
|
2024-10-25 14:20:20 +08:00
|
|
|
|
2025-01-04 07:35:28 +08:00
|
|
|
isolated-tmux send-keys C-k C-u C-l 'commandline -i "\'$(seq $LINES)" scroll_here' Enter
|
2024-10-25 14:20:20 +08:00
|
|
|
tmux-sleep
|
|
|
|
isolated-tmux capture-pane -p
|
|
|
|
# CHECK: 2
|
|
|
|
# CHECK: 3
|
|
|
|
# CHECK: 4
|
|
|
|
# CHECK: 5
|
|
|
|
# CHECK: 6
|
|
|
|
# CHECK: 7
|
|
|
|
# CHECK: 8
|
|
|
|
# CHECK: 9
|
|
|
|
# CHECK: 10
|
|
|
|
# CHECK: scroll_here
|
2025-01-04 07:35:28 +08:00
|
|
|
|
|
|
|
# Soft-wrapped commandline with omitted right prompt.
|
Fix regression causing crash in "commandline -j"
Commit 3fcc6482cb (Fix parse_util_process_extent including too much
on the left, 2024-12-24) changed the process extent based on the
observation that "A\n\n\nB" comprises three tokens with ranges 0..1,
1..2 and 4..5. Prior to that commit, the second process extent was
2..5, which seems a bit weird because it includes newlines.
Weirdness aside, the real reason for changing it was this snippet in
the autosuggestion performer, where we compute the process extent
around cursor, and check if the line at process start matches the
cached search string.
// Search history for a matching item unless this line is not a continuation line or quoted.
if range_of_line_at_cursor(
&command_line,
parse_util_process_extent(&command_line, cursor_pos, None).start,
) == search_string_range
Given "A\n\n\nB" and cursor_pos=1 commit 3fcc6482cb changed the output
from 2..5 to 4..5. This brings problems:
1. leading spaces will not be included (which is probably
inconsequential but still ugly).
2. the specified cursor position is not included in the given range.
We could paper over 2 by computing min(cursor_pos)
but that would leave 1.
For now let's revert and solve the autosuggestion issue in a less
brittle way.
2025-01-12 21:12:26 +08:00
|
|
|
isolated-tmux send-keys C-q '
|
2025-01-04 07:35:28 +08:00
|
|
|
function fish_right_prompt
|
|
|
|
echo right-prompt
|
|
|
|
end
|
|
|
|
commandline -i "echo $(printf %0"$COLUMNS"d)"
|
|
|
|
' Enter
|
|
|
|
tmux-sleep
|
|
|
|
isolated-tmux capture-pane -p | sed 1,5d
|
2025-01-09 04:50:40 +08:00
|
|
|
# CHECK: prompt {{\d+}}> echo 00000000000000000000000000000000000000000000000000000000000000000
|
2025-01-04 07:35:28 +08:00
|
|
|
# CHECK: 000000000000000
|
|
|
|
# CHECK: 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
2025-01-09 04:50:40 +08:00
|
|
|
# CHECK: prompt {{\d+}}> right-prompt
|
Fix regression causing crash in "commandline -j"
Commit 3fcc6482cb (Fix parse_util_process_extent including too much
on the left, 2024-12-24) changed the process extent based on the
observation that "A\n\n\nB" comprises three tokens with ranges 0..1,
1..2 and 4..5. Prior to that commit, the second process extent was
2..5, which seems a bit weird because it includes newlines.
Weirdness aside, the real reason for changing it was this snippet in
the autosuggestion performer, where we compute the process extent
around cursor, and check if the line at process start matches the
cached search string.
// Search history for a matching item unless this line is not a continuation line or quoted.
if range_of_line_at_cursor(
&command_line,
parse_util_process_extent(&command_line, cursor_pos, None).start,
) == search_string_range
Given "A\n\n\nB" and cursor_pos=1 commit 3fcc6482cb changed the output
from 2..5 to 4..5. This brings problems:
1. leading spaces will not be included (which is probably
inconsequential but still ugly).
2. the specified cursor position is not included in the given range.
We could paper over 2 by computing min(cursor_pos)
but that would leave 1.
For now let's revert and solve the autosuggestion issue in a less
brittle way.
2025-01-12 21:12:26 +08:00
|
|
|
|
|
|
|
isolated-tmux send-keys C-q 'echo | echo\;' M-Enter 'another job' C-b C-b C-g
|
|
|
|
tmux-sleep
|
|
|
|
isolated-tmux capture-pane -p
|
|
|
|
# CHECK: prompt {{\d+}}> echo | echo;
|
|
|
|
# CHECK: another job
|
|
|
|
# CHECK: another job
|
|
|
|
# CHECK: prompt {{\d+}}> echo | echo;
|
|
|
|
# CHECK: another job
|