mirror of
https://github.com/tmux/tmux.git
synced 2025-01-15 05:09:04 +00:00
Merge branch 'obsd-master'
Conflicts: Makefile cmd-link-window.c cmd-unlink-window.c
This commit is contained in:
commit
35ffd093d7
@ -88,7 +88,6 @@ dist_tmux_SOURCES = \
|
|||||||
cmd-kill-server.c \
|
cmd-kill-server.c \
|
||||||
cmd-kill-session.c \
|
cmd-kill-session.c \
|
||||||
cmd-kill-window.c \
|
cmd-kill-window.c \
|
||||||
cmd-link-window.c \
|
|
||||||
cmd-list-buffers.c \
|
cmd-list-buffers.c \
|
||||||
cmd-list-clients.c \
|
cmd-list-clients.c \
|
||||||
cmd-list-keys.c \
|
cmd-list-keys.c \
|
||||||
@ -130,7 +129,6 @@ dist_tmux_SOURCES = \
|
|||||||
cmd-swap-window.c \
|
cmd-swap-window.c \
|
||||||
cmd-switch-client.c \
|
cmd-switch-client.c \
|
||||||
cmd-unbind-key.c \
|
cmd-unbind-key.c \
|
||||||
cmd-unlink-window.c \
|
|
||||||
cmd-wait-for.c \
|
cmd-wait-for.c \
|
||||||
cmd.c \
|
cmd.c \
|
||||||
colour.c \
|
colour.c \
|
||||||
|
34
cfg.c
34
cfg.c
@ -29,7 +29,7 @@
|
|||||||
struct cmd_q *cfg_cmd_q;
|
struct cmd_q *cfg_cmd_q;
|
||||||
int cfg_finished;
|
int cfg_finished;
|
||||||
int cfg_references;
|
int cfg_references;
|
||||||
struct causelist cfg_causes;
|
ARRAY_DECL (, char *) cfg_causes = ARRAY_INITIALIZER;
|
||||||
struct client *cfg_client;
|
struct client *cfg_client;
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -39,7 +39,7 @@ load_cfg(const char *path, struct cmd_q *cmdq, char **cause)
|
|||||||
char delim[3] = { '\\', '\\', '\0' };
|
char delim[3] = { '\\', '\\', '\0' };
|
||||||
u_int found;
|
u_int found;
|
||||||
size_t line = 0;
|
size_t line = 0;
|
||||||
char *buf, *cause1, *msg, *p;
|
char *buf, *cause1, *p;
|
||||||
struct cmd_list *cmdlist;
|
struct cmd_list *cmdlist;
|
||||||
|
|
||||||
log_debug("loading %s", path);
|
log_debug("loading %s", path);
|
||||||
@ -66,8 +66,7 @@ load_cfg(const char *path, struct cmd_q *cmdq, char **cause)
|
|||||||
free(buf);
|
free(buf);
|
||||||
if (cause1 == NULL)
|
if (cause1 == NULL)
|
||||||
continue;
|
continue;
|
||||||
xasprintf(&msg, "%s:%zu: %s", path, line, cause1);
|
cfg_add_cause("%s:%zu: %s", path, line, cause1);
|
||||||
ARRAY_ADD(&cfg_causes, msg);
|
|
||||||
free(cause1);
|
free(cause1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -112,6 +111,33 @@ cfg_default_done(unused struct cmd_q *cmdq)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cfg_add_cause(const char* fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
char* msg;
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
xvasprintf(&msg, fmt, ap);
|
||||||
|
va_end (ap);
|
||||||
|
|
||||||
|
ARRAY_ADD(&cfg_causes, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cfg_print_causes(struct cmd_q *cmdq)
|
||||||
|
{
|
||||||
|
char *cause;
|
||||||
|
u_int i;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_LENGTH(&cfg_causes); i++) {
|
||||||
|
cause = ARRAY_ITEM(&cfg_causes, i);
|
||||||
|
cmdq_print(cmdq, "%s", cause);
|
||||||
|
free(cause);
|
||||||
|
}
|
||||||
|
ARRAY_FREE(&cfg_causes);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cfg_show_causes(struct session *s)
|
cfg_show_causes(struct session *s)
|
||||||
{
|
{
|
||||||
|
@ -34,16 +34,40 @@ const struct cmd_entry cmd_kill_window_entry = {
|
|||||||
cmd_kill_window_exec
|
cmd_kill_window_exec
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const struct cmd_entry cmd_unlink_window_entry = {
|
||||||
|
"unlink-window", "unlinkw",
|
||||||
|
"kt:", 0, 0,
|
||||||
|
"[-k] " CMD_TARGET_WINDOW_USAGE,
|
||||||
|
0,
|
||||||
|
cmd_kill_window_exec
|
||||||
|
};
|
||||||
|
|
||||||
enum cmd_retval
|
enum cmd_retval
|
||||||
cmd_kill_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
cmd_kill_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct winlink *wl, *wl2, *wl3;
|
struct winlink *wl, *wl2, *wl3;
|
||||||
|
struct window *w;
|
||||||
struct session *s;
|
struct session *s;
|
||||||
|
struct session_group *sg;
|
||||||
|
u_int references;
|
||||||
|
|
||||||
if ((wl = cmd_find_window(cmdq, args_get(args, 't'), &s)) == NULL)
|
if ((wl = cmd_find_window(cmdq, args_get(args, 't'), &s)) == NULL)
|
||||||
return (CMD_RETURN_ERROR);
|
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) {
|
||||||
|
cmdq_error(cmdq, "window only linked to one session");
|
||||||
|
return (CMD_RETURN_ERROR);
|
||||||
|
}
|
||||||
|
server_unlink_window(s, wl);
|
||||||
|
} else {
|
||||||
if (args_has(args, 'a')) {
|
if (args_has(args, 'a')) {
|
||||||
RB_FOREACH_SAFE(wl2, winlinks, &s->windows, wl3) {
|
RB_FOREACH_SAFE(wl2, winlinks, &s->windows, wl3) {
|
||||||
if (wl != wl2)
|
if (wl != wl2)
|
||||||
@ -51,6 +75,7 @@ cmd_kill_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
server_kill_window(wl->window);
|
server_kill_window(wl->window);
|
||||||
|
}
|
||||||
|
|
||||||
recalculate_sizes();
|
recalculate_sizes();
|
||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
|
||||||
* copyright notice and this permission notice appear in all copies.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
|
||||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "tmux.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Link a window into another session.
|
|
||||||
*/
|
|
||||||
|
|
||||||
enum cmd_retval cmd_link_window_exec(struct cmd *, struct cmd_q *);
|
|
||||||
|
|
||||||
const struct cmd_entry cmd_link_window_entry = {
|
|
||||||
"link-window", "linkw",
|
|
||||||
"dks:t:", 0, 0,
|
|
||||||
"[-dk] " CMD_SRCDST_WINDOW_USAGE,
|
|
||||||
0,
|
|
||||||
cmd_link_window_exec
|
|
||||||
};
|
|
||||||
|
|
||||||
enum cmd_retval
|
|
||||||
cmd_link_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
|
||||||
{
|
|
||||||
struct args *args = self->args;
|
|
||||||
struct session *src, *dst;
|
|
||||||
struct winlink *wl;
|
|
||||||
char *cause;
|
|
||||||
int idx, kflag, dflag;
|
|
||||||
|
|
||||||
if ((wl = cmd_find_window(cmdq, args_get(args, 's'), &src)) == NULL)
|
|
||||||
return (CMD_RETURN_ERROR);
|
|
||||||
if ((idx = cmd_find_index(cmdq, args_get(args, 't'), &dst)) == -2)
|
|
||||||
return (CMD_RETURN_ERROR);
|
|
||||||
|
|
||||||
kflag = args_has(self->args, 'k');
|
|
||||||
dflag = args_has(self->args, 'd');
|
|
||||||
if (server_link_window(src, wl, dst, idx, kflag, !dflag, &cause) != 0) {
|
|
||||||
cmdq_error(cmdq, "can't link window: %s", cause);
|
|
||||||
free(cause);
|
|
||||||
return (CMD_RETURN_ERROR);
|
|
||||||
}
|
|
||||||
recalculate_sizes();
|
|
||||||
|
|
||||||
return (CMD_RETURN_NORMAL);
|
|
||||||
}
|
|
@ -36,6 +36,14 @@ const struct cmd_entry cmd_move_window_entry = {
|
|||||||
cmd_move_window_exec
|
cmd_move_window_exec
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const struct cmd_entry cmd_link_window_entry = {
|
||||||
|
"link-window", "linkw",
|
||||||
|
"dks:t:", 0, 0,
|
||||||
|
"[-dk] " CMD_SRCDST_WINDOW_USAGE,
|
||||||
|
0,
|
||||||
|
cmd_move_window_exec
|
||||||
|
};
|
||||||
|
|
||||||
enum cmd_retval
|
enum cmd_retval
|
||||||
cmd_move_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
cmd_move_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||||
{
|
{
|
||||||
@ -46,7 +54,8 @@ cmd_move_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
int idx, kflag, dflag;
|
int idx, kflag, dflag;
|
||||||
|
|
||||||
if (args_has(args, 'r')) {
|
if (args_has(args, 'r')) {
|
||||||
if ((s = cmd_find_session(cmdq, args_get(args, 't'), 0)) == NULL)
|
s = cmd_find_session(cmdq, args_get(args, 't'), 0);
|
||||||
|
if (s == NULL)
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
|
|
||||||
session_renumber_windows(s);
|
session_renumber_windows(s);
|
||||||
@ -62,11 +71,13 @@ cmd_move_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
|
|
||||||
kflag = args_has(self->args, 'k');
|
kflag = args_has(self->args, 'k');
|
||||||
dflag = args_has(self->args, 'd');
|
dflag = args_has(self->args, 'd');
|
||||||
if (server_link_window(src, wl, dst, idx, kflag, !dflag, &cause) != 0) {
|
if (server_link_window(src, wl, dst, idx, kflag, !dflag,
|
||||||
cmdq_error(cmdq, "can't move window: %s", cause);
|
&cause) != 0) {
|
||||||
|
cmdq_error(cmdq, "can't link window: %s", cause);
|
||||||
free(cause);
|
free(cause);
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
|
if (self->entry == &cmd_move_window_entry)
|
||||||
server_unlink_window(src, wl);
|
server_unlink_window(src, wl);
|
||||||
recalculate_sizes();
|
recalculate_sizes();
|
||||||
|
|
||||||
|
12
cmd-queue.c
12
cmd-queue.c
@ -93,17 +93,16 @@ cmdq_error(struct cmd_q *cmdq, const char *fmt, ...)
|
|||||||
struct client *c = cmdq->client;
|
struct client *c = cmdq->client;
|
||||||
struct cmd *cmd = cmdq->cmd;
|
struct cmd *cmd = cmdq->cmd;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char *msg, *cause;
|
char *msg;
|
||||||
size_t msglen;
|
size_t msglen;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
msglen = xvasprintf(&msg, fmt, ap);
|
msglen = xvasprintf(&msg, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
if (c == NULL) {
|
if (c == NULL)
|
||||||
xasprintf(&cause, "%s:%u: %s", cmd->file, cmd->line, msg);
|
cfg_add_cause("%s:%u: %s", cmd->file, cmd->line, msg);
|
||||||
ARRAY_ADD(&cfg_causes, cause);
|
else if (c->session == NULL || (c->flags & CLIENT_CONTROL)) {
|
||||||
} else if (c->session == NULL || (c->flags & CLIENT_CONTROL)) {
|
|
||||||
evbuffer_add(c->stderr_data, msg, msglen);
|
evbuffer_add(c->stderr_data, msg, msglen);
|
||||||
evbuffer_add(c->stderr_data, "\n", 1);
|
evbuffer_add(c->stderr_data, "\n", 1);
|
||||||
|
|
||||||
@ -180,8 +179,6 @@ cmdq_continue(struct cmd_q *cmdq)
|
|||||||
cmdq->cmd = TAILQ_NEXT(cmdq->cmd, qentry);
|
cmdq->cmd = TAILQ_NEXT(cmdq->cmd, qentry);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
next = TAILQ_NEXT(cmdq->item, qentry);
|
|
||||||
|
|
||||||
while (cmdq->cmd != NULL) {
|
while (cmdq->cmd != NULL) {
|
||||||
cmd_print(cmdq->cmd, s, sizeof s);
|
cmd_print(cmdq->cmd, s, sizeof s);
|
||||||
log_debug("cmdq %p: %s (client %d)", cmdq, s,
|
log_debug("cmdq %p: %s (client %d)", cmdq, s,
|
||||||
@ -213,6 +210,7 @@ cmdq_continue(struct cmd_q *cmdq)
|
|||||||
|
|
||||||
cmdq->cmd = TAILQ_NEXT(cmdq->cmd, qentry);
|
cmdq->cmd = TAILQ_NEXT(cmdq->cmd, qentry);
|
||||||
}
|
}
|
||||||
|
next = TAILQ_NEXT(cmdq->item, qentry);
|
||||||
|
|
||||||
TAILQ_REMOVE(&cmdq->queue, cmdq->item, qentry);
|
TAILQ_REMOVE(&cmdq->queue, cmdq->item, qentry);
|
||||||
cmd_list_free(cmdq->item->cmdlist);
|
cmd_list_free(cmdq->item->cmdlist);
|
||||||
|
@ -99,8 +99,7 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
wp->flags &= ~PANE_INPUTOFF;
|
wp->flags &= ~PANE_INPUTOFF;
|
||||||
else if (args_has(self->args, 'd'))
|
else if (args_has(self->args, 'd'))
|
||||||
wp->flags |= PANE_INPUTOFF;
|
wp->flags |= PANE_INPUTOFF;
|
||||||
else {
|
else if (window_set_active_pane(wl->window, wp)) {
|
||||||
window_set_active_pane(wl->window, wp);
|
|
||||||
server_status_window(wl->window);
|
server_status_window(wl->window);
|
||||||
server_redraw_window_borders(wl->window);
|
server_redraw_window_borders(wl->window);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
enum cmd_retval cmd_source_file_exec(struct cmd *, struct cmd_q *);
|
enum cmd_retval cmd_source_file_exec(struct cmd *, struct cmd_q *);
|
||||||
|
|
||||||
void cmd_source_file_show(struct cmd_q *);
|
|
||||||
void cmd_source_file_done(struct cmd_q *);
|
void cmd_source_file_done(struct cmd_q *);
|
||||||
|
|
||||||
const struct cmd_entry cmd_source_file_entry = {
|
const struct cmd_entry cmd_source_file_entry = {
|
||||||
@ -59,11 +58,12 @@ cmd_source_file_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
free(cause);
|
free(cause);
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
ARRAY_ADD(&cfg_causes, cause);
|
cfg_add_cause("%s", cause);
|
||||||
|
free(cause);
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case 0:
|
case 0:
|
||||||
if (cfg_references == 0)
|
if (cfg_references == 0)
|
||||||
cmd_source_file_show(cmdq);
|
cfg_print_causes(cmdq);
|
||||||
cmdq_free(cmdq1);
|
cmdq_free(cmdq1);
|
||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
}
|
}
|
||||||
@ -75,20 +75,6 @@ cmd_source_file_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
return (CMD_RETURN_WAIT);
|
return (CMD_RETURN_WAIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
cmd_source_file_show(struct cmd_q *cmdq)
|
|
||||||
{
|
|
||||||
u_int i;
|
|
||||||
char *cause;
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_LENGTH(&cfg_causes); i++) {
|
|
||||||
cause = ARRAY_ITEM(&cfg_causes, i);
|
|
||||||
cmdq_print(cmdq, "%s", cause);
|
|
||||||
free(cause);
|
|
||||||
}
|
|
||||||
ARRAY_FREE(&cfg_causes);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cmd_source_file_done(struct cmd_q *cmdq1)
|
cmd_source_file_done(struct cmd_q *cmdq1)
|
||||||
{
|
{
|
||||||
@ -105,6 +91,6 @@ cmd_source_file_done(struct cmd_q *cmdq1)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (cfg_references == 0)
|
if (cfg_references == 0)
|
||||||
cmd_source_file_show(cmdq);
|
cfg_print_causes(cmdq);
|
||||||
cmdq_continue(cmdq);
|
cmdq_continue(cmdq);
|
||||||
}
|
}
|
||||||
|
@ -1,68 +0,0 @@
|
|||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
|
||||||
* copyright notice and this permission notice appear in all copies.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
|
||||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include "tmux.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Unlink a window, unless it would be destroyed by doing so (only one link).
|
|
||||||
*/
|
|
||||||
|
|
||||||
enum cmd_retval cmd_unlink_window_exec(struct cmd *, struct cmd_q *);
|
|
||||||
|
|
||||||
const struct cmd_entry cmd_unlink_window_entry = {
|
|
||||||
"unlink-window", "unlinkw",
|
|
||||||
"kt:", 0, 0,
|
|
||||||
"[-k] " CMD_TARGET_WINDOW_USAGE,
|
|
||||||
0,
|
|
||||||
cmd_unlink_window_exec
|
|
||||||
};
|
|
||||||
|
|
||||||
enum cmd_retval
|
|
||||||
cmd_unlink_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
|
||||||
{
|
|
||||||
struct args *args = self->args;
|
|
||||||
struct winlink *wl;
|
|
||||||
struct window *w;
|
|
||||||
struct session *s, *s2;
|
|
||||||
struct session_group *sg;
|
|
||||||
u_int references;
|
|
||||||
|
|
||||||
if ((wl = cmd_find_window(cmdq, args_get(args, 't'), &s)) == NULL)
|
|
||||||
return (CMD_RETURN_ERROR);
|
|
||||||
w = wl->window;
|
|
||||||
|
|
||||||
sg = session_group_find(s);
|
|
||||||
if (sg != NULL) {
|
|
||||||
references = 0;
|
|
||||||
TAILQ_FOREACH(s2, &sg->sessions, gentry)
|
|
||||||
references++;
|
|
||||||
} else
|
|
||||||
references = 1;
|
|
||||||
|
|
||||||
if (!args_has(self->args, 'k') && w->references == references) {
|
|
||||||
cmdq_error(cmdq, "window is only linked to one session");
|
|
||||||
return (CMD_RETURN_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
server_unlink_window(s, wl);
|
|
||||||
recalculate_sizes();
|
|
||||||
|
|
||||||
return (CMD_RETURN_NORMAL);
|
|
||||||
}
|
|
1
format.c
1
format.c
@ -555,6 +555,7 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp)
|
|||||||
format_add(ft, "pane_id", "%%%u", wp->id);
|
format_add(ft, "pane_id", "%%%u", wp->id);
|
||||||
format_add(ft, "pane_active", "%d", wp == wp->window->active);
|
format_add(ft, "pane_active", "%d", wp == wp->window->active);
|
||||||
format_add(ft, "pane_dead", "%d", wp->fd == -1);
|
format_add(ft, "pane_dead", "%d", wp->fd == -1);
|
||||||
|
format_add(ft, "pane_input_off", "%d", !!(wp->flags & PANE_INPUTOFF));
|
||||||
|
|
||||||
if (window_pane_visible(wp)) {
|
if (window_pane_visible(wp)) {
|
||||||
format_add(ft, "pane_left", "%u", wp->xoff);
|
format_add(ft, "pane_left", "%u", wp->xoff);
|
||||||
|
19
server.c
19
server.c
@ -166,25 +166,18 @@ server_start(int lockfd, char *lockfile)
|
|||||||
cfg_cmd_q->emptyfn = cfg_default_done;
|
cfg_cmd_q->emptyfn = cfg_default_done;
|
||||||
cfg_finished = 0;
|
cfg_finished = 0;
|
||||||
cfg_references = 1;
|
cfg_references = 1;
|
||||||
ARRAY_INIT(&cfg_causes);
|
|
||||||
cfg_client = ARRAY_FIRST(&clients);
|
cfg_client = ARRAY_FIRST(&clients);
|
||||||
if (cfg_client != NULL)
|
if (cfg_client != NULL)
|
||||||
cfg_client->references++;
|
cfg_client->references++;
|
||||||
|
|
||||||
if (access(TMUX_CONF, R_OK) == 0) {
|
if (access(TMUX_CONF, R_OK) == 0) {
|
||||||
if (load_cfg(TMUX_CONF, cfg_cmd_q, &cause) == -1) {
|
if (load_cfg(TMUX_CONF, cfg_cmd_q, &cause) == -1)
|
||||||
xasprintf(&cause, "%s: %s", TMUX_CONF, cause);
|
cfg_add_cause("%s: %s", TMUX_CONF, cause);
|
||||||
ARRAY_ADD(&cfg_causes, cause);
|
} else if (errno != ENOENT)
|
||||||
}
|
cfg_add_cause("%s: %s", TMUX_CONF, strerror(errno));
|
||||||
} else if (errno != ENOENT) {
|
|
||||||
xasprintf(&cause, "%s: %s", TMUX_CONF, strerror(errno));
|
|
||||||
ARRAY_ADD(&cfg_causes, cause);
|
|
||||||
}
|
|
||||||
if (cfg_file != NULL) {
|
if (cfg_file != NULL) {
|
||||||
if (load_cfg(cfg_file, cfg_cmd_q, &cause) == -1) {
|
if (load_cfg(cfg_file, cfg_cmd_q, &cause) == -1)
|
||||||
xasprintf(&cause, "%s: %s", cfg_file, cause);
|
cfg_add_cause("%s: %s", cfg_file, cause);
|
||||||
ARRAY_ADD(&cfg_causes, cause);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
cmdq_continue(cfg_cmd_q);
|
cmdq_continue(cfg_cmd_q);
|
||||||
|
|
||||||
|
16
session.c
16
session.c
@ -491,6 +491,19 @@ session_group_remove(struct session *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Count number of sessions in session group. */
|
||||||
|
u_int
|
||||||
|
session_group_count(struct session_group *sg)
|
||||||
|
{
|
||||||
|
struct session *s;
|
||||||
|
u_int n;
|
||||||
|
|
||||||
|
n = 0;
|
||||||
|
TAILQ_FOREACH(s, &sg->sessions, gentry)
|
||||||
|
n++;
|
||||||
|
return (n);
|
||||||
|
}
|
||||||
|
|
||||||
/* Synchronize a session to its session group. */
|
/* Synchronize a session to its session group. */
|
||||||
void
|
void
|
||||||
session_group_synchronize_to(struct session *s)
|
session_group_synchronize_to(struct session *s)
|
||||||
@ -578,7 +591,8 @@ session_group_synchronize1(struct session *target, struct session *s)
|
|||||||
/* Then free the old winlinks list. */
|
/* Then free the old winlinks list. */
|
||||||
while (!RB_EMPTY(&old_windows)) {
|
while (!RB_EMPTY(&old_windows)) {
|
||||||
wl = RB_ROOT(&old_windows);
|
wl = RB_ROOT(&old_windows);
|
||||||
if (winlink_find_by_window_id(&s->windows, wl->window->id) == NULL)
|
wl2 = winlink_find_by_window_id(&s->windows, wl->window->id);
|
||||||
|
if (wl2 == NULL)
|
||||||
notify_window_unlinked(s, wl->window);
|
notify_window_unlinked(s, wl->window);
|
||||||
winlink_remove(&old_windows, wl);
|
winlink_remove(&old_windows, wl);
|
||||||
}
|
}
|
||||||
|
1
tmux.1
1
tmux.1
@ -3104,6 +3104,7 @@ The following variables are available, where appropriate:
|
|||||||
.It Li "pane_height" Ta "" Ta "Height of pane"
|
.It Li "pane_height" Ta "" Ta "Height of pane"
|
||||||
.It Li "pane_id" Ta "#D" Ta "Unique pane ID"
|
.It Li "pane_id" Ta "#D" Ta "Unique pane ID"
|
||||||
.It Li "pane_in_mode" Ta "" Ta "If pane is in a mode"
|
.It Li "pane_in_mode" Ta "" Ta "If pane is in a mode"
|
||||||
|
.It Li "pane_input_off" Ta "" Ta "If input to pane is disabled"
|
||||||
.It Li "pane_index" Ta "#P" Ta "Index of pane"
|
.It Li "pane_index" Ta "#P" Ta "Index of pane"
|
||||||
.It Li "pane_left" Ta "" Ta "Left of pane"
|
.It Li "pane_left" Ta "" Ta "Left of pane"
|
||||||
.It Li "pane_pid" Ta "" Ta "PID of first process in pane"
|
.It Li "pane_pid" Ta "" Ta "PID of first process in pane"
|
||||||
|
9
tmux.h
9
tmux.h
@ -379,9 +379,6 @@ struct tty_term_code_entry {
|
|||||||
const char *name;
|
const char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* List of error causes. */
|
|
||||||
ARRAY_DECL(causelist, char *);
|
|
||||||
|
|
||||||
/* Message codes. */
|
/* Message codes. */
|
||||||
enum msgtype {
|
enum msgtype {
|
||||||
MSG_VERSION = 12,
|
MSG_VERSION = 12,
|
||||||
@ -1498,10 +1495,11 @@ __dead void shell_exec(const char *, const char *);
|
|||||||
extern struct cmd_q *cfg_cmd_q;
|
extern struct cmd_q *cfg_cmd_q;
|
||||||
extern int cfg_finished;
|
extern int cfg_finished;
|
||||||
extern int cfg_references;
|
extern int cfg_references;
|
||||||
extern struct causelist cfg_causes;
|
|
||||||
extern struct client *cfg_client;
|
extern struct client *cfg_client;
|
||||||
int load_cfg(const char *, struct cmd_q *, char **);
|
int load_cfg(const char *, struct cmd_q *, char **);
|
||||||
void cfg_default_done(struct cmd_q *);
|
void cfg_default_done(struct cmd_q *);
|
||||||
|
void cfg_add_cause(const char *, ...);
|
||||||
|
void cfg_print_causes(struct cmd_q *);
|
||||||
void cfg_show_causes(struct session *);
|
void cfg_show_causes(struct session *);
|
||||||
|
|
||||||
/* format.c */
|
/* format.c */
|
||||||
@ -2114,7 +2112,7 @@ void window_destroy(struct window *);
|
|||||||
struct window_pane *window_get_active_at(struct window *, u_int, u_int);
|
struct window_pane *window_get_active_at(struct window *, u_int, u_int);
|
||||||
void window_set_active_at(struct window *, u_int, u_int);
|
void window_set_active_at(struct window *, u_int, u_int);
|
||||||
struct window_pane *window_find_string(struct window *, const char *);
|
struct window_pane *window_find_string(struct window *, const char *);
|
||||||
void window_set_active_pane(struct window *, struct window_pane *);
|
int window_set_active_pane(struct window *, struct window_pane *);
|
||||||
struct window_pane *window_add_pane(struct window *, u_int);
|
struct window_pane *window_add_pane(struct window *, u_int);
|
||||||
void window_resize(struct window *, u_int, u_int);
|
void window_resize(struct window *, u_int, u_int);
|
||||||
int window_zoom(struct window_pane *);
|
int window_zoom(struct window_pane *);
|
||||||
@ -2294,6 +2292,7 @@ struct session_group *session_group_find(struct session *);
|
|||||||
u_int session_group_index(struct session_group *);
|
u_int session_group_index(struct session_group *);
|
||||||
void session_group_add(struct session *, struct session *);
|
void session_group_add(struct session *, struct session *);
|
||||||
void session_group_remove(struct session *);
|
void session_group_remove(struct session *);
|
||||||
|
u_int session_group_count(struct session_group *);
|
||||||
void session_group_synchronize_to(struct session *);
|
void session_group_synchronize_to(struct session *);
|
||||||
void session_group_synchronize_from(struct session *);
|
void session_group_synchronize_from(struct session *);
|
||||||
void session_group_synchronize1(struct session *, struct session *);
|
void session_group_synchronize1(struct session *, struct session *);
|
||||||
|
7
window.c
7
window.c
@ -385,11 +385,11 @@ window_resize(struct window *w, u_int sx, u_int sy)
|
|||||||
w->sy = sy;
|
w->sy = sy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
window_set_active_pane(struct window *w, struct window_pane *wp)
|
window_set_active_pane(struct window *w, struct window_pane *wp)
|
||||||
{
|
{
|
||||||
if (wp == w->active)
|
if (wp == w->active)
|
||||||
return;
|
return (0);
|
||||||
w->last = w->active;
|
w->last = w->active;
|
||||||
w->active = wp;
|
w->active = wp;
|
||||||
while (!window_pane_visible(w->active)) {
|
while (!window_pane_visible(w->active)) {
|
||||||
@ -397,9 +397,10 @@ window_set_active_pane(struct window *w, struct window_pane *wp)
|
|||||||
if (w->active == NULL)
|
if (w->active == NULL)
|
||||||
w->active = TAILQ_LAST(&w->panes, window_panes);
|
w->active = TAILQ_LAST(&w->panes, window_panes);
|
||||||
if (w->active == wp)
|
if (w->active == wp)
|
||||||
return;
|
return (1);
|
||||||
}
|
}
|
||||||
w->active->active_point = next_active_point++;
|
w->active->active_point = next_active_point++;
|
||||||
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct window_pane *
|
struct window_pane *
|
||||||
|
Loading…
Reference in New Issue
Block a user