mirror of
https://github.com/tmux/tmux.git
synced 2025-01-05 23:38:48 +00:00
Add -r to find-window for regex instead of fnmatch.
This commit is contained in:
parent
97a317a656
commit
1d8e545bc1
@ -32,8 +32,8 @@ const struct cmd_entry cmd_find_window_entry = {
|
||||
.name = "find-window",
|
||||
.alias = "findw",
|
||||
|
||||
.args = { "CNt:TZ", 1, 1 },
|
||||
.usage = "[-CNTZ] " CMD_TARGET_PANE_USAGE " match-string",
|
||||
.args = { "CNrt:TZ", 1, 1 },
|
||||
.usage = "[-CNrTZ] " CMD_TARGET_PANE_USAGE " match-string",
|
||||
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
@ -57,30 +57,59 @@ cmd_find_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||
if (!C && !N && !T)
|
||||
C = N = T = 1;
|
||||
|
||||
if (C && N && T) {
|
||||
xasprintf(&filter,
|
||||
"#{||:"
|
||||
"#{C:%s},#{||:#{m:*%s*,#{window_name}},"
|
||||
"#{m:*%s*,#{pane_title}}}}",
|
||||
s, s, s);
|
||||
} else if (C && N) {
|
||||
xasprintf(&filter,
|
||||
"#{||:#{C:%s},#{m:*%s*,#{window_name}}}",
|
||||
s, s);
|
||||
} else if (C && T) {
|
||||
xasprintf(&filter,
|
||||
"#{||:#{C:%s},#{m:*%s*,#{pane_title}}}",
|
||||
s, s);
|
||||
} else if (N && T) {
|
||||
xasprintf(&filter,
|
||||
"#{||:#{m:*%s*,#{window_name}},#{m:*%s*,#{pane_title}}}",
|
||||
s, s);
|
||||
} else if (C)
|
||||
xasprintf(&filter, "#{C:%s}", s);
|
||||
else if (N)
|
||||
xasprintf(&filter, "#{m:*%s*,#{window_name}}", s);
|
||||
else
|
||||
xasprintf(&filter, "#{m:*%s*,#{pane_title}}", s);
|
||||
if (!args_has(args, 'r')) {
|
||||
if (C && N && T) {
|
||||
xasprintf(&filter,
|
||||
"#{||:"
|
||||
"#{C:%s},#{||:#{m:*%s*,#{window_name}},"
|
||||
"#{m:*%s*,#{pane_title}}}}",
|
||||
s, s, s);
|
||||
} else if (C && N) {
|
||||
xasprintf(&filter,
|
||||
"#{||:#{C:%s},#{m:*%s*,#{window_name}}}",
|
||||
s, s);
|
||||
} else if (C && T) {
|
||||
xasprintf(&filter,
|
||||
"#{||:#{C:%s},#{m:*%s*,#{pane_title}}}",
|
||||
s, s);
|
||||
} else if (N && T) {
|
||||
xasprintf(&filter,
|
||||
"#{||:#{m:*%s*,#{window_name}},"
|
||||
"#{m:*%s*,#{pane_title}}}",
|
||||
s, s);
|
||||
} else if (C)
|
||||
xasprintf(&filter, "#{C:%s}", s);
|
||||
else if (N)
|
||||
xasprintf(&filter, "#{m:*%s*,#{window_name}}", s);
|
||||
else
|
||||
xasprintf(&filter, "#{m:*%s*,#{pane_title}}", s);
|
||||
} else {
|
||||
if (C && N && T) {
|
||||
xasprintf(&filter,
|
||||
"#{||:"
|
||||
"#{C/r:%s},#{||:#{m/r:%s,#{window_name}},"
|
||||
"#{m/r:%s,#{pane_title}}}}",
|
||||
s, s, s);
|
||||
} else if (C && N) {
|
||||
xasprintf(&filter,
|
||||
"#{||:#{C/r:%s},#{m/r:%s,#{window_name}}}",
|
||||
s, s);
|
||||
} else if (C && T) {
|
||||
xasprintf(&filter,
|
||||
"#{||:#{C/r:%s},#{m/r:%s,#{pane_title}}}",
|
||||
s, s);
|
||||
} else if (N && T) {
|
||||
xasprintf(&filter,
|
||||
"#{||:#{m/r:%s,#{window_name}},"
|
||||
"#{m/r:%s,#{pane_title}}}",
|
||||
s, s);
|
||||
} else if (C)
|
||||
xasprintf(&filter, "#{C/r:%s}", s);
|
||||
else if (N)
|
||||
xasprintf(&filter, "#{m/r:%s,#{window_name}}", s);
|
||||
else
|
||||
xasprintf(&filter, "#{m/r:%s,#{pane_title}}", s);
|
||||
}
|
||||
|
||||
new_args = args_parse("", 1, &argv);
|
||||
if (args_has(args, 'Z'))
|
||||
|
8
tmux.1
8
tmux.1
@ -1828,14 +1828,16 @@ With
|
||||
.Fl b ,
|
||||
other commands are not blocked from running until the indicator is closed.
|
||||
.It Xo Ic find-window
|
||||
.Op Fl CNTZ
|
||||
.Op Fl rCNTZ
|
||||
.Op Fl t Ar target-pane
|
||||
.Ar match-string
|
||||
.Xc
|
||||
.D1 (alias: Ic findw )
|
||||
Search for the
|
||||
Search for a
|
||||
.Xr fnmatch 3
|
||||
pattern
|
||||
pattern or, with
|
||||
.Fl r ,
|
||||
regular expression
|
||||
.Ar match-string
|
||||
in window names, titles, and visible content (but not history).
|
||||
The flags control matching behavior:
|
||||
|
Loading…
Reference in New Issue
Block a user