mirror of
https://github.com/tmux/tmux.git
synced 2025-03-28 09:38:50 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
8ef899f315
13
cmd-queue.c
13
cmd-queue.c
@ -664,9 +664,18 @@ cmdq_fire_command(struct cmdq_item *item)
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
item->client = saved;
|
item->client = saved;
|
||||||
if (retval == CMD_RETURN_ERROR)
|
if (retval == CMD_RETURN_ERROR) {
|
||||||
|
fsp = NULL;
|
||||||
|
if (cmd_find_valid_state(&item->target))
|
||||||
|
fsp = &item->target;
|
||||||
|
else if (cmd_find_valid_state(&item->state->current))
|
||||||
|
fsp = &item->state->current;
|
||||||
|
else if (cmd_find_from_client(&fs, item->client, 0) == 0)
|
||||||
|
fsp = &fs;
|
||||||
|
cmdq_insert_hook(fsp != NULL ? fsp->s : NULL, item, fsp,
|
||||||
|
"command-error");
|
||||||
cmdq_guard(item, "error", flags);
|
cmdq_guard(item, "error", flags);
|
||||||
else
|
} else
|
||||||
cmdq_guard(item, "end", flags);
|
cmdq_guard(item, "end", flags);
|
||||||
return (retval);
|
return (retval);
|
||||||
}
|
}
|
||||||
|
@ -383,14 +383,6 @@ const struct options_table_entry options_table[] = {
|
|||||||
.text = "Maximum number of commands to keep in history."
|
.text = "Maximum number of commands to keep in history."
|
||||||
},
|
},
|
||||||
|
|
||||||
{ .name = "search-wrapped-lines",
|
|
||||||
.type = OPTIONS_TABLE_FLAG,
|
|
||||||
.scope = OPTIONS_TABLE_SERVER,
|
|
||||||
.default_num = 1,
|
|
||||||
.text = "Whether to include full wrapped lines when searching for "
|
|
||||||
"text in copy mode."
|
|
||||||
},
|
|
||||||
|
|
||||||
{ .name = "set-clipboard",
|
{ .name = "set-clipboard",
|
||||||
.type = OPTIONS_TABLE_CHOICE,
|
.type = OPTIONS_TABLE_CHOICE,
|
||||||
.scope = OPTIONS_TABLE_SERVER,
|
.scope = OPTIONS_TABLE_SERVER,
|
||||||
@ -1333,6 +1325,7 @@ const struct options_table_entry options_table[] = {
|
|||||||
OPTIONS_TABLE_HOOK("client-focus-out", ""),
|
OPTIONS_TABLE_HOOK("client-focus-out", ""),
|
||||||
OPTIONS_TABLE_HOOK("client-resized", ""),
|
OPTIONS_TABLE_HOOK("client-resized", ""),
|
||||||
OPTIONS_TABLE_HOOK("client-session-changed", ""),
|
OPTIONS_TABLE_HOOK("client-session-changed", ""),
|
||||||
|
OPTIONS_TABLE_HOOK("command-error", ""),
|
||||||
OPTIONS_TABLE_PANE_HOOK("pane-died", ""),
|
OPTIONS_TABLE_PANE_HOOK("pane-died", ""),
|
||||||
OPTIONS_TABLE_PANE_HOOK("pane-exited", ""),
|
OPTIONS_TABLE_PANE_HOOK("pane-exited", ""),
|
||||||
OPTIONS_TABLE_PANE_HOOK("pane-focus-in", ""),
|
OPTIONS_TABLE_PANE_HOOK("pane-focus-in", ""),
|
||||||
|
18
tmux.1
18
tmux.1
@ -3797,14 +3797,6 @@ each client.
|
|||||||
.It Ic prompt-history-limit Ar number
|
.It Ic prompt-history-limit Ar number
|
||||||
Set the number of history items to save in the history file for each type of
|
Set the number of history items to save in the history file for each type of
|
||||||
command prompt.
|
command prompt.
|
||||||
.It Xo Ic search-wrapped-lines
|
|
||||||
.Op Ic on | off
|
|
||||||
.Xc
|
|
||||||
Defines how
|
|
||||||
.Nm
|
|
||||||
handles wrapped lines when searching in copy mode.
|
|
||||||
When disabled, lines are truncated and searching is faster, but matches may be
|
|
||||||
missed.
|
|
||||||
.It Xo Ic set-clipboard
|
.It Xo Ic set-clipboard
|
||||||
.Op Ic on | external | off
|
.Op Ic on | external | off
|
||||||
.Xc
|
.Xc
|
||||||
@ -4891,6 +4883,14 @@ layout after every
|
|||||||
set-hook -g after-split-window "selectl even-vertical"
|
set-hook -g after-split-window "selectl even-vertical"
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
|
If a command fails, the
|
||||||
|
.Ql command-error
|
||||||
|
hook will be fired.
|
||||||
|
For example, this could be used to write to a log file:
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
set-hook -g command-error "run-shell \\"echo 'a tmux command failed' >>/tmp/log\\""
|
||||||
|
.Ed
|
||||||
|
.Pp
|
||||||
All the notifications listed in the
|
All the notifications listed in the
|
||||||
.Sx CONTROL MODE
|
.Sx CONTROL MODE
|
||||||
section are hooks (without any arguments), except
|
section are hooks (without any arguments), except
|
||||||
@ -4923,6 +4923,8 @@ Run when focus exits a client
|
|||||||
Run when a client is resized.
|
Run when a client is resized.
|
||||||
.It client-session-changed
|
.It client-session-changed
|
||||||
Run when a client's attached session is changed.
|
Run when a client's attached session is changed.
|
||||||
|
.It command-error
|
||||||
|
Run when a command fails.
|
||||||
.It pane-died
|
.It pane-died
|
||||||
Run when the program running in a pane exits, but
|
Run when the program running in a pane exits, but
|
||||||
.Ic remain-on-exit
|
.Ic remain-on-exit
|
||||||
|
@ -3614,13 +3614,10 @@ window_copy_search_jump(struct window_mode_entry *wme, struct grid *gd,
|
|||||||
struct grid *sgd, u_int fx, u_int fy, u_int endline, int cis, int wrap,
|
struct grid *sgd, u_int fx, u_int fy, u_int endline, int cis, int wrap,
|
||||||
int direction, int regex)
|
int direction, int regex)
|
||||||
{
|
{
|
||||||
u_int i, px, sx, ssize = 1;
|
u_int i, px, sx, ssize = 1;
|
||||||
int wrapped, found = 0, cflags = REG_EXTENDED;
|
int found = 0, cflags = REG_EXTENDED;
|
||||||
char *sbuf;
|
char *sbuf;
|
||||||
regex_t reg;
|
regex_t reg;
|
||||||
struct grid_line *gl;
|
|
||||||
|
|
||||||
wrapped = options_get_number(global_options, "search-wrapped-lines");
|
|
||||||
|
|
||||||
if (regex) {
|
if (regex) {
|
||||||
sbuf = xmalloc(ssize);
|
sbuf = xmalloc(ssize);
|
||||||
@ -3637,11 +3634,6 @@ window_copy_search_jump(struct window_mode_entry *wme, struct grid *gd,
|
|||||||
|
|
||||||
if (direction) {
|
if (direction) {
|
||||||
for (i = fy; i <= endline; i++) {
|
for (i = fy; i <= endline; i++) {
|
||||||
gl = grid_get_line(gd, i);
|
|
||||||
if (!wrapped &&
|
|
||||||
i != endline &&
|
|
||||||
gl->flags & GRID_LINE_WRAPPED)
|
|
||||||
continue;
|
|
||||||
if (regex) {
|
if (regex) {
|
||||||
found = window_copy_search_lr_regex(gd,
|
found = window_copy_search_lr_regex(gd,
|
||||||
&px, &sx, i, fx, gd->sx, ®);
|
&px, &sx, i, fx, gd->sx, ®);
|
||||||
@ -3655,11 +3647,6 @@ window_copy_search_jump(struct window_mode_entry *wme, struct grid *gd,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = fy + 1; endline < i; i--) {
|
for (i = fy + 1; endline < i; i--) {
|
||||||
gl = grid_get_line(gd, i - 1);
|
|
||||||
if (!wrapped &&
|
|
||||||
i != endline &&
|
|
||||||
gl->flags & GRID_LINE_WRAPPED)
|
|
||||||
continue;
|
|
||||||
if (regex) {
|
if (regex) {
|
||||||
found = window_copy_search_rl_regex(gd,
|
found = window_copy_search_rl_regex(gd,
|
||||||
&px, &sx, i - 1, 0, fx + 1, ®);
|
&px, &sx, i - 1, 0, fx + 1, ®);
|
||||||
|
Loading…
Reference in New Issue
Block a user