mirror of
https://github.com/tmux/tmux.git
synced 2024-11-19 19:08:50 +00:00
Redraw both src and dst sessions in break-pane.
This commit is contained in:
parent
c1d0b6a6ee
commit
8b5d5dca9f
@ -43,7 +43,8 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct winlink *wl;
|
struct winlink *wl;
|
||||||
struct session *s;
|
struct session *src_s;
|
||||||
|
struct session *dst_s;
|
||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
struct window *w;
|
struct window *w;
|
||||||
char *name;
|
char *name;
|
||||||
@ -53,28 +54,28 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
const char *template;
|
const char *template;
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
if ((wl = cmd_find_pane(cmdq, args_get(args, 's'), &s, &wp)) == NULL)
|
wl = cmd_find_pane(cmdq, args_get(args, 's'), &src_s, &wp);
|
||||||
|
if (wl == NULL)
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
if ((idx = cmd_find_index(cmdq, args_get(args, 't'), &s)) == -2)
|
if ((idx = cmd_find_index(cmdq, args_get(args, 't'), &dst_s)) == -2)
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
if (idx != -1 && winlink_find_by_index(&s->windows, idx) != NULL) {
|
if (idx != -1 && winlink_find_by_index(&dst_s->windows, idx) != NULL) {
|
||||||
cmdq_error(cmdq, "index %d already in use", idx);
|
cmdq_error(cmdq, "index %d already in use", idx);
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
|
w = wl->window;
|
||||||
|
|
||||||
if (window_count_panes(wl->window) == 1) {
|
if (window_count_panes(w) == 1) {
|
||||||
cmdq_error(cmdq, "can't break with only one pane");
|
cmdq_error(cmdq, "can't break with only one pane");
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
w = wl->window;
|
|
||||||
server_unzoom_window(w);
|
server_unzoom_window(w);
|
||||||
|
|
||||||
TAILQ_REMOVE(&w->panes, wp, entry);
|
TAILQ_REMOVE(&w->panes, wp, entry);
|
||||||
window_lost_pane(w, wp);
|
window_lost_pane(w, wp);
|
||||||
layout_close_pane(wp);
|
layout_close_pane(wp);
|
||||||
|
|
||||||
w = wp->window = window_create1(s->sx, s->sy);
|
w = wp->window = window_create1(dst_s->sx, dst_s->sy);
|
||||||
TAILQ_INSERT_HEAD(&w->panes, wp, entry);
|
TAILQ_INSERT_HEAD(&w->panes, wp, entry);
|
||||||
w->active = wp;
|
w->active = wp;
|
||||||
name = default_window_name(w);
|
name = default_window_name(w);
|
||||||
@ -83,20 +84,25 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
layout_init(w, wp);
|
layout_init(w, wp);
|
||||||
|
|
||||||
if (idx == -1)
|
if (idx == -1)
|
||||||
idx = -1 - options_get_number(&s->options, "base-index");
|
idx = -1 - options_get_number(&dst_s->options, "base-index");
|
||||||
wl = session_attach(s, w, idx, &cause); /* can't fail */
|
wl = session_attach(dst_s, w, idx, &cause); /* can't fail */
|
||||||
if (!args_has(self->args, 'd'))
|
if (!args_has(self->args, 'd'))
|
||||||
session_select(s, wl->idx);
|
session_select(dst_s, wl->idx);
|
||||||
|
|
||||||
server_redraw_session(s);
|
server_redraw_session(src_s);
|
||||||
server_status_session_group(s);
|
if (src_s != dst_s)
|
||||||
|
server_redraw_session(dst_s);
|
||||||
|
server_status_session_group(src_s);
|
||||||
|
if (src_s != dst_s)
|
||||||
|
server_status_session_group(dst_s);
|
||||||
|
|
||||||
if (args_has(args, 'P')) {
|
if (args_has(args, 'P')) {
|
||||||
if ((template = args_get(args, 'F')) == NULL)
|
if ((template = args_get(args, 'F')) == NULL)
|
||||||
template = BREAK_PANE_TEMPLATE;
|
template = BREAK_PANE_TEMPLATE;
|
||||||
|
|
||||||
ft = format_create();
|
ft = format_create();
|
||||||
format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s, wl, wp);
|
format_defaults(ft, cmd_find_client(cmdq, NULL, 1), dst_s, wl,
|
||||||
|
wp);
|
||||||
|
|
||||||
cp = format_expand(ft, template);
|
cp = format_expand(ft, template);
|
||||||
cmdq_print(cmdq, "%s", cp);
|
cmdq_print(cmdq, "%s", cp);
|
||||||
|
Loading…
Reference in New Issue
Block a user