mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-26 18:13:10 +01:00
- Allow switching to hidden windows (for active-only layout).
- Don't update unnecessarily for other layouts when changing active pane doesn't matter.
This commit is contained in:
parent
474853439c
commit
91bc6836f7
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-down-pane.c,v 1.6 2009-04-01 18:33:19 nicm Exp $ */
|
||||
/* $Id: cmd-down-pane.c,v 1.7 2009-04-01 21:10:08 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -54,6 +54,7 @@ cmd_down_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
w->active = TAILQ_NEXT(w->active, entry);
|
||||
if (w->active == NULL)
|
||||
w->active = TAILQ_FIRST(&w->panes);
|
||||
layout_refresh(w, 1);
|
||||
} while (w->active->flags & PANE_HIDDEN);
|
||||
|
||||
return (0);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-kill-pane.c,v 1.5 2009-04-01 18:21:24 nicm Exp $ */
|
||||
/* $Id: cmd-kill-pane.c,v 1.6 2009-04-01 21:10:08 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -67,6 +67,6 @@ cmd_kill_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
|
||||
window_remove_pane(wl->window, wp);
|
||||
server_redraw_window(wl->window);
|
||||
layout_refresh(wl->window);
|
||||
layout_refresh(wl->window, 0);
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-select-pane.c,v 1.3 2009-04-01 18:21:26 nicm Exp $ */
|
||||
/* $Id: cmd-select-pane.c,v 1.4 2009-04-01 21:10:08 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -63,7 +63,7 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
return (-1);
|
||||
}
|
||||
window_set_active_pane(wl->window, wp);
|
||||
layout_refresh(wl->window);
|
||||
layout_refresh(wl->window, 1);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-split-window.c,v 1.10 2009-04-01 18:21:28 nicm Exp $ */
|
||||
/* $Id: cmd-split-window.c,v 1.11 2009-04-01 21:10:08 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -178,7 +178,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
server_redraw_session(s);
|
||||
} else
|
||||
server_status_session(s);
|
||||
layout_refresh(w);
|
||||
layout_refresh(w, 0);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-up-pane.c,v 1.6 2009-04-01 18:33:19 nicm Exp $ */
|
||||
/* $Id: cmd-up-pane.c,v 1.7 2009-04-01 21:10:08 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -54,6 +54,7 @@ cmd_up_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
w->active = TAILQ_PREV(w->active, window_panes, entry);
|
||||
if (w->active == NULL)
|
||||
w->active = TAILQ_LAST(&w->panes, window_panes);
|
||||
layout_refresh(w, 1);
|
||||
} while (w->active->flags & PANE_HIDDEN);
|
||||
|
||||
return (0);
|
||||
|
46
layout.c
46
layout.c
@ -1,4 +1,4 @@
|
||||
/* $Id: layout.c,v 1.2 2009-04-01 18:48:09 nicm Exp $ */
|
||||
/* $Id: layout.c,v 1.3 2009-04-01 21:10:08 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -20,15 +20,20 @@
|
||||
|
||||
#include "tmux.h"
|
||||
|
||||
void layout_manual(struct window *);
|
||||
void layout_active_only(struct window *);
|
||||
void layout_even_horizontal(struct window *);
|
||||
void layout_even_vertical(struct window *);
|
||||
void layout_left_vertical(struct window *);
|
||||
/*
|
||||
* Layout functions: second argument (int) is 1 if definitely the /only/ change
|
||||
* has been the active pane has changed. If 0 then panes, active pane or both
|
||||
* may have changed.
|
||||
*/
|
||||
void layout_manual(struct window *, int);
|
||||
void layout_active_only(struct window *, int);
|
||||
void layout_even_horizontal(struct window *, int);
|
||||
void layout_even_vertical(struct window *, int);
|
||||
void layout_left_vertical(struct window *, int);
|
||||
|
||||
const struct {
|
||||
const char *name;
|
||||
void (*fn)(struct window *);
|
||||
void (*fn)(struct window *, int);
|
||||
} layouts[] = {
|
||||
{ "manual", layout_manual },
|
||||
{ "active-only", layout_active_only },
|
||||
@ -47,23 +52,23 @@ layout_next(struct window *w)
|
||||
window_fit_panes(w);
|
||||
window_update_panes(w);
|
||||
}
|
||||
layout_refresh(w);
|
||||
layout_refresh(w, 0);
|
||||
}
|
||||
|
||||
void
|
||||
layout_refresh(struct window *w)
|
||||
layout_refresh(struct window *w, unused int active_changed)
|
||||
{
|
||||
layouts[w->layout].fn(w);
|
||||
layouts[w->layout].fn(w, active_changed);
|
||||
server_redraw_window(w);
|
||||
}
|
||||
|
||||
void
|
||||
layout_manual(unused struct window *w)
|
||||
layout_manual(unused struct window *w, unused int active_changed)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
layout_active_only(struct window *w)
|
||||
layout_active_only(struct window *w, unused int active_changed)
|
||||
{
|
||||
struct window_pane *wp;
|
||||
|
||||
@ -78,11 +83,14 @@ layout_active_only(struct window *w)
|
||||
}
|
||||
|
||||
void
|
||||
layout_even_horizontal(struct window *w)
|
||||
layout_even_horizontal(struct window *w, int active_changed)
|
||||
{
|
||||
struct window_pane *wp;
|
||||
u_int i, n, width, xoff;
|
||||
|
||||
if (active_changed)
|
||||
return;
|
||||
|
||||
/* Get number of panes. */
|
||||
n = window_count_panes(w);
|
||||
if (n == 0)
|
||||
@ -123,11 +131,14 @@ layout_even_horizontal(struct window *w)
|
||||
}
|
||||
|
||||
void
|
||||
layout_even_vertical(struct window *w)
|
||||
layout_even_vertical(struct window *w, int active_changed)
|
||||
{
|
||||
struct window_pane *wp;
|
||||
u_int i, n, height, yoff;
|
||||
|
||||
if (active_changed)
|
||||
return;
|
||||
|
||||
/* Get number of panes. */
|
||||
n = window_count_panes(w);
|
||||
if (n == 0)
|
||||
@ -168,11 +179,14 @@ layout_even_vertical(struct window *w)
|
||||
}
|
||||
|
||||
void
|
||||
layout_left_vertical(struct window *w)
|
||||
layout_left_vertical(struct window *w, int active_changed)
|
||||
{
|
||||
struct window_pane *wp;
|
||||
u_int i, n, height, yoff;
|
||||
|
||||
if (active_changed)
|
||||
return;
|
||||
|
||||
/* Get number of panes. */
|
||||
n = window_count_panes(w);
|
||||
if (n == 0)
|
||||
@ -180,7 +194,7 @@ layout_left_vertical(struct window *w)
|
||||
|
||||
/* Need >1 pane and minimum columns; if fewer, display active only. */
|
||||
if (n == 1 || w->sx < 82 + PANE_MINIMUM) {
|
||||
layout_active_only(w);
|
||||
layout_active_only(w, active_changed);
|
||||
return;
|
||||
}
|
||||
n--;
|
||||
|
5
resize.c
5
resize.c
@ -1,4 +1,4 @@
|
||||
/* $Id: resize.c,v 1.20 2009-04-01 18:21:32 nicm Exp $ */
|
||||
/* $Id: resize.c,v 1.21 2009-04-01 21:10:08 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -48,7 +48,6 @@ recalculate_sizes(void)
|
||||
struct session *s;
|
||||
struct client *c;
|
||||
struct window *w;
|
||||
struct window_pane *wp;
|
||||
u_int i, j, ssx, ssy, has, limit;
|
||||
int flag;
|
||||
|
||||
@ -134,6 +133,6 @@ recalculate_sizes(void)
|
||||
|
||||
window_resize(w, ssx, ssy);
|
||||
server_redraw_window(w);
|
||||
layout_refresh(w);
|
||||
layout_refresh(w, 0);
|
||||
}
|
||||
}
|
||||
|
4
server.c
4
server.c
@ -1,4 +1,4 @@
|
||||
/* $Id: server.c,v 1.133 2009-04-01 18:21:35 nicm Exp $ */
|
||||
/* $Id: server.c,v 1.134 2009-04-01 21:10:08 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -916,7 +916,7 @@ server_check_window(struct window *w)
|
||||
else if (!flag) {
|
||||
window_remove_pane(w, wp);
|
||||
server_redraw_window(w);
|
||||
layout_refresh(w);
|
||||
layout_refresh(w, 0);
|
||||
}
|
||||
wp = wq;
|
||||
}
|
||||
|
4
tmux.h
4
tmux.h
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.h,v 1.294 2009-04-01 18:21:42 nicm Exp $ */
|
||||
/* $Id: tmux.h,v 1.295 2009-04-01 21:10:08 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -1527,7 +1527,7 @@ void window_pane_mouse(struct window_pane *,
|
||||
struct client *, u_char, u_char, u_char);
|
||||
|
||||
/* layout.c */
|
||||
void layout_refresh(struct window *);
|
||||
void layout_refresh(struct window *, int);
|
||||
void layout_next(struct window *);
|
||||
|
||||
/* window-clock.c */
|
||||
|
Loading…
Reference in New Issue
Block a user