mirror of
https://github.com/tmux/tmux.git
synced 2025-09-01 20:57:00 +00:00
Add a format window_linked which is 1 if a window has been linked
multiple times, also remove the default space in window_flags and use a conditional to add it in window-status-format (this means additional flags can be added in the option without extra spaces). From Thomas Adam with tweaks by me.
This commit is contained in:
@ -45,24 +45,17 @@ const struct cmd_entry cmd_unlink_window_entry = {
|
||||
enum cmd_retval
|
||||
cmd_kill_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct winlink *wl, *wl2, *wl3;
|
||||
struct window *w;
|
||||
struct session *s;
|
||||
struct session_group *sg;
|
||||
u_int references;
|
||||
struct args *args = self->args;
|
||||
struct winlink *wl, *wl2, *wl3;
|
||||
struct window *w;
|
||||
struct session *s;
|
||||
|
||||
if ((wl = cmd_find_window(cmdq, args_get(args, 't'), &s)) == NULL)
|
||||
return (CMD_RETURN_ERROR);
|
||||
w = wl->window;
|
||||
|
||||
if (self->entry == &cmd_unlink_window_entry) {
|
||||
sg = session_group_find(s);
|
||||
if (sg != NULL)
|
||||
references = session_group_count(sg);
|
||||
else
|
||||
references = 1;
|
||||
if (!args_has(self->args, 'k') && w->references == references) {
|
||||
if (!args_has(self->args, 'k') && !session_is_linked(s, w)) {
|
||||
cmdq_error(cmdq, "window only linked to one session");
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
|
Reference in New Issue
Block a user