mirror of
https://github.com/tmux/tmux.git
synced 2026-10-11 21:14:21 +00:00
For the *-output commands like select-output, if cmd had no output like "true" then select an empty string.
This commit is contained in:
@@ -95,9 +95,27 @@ sleep 1
|
|||||||
$TMUX copy-mode -t :empty || exit 1
|
$TMUX copy-mode -t :empty || exit 1
|
||||||
$TMUX set-buffer sentinel || exit 1
|
$TMUX set-buffer sentinel || exit 1
|
||||||
$TMUX send-keys -t :empty.0 -X copy-output || exit 1
|
$TMUX send-keys -t :empty.0 -X copy-output || exit 1
|
||||||
[ "$($TMUX show-buffer)" = one ] || exit 1
|
[ "$($TMUX show-buffer)" = sentinel ] || exit 1
|
||||||
|
$TMUX send-keys -t :empty.0 -X select-output || exit 1
|
||||||
|
[ "$($TMUX display-message -p -t :empty.0 '#{selection_present}')" = 0 ] || exit 1
|
||||||
$TMUX send-keys -t :empty.0 -X cancel || exit 1
|
$TMUX send-keys -t :empty.0 -X cancel || exit 1
|
||||||
|
|
||||||
|
$TMUX new-window -d -n emptyprompt "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\\007true\\n\\033]133;C\\007\\033]133;D;0\\007\\033]133;A\\007p\\$ \\033]133;B\\007'; exec sleep 100" || exit 1
|
||||||
|
sleep 1
|
||||||
|
$TMUX copy-mode -t :emptyprompt || exit 1
|
||||||
|
$TMUX set-buffer sentinel || exit 1
|
||||||
|
$TMUX send-keys -t :emptyprompt.0 -X copy-output || exit 1
|
||||||
|
[ "$($TMUX show-buffer)" = sentinel ] || exit 1
|
||||||
|
$TMUX send-keys -t :emptyprompt.0 -X cancel || exit 1
|
||||||
|
|
||||||
|
$TMUX new-window -d -n blank "printf '\\033]133;A\\007p\\$ \\033]133;B\\007echo\\n\\033]133;C\\007\\n\\033]133;D;0\\007\\033]133;A\\007p\\$ \\033]133;B\\007'; exec sleep 100" || exit 1
|
||||||
|
sleep 1
|
||||||
|
$TMUX copy-mode -t :blank || exit 1
|
||||||
|
$TMUX set-buffer sentinel || exit 1
|
||||||
|
$TMUX send-keys -t :blank.0 -X copy-output || exit 1
|
||||||
|
[ $($TMUX show-buffer | wc -c) -eq 1 ] || exit 1
|
||||||
|
$TMUX send-keys -t :blank.0 -X cancel || 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
|
$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
|
sleep 1
|
||||||
$TMUX copy-mode -t :prompt || exit 1
|
$TMUX copy-mode -t :prompt || exit 1
|
||||||
|
|||||||
5
tmux.1
5
tmux.1
@@ -2579,11 +2579,12 @@ If there is no
|
|||||||
.Ql D
|
.Ql D
|
||||||
marker, the output ends at the last used cell in the copy-mode buffer,
|
marker, the output ends at the last used cell in the copy-mode buffer,
|
||||||
omitting unused blank rows at the bottom.
|
omitting unused blank rows at the bottom.
|
||||||
At the following prompt or below it, they use the most recent nonempty output.
|
At the following prompt or below it, they use the most recent output.
|
||||||
With
|
With
|
||||||
.Fl a ,
|
.Fl a ,
|
||||||
they use the entire copy-mode buffer instead.
|
they use the entire copy-mode buffer instead.
|
||||||
If no output range can be found, no text is copied, piped or opened.
|
If no output range can be found, or the output is empty, no text is copied,
|
||||||
|
piped or opened.
|
||||||
.Pp
|
.Pp
|
||||||
The search commands come in several varieties:
|
The search commands come in several varieties:
|
||||||
.Ql search\-forward
|
.Ql search\-forward
|
||||||
|
|||||||
@@ -6333,8 +6333,6 @@ window_copy_find_output_range(struct window_mode_entry *wme, u_int *sx,
|
|||||||
int found_start = 0, found_end = 0;
|
int found_start = 0, found_end = 0;
|
||||||
int next_prompt, in_range, end_ok;
|
int next_prompt, in_range, end_ok;
|
||||||
int found;
|
int found;
|
||||||
void *buf;
|
|
||||||
size_t len;
|
|
||||||
|
|
||||||
cursor_x = data->cx;
|
cursor_x = data->cx;
|
||||||
cursor_y = screen_hsize(data->backing) + data->cy - data->oy;
|
cursor_y = screen_hsize(data->backing) + data->cy - data->oy;
|
||||||
@@ -6419,14 +6417,6 @@ window_copy_find_output_range(struct window_mode_entry *wme, u_int *sx,
|
|||||||
}
|
}
|
||||||
window_copy_output_end(data->backing, ex, ey);
|
window_copy_output_end(data->backing, ex, ey);
|
||||||
}
|
}
|
||||||
buf = window_copy_get_grid_range(wme, *sx, *sy, *ex, *ey, &len);
|
|
||||||
if (buf == NULL) {
|
|
||||||
log_debug("%s: empty output", __func__);
|
|
||||||
found = window_copy_find_previous_output_range(wme, cursor_x,
|
|
||||||
cursor_y, sx, sy, ex, ey);
|
|
||||||
return (found);
|
|
||||||
}
|
|
||||||
free(buf);
|
|
||||||
log_debug("%s: output from %u,%u to %u,%u", __func__, *sx, *sy,
|
log_debug("%s: output from %u,%u to %u,%u", __func__, *sx, *sy,
|
||||||
*ex, *ey);
|
*ex, *ey);
|
||||||
return (1);
|
return (1);
|
||||||
@@ -6442,10 +6432,8 @@ window_copy_find_previous_output_range(struct window_mode_entry *wme,
|
|||||||
struct grid *gd = data->backing->grid;
|
struct grid *gd = data->backing->grid;
|
||||||
struct grid_line *gl;
|
struct grid_line *gl;
|
||||||
struct osc133_data *od;
|
struct osc133_data *od;
|
||||||
void *buf;
|
u_int start_x, start_y;
|
||||||
u_int start_x, start_y, end_x, end_y;
|
|
||||||
u_int y, total;
|
u_int y, total;
|
||||||
size_t len;
|
|
||||||
int found = 0, have_prompt = 0;
|
int found = 0, have_prompt = 0;
|
||||||
int pending = 0;
|
int pending = 0;
|
||||||
int has_start, has_end, end_first;
|
int has_start, has_end, end_first;
|
||||||
@@ -6485,18 +6473,11 @@ window_copy_find_previous_output_range(struct window_mode_entry *wme,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pending && has_end) {
|
if (pending && has_end) {
|
||||||
end_x = od->out_end_col;
|
*sx = start_x;
|
||||||
end_y = y;
|
*sy = start_y;
|
||||||
buf = window_copy_get_grid_range(wme, start_x, start_y,
|
*ex = od->out_end_col;
|
||||||
end_x, end_y, &len);
|
*ey = y;
|
||||||
if (buf != NULL) {
|
found = 1;
|
||||||
free(buf);
|
|
||||||
*sx = start_x;
|
|
||||||
*sy = start_y;
|
|
||||||
*ex = end_x;
|
|
||||||
*ey = end_y;
|
|
||||||
found = 1;
|
|
||||||
}
|
|
||||||
pending = 0;
|
pending = 0;
|
||||||
}
|
}
|
||||||
if (has_start && end_first) {
|
if (has_start && end_first) {
|
||||||
|
|||||||
Reference in New Issue
Block a user