Act on previous cmd output when cursor on prompt at end of copy-buffer.

This commit is contained in:
Michael Grant
2026-09-07 05:21:25 +01:00
parent 4cc9fc91fa
commit cda0fe9f7b
2 changed files with 13 additions and 1 deletions

View File

@@ -99,6 +99,13 @@ sleep 1
$TMUX copy-output -t :empty || exit 1
[ "$($TMUX show-buffer)" = one ] || exit 1
$TMUX new-window -d -n prompt "printf '\\033]133;A\\007p\\$ \\033]133;B\\007echo\\033]133;C\\007one\\n\\033]133;D;0\\007\\033]133;A\\007p\\$ \\033]133;B\\007'; exec sleep 100" || exit 1
sleep 1
$TMUX copy-mode -U -t :prompt || exit 1
$TMUX send-keys -t :prompt.0 -X copy-output || exit 1
[ "$($TMUX show-buffer)" = one ] || exit 1
$TMUX send-keys -t :prompt.0 -X cancel || exit 1
$TMUX copy-mode -t :plain || exit 1
$TMUX send-keys -t :plain.0 -X copy-output -a || exit 1
all=$($TMUX show-buffer)

View File

@@ -4182,8 +4182,13 @@ window_copy_find_output_range(struct window_mode_entry *wme, u_int *sx,
break;
}
}
if (!found_start)
if (!found_start) {
/* At the live prompt, use the most recent command output. */
if (cursor_y == screen_hsize(data->source) + data->source->cy)
return (window_copy_find_previous_output_range(data->source,
sx, sy, ex, ey));
return (0);
}
if (!found_end) {
if (y != total)
return (0);