mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
previous-layout command.
This commit is contained in:
parent
a6f2d82335
commit
044e6f7660
3
CHANGES
3
CHANGES
@ -1,5 +1,6 @@
|
|||||||
30 April 2009
|
30 April 2009
|
||||||
|
|
||||||
|
* previous-layout command.
|
||||||
* Display the layout name in window lists.
|
* Display the layout name in window lists.
|
||||||
* Merge resize-pane-up and resize-pane-down into resize-pane with -U and -D
|
* Merge resize-pane-up and resize-pane-down into resize-pane with -U and -D
|
||||||
flags.
|
flags.
|
||||||
@ -1235,7 +1236,7 @@
|
|||||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||||
customisation.
|
customisation.
|
||||||
|
|
||||||
$Id: CHANGES,v 1.280 2009-04-30 20:54:52 nicm Exp $
|
$Id: CHANGES,v 1.281 2009-04-30 21:17:06 nicm Exp $
|
||||||
|
|
||||||
LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
|
LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
|
||||||
LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms
|
LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms
|
||||||
|
19
GNUmakefile
19
GNUmakefile
@ -1,4 +1,4 @@
|
|||||||
# $Id: GNUmakefile,v 1.90 2009-04-30 06:01:23 nicm Exp $
|
# $Id: GNUmakefile,v 1.91 2009-04-30 21:17:06 nicm Exp $
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
@ -16,8 +16,8 @@ SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \
|
|||||||
screen.c screen-write.c screen-redraw.c \
|
screen.c screen-write.c screen-redraw.c \
|
||||||
grid.c grid-view.c \
|
grid.c grid-view.c \
|
||||||
window.c session.c log.c client.c client-msg.c client-fn.c cfg.c \
|
window.c session.c log.c client.c client-msg.c client-fn.c cfg.c \
|
||||||
key-string.c key-bindings.c resize.c arg.c mode-key.c \
|
layout.c key-string.c key-bindings.c resize.c arg.c mode-key.c \
|
||||||
layout.c cmd.c cmd-generic.c cmd-string.c cmd-list.c \
|
cmd.c cmd-generic.c cmd-string.c cmd-list.c \
|
||||||
cmd-detach-client.c cmd-list-sessions.c cmd-new-window.c cmd-bind-key.c \
|
cmd-detach-client.c cmd-list-sessions.c cmd-new-window.c cmd-bind-key.c \
|
||||||
cmd-unbind-key.c cmd-previous-window.c cmd-last-window.c cmd-list-keys.c \
|
cmd-unbind-key.c cmd-previous-window.c cmd-last-window.c cmd-list-keys.c \
|
||||||
cmd-set-option.c cmd-rename-window.c cmd-select-window.c \
|
cmd-set-option.c cmd-rename-window.c cmd-select-window.c \
|
||||||
@ -31,14 +31,13 @@ SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \
|
|||||||
cmd-show-window-options.c cmd-command-prompt.c cmd-set-buffer.c \
|
cmd-show-window-options.c cmd-command-prompt.c cmd-set-buffer.c \
|
||||||
cmd-show-buffer.c cmd-list-buffers.c cmd-delete-buffer.c \
|
cmd-show-buffer.c cmd-list-buffers.c cmd-delete-buffer.c \
|
||||||
cmd-list-commands.c cmd-move-window.c cmd-select-prompt.c \
|
cmd-list-commands.c cmd-move-window.c cmd-select-prompt.c \
|
||||||
cmd-respawn-window.c cmd-source-file.c cmd-server-info.c \
|
cmd-respawn-window.c cmd-source-file.c cmd-server-info.c cmd-down-pane.c \
|
||||||
cmd-clock-mode.c cmd-lock-server.c cmd-set-password.c \
|
cmd-clock-mode.c cmd-lock-server.c cmd-set-password.c cmd-up-pane.c \
|
||||||
cmd-save-buffer.c cmd-select-pane.c cmd-split-window.c \
|
cmd-save-buffer.c cmd-select-pane.c cmd-split-window.c cmd-kill-pane.c \
|
||||||
cmd-resize-pane.c cmd-kill-pane.c \
|
cmd-resize-pane.c cmd-choose-window.c cmd-choose-session.c \
|
||||||
cmd-up-pane.c cmd-down-pane.c cmd-choose-window.c cmd-choose-session.c \
|
|
||||||
cmd-suspend-client.c cmd-find-window.c cmd-load-buffer.c \
|
cmd-suspend-client.c cmd-find-window.c cmd-load-buffer.c \
|
||||||
cmd-copy-buffer.c cmd-break-pane.c cmd-swap-pane.c cmd-next-layout.c \
|
cmd-copy-buffer.c cmd-break-pane.c cmd-swap-pane.c cmd-rotate-window.c \
|
||||||
cmd-rotate-window.c cmd-confirm-before.c \
|
cmd-confirm-before.c cmd-next-layout.c cmd-previous-layout.c \
|
||||||
window-clock.c window-scroll.c window-more.c window-copy.c \
|
window-clock.c window-scroll.c window-more.c window-copy.c \
|
||||||
window-choose.c \
|
window-choose.c \
|
||||||
options.c options-cmd.c paste.c colour.c utf8.c clock.c \
|
options.c options-cmd.c paste.c colour.c utf8.c clock.c \
|
||||||
|
15
Makefile
15
Makefile
@ -1,4 +1,4 @@
|
|||||||
# $Id: Makefile,v 1.128 2009-04-30 06:01:23 nicm Exp $
|
# $Id: Makefile,v 1.129 2009-04-30 21:17:06 nicm Exp $
|
||||||
|
|
||||||
.SUFFIXES: .c .o .y .h
|
.SUFFIXES: .c .o .y .h
|
||||||
.PHONY: clean update-index.html upload-index.html
|
.PHONY: clean update-index.html upload-index.html
|
||||||
@ -34,14 +34,13 @@ SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \
|
|||||||
cmd-show-window-options.c cmd-command-prompt.c cmd-set-buffer.c \
|
cmd-show-window-options.c cmd-command-prompt.c cmd-set-buffer.c \
|
||||||
cmd-show-buffer.c cmd-list-buffers.c cmd-delete-buffer.c \
|
cmd-show-buffer.c cmd-list-buffers.c cmd-delete-buffer.c \
|
||||||
cmd-list-commands.c cmd-move-window.c cmd-select-prompt.c \
|
cmd-list-commands.c cmd-move-window.c cmd-select-prompt.c \
|
||||||
cmd-respawn-window.c cmd-source-file.c cmd-server-info.c \
|
cmd-respawn-window.c cmd-source-file.c cmd-server-info.c cmd-down-pane.c \
|
||||||
cmd-clock-mode.c cmd-lock-server.c cmd-set-password.c \
|
cmd-clock-mode.c cmd-lock-server.c cmd-set-password.c cmd-up-pane.c \
|
||||||
cmd-save-buffer.c cmd-select-pane.c cmd-split-window.c \
|
cmd-save-buffer.c cmd-select-pane.c cmd-split-window.c cmd-kill-pane.c \
|
||||||
cmd-resize-pane.c cmd-kill-pane.c \
|
cmd-resize-pane.c cmd-choose-window.c cmd-choose-session.c \
|
||||||
cmd-up-pane.c cmd-down-pane.c cmd-choose-window.c cmd-choose-session.c \
|
|
||||||
cmd-suspend-client.c cmd-find-window.c cmd-load-buffer.c \
|
cmd-suspend-client.c cmd-find-window.c cmd-load-buffer.c \
|
||||||
cmd-copy-buffer.c cmd-break-pane.c cmd-swap-pane.c cmd-next-layout.c \
|
cmd-copy-buffer.c cmd-break-pane.c cmd-swap-pane.c cmd-rotate-window.c \
|
||||||
cmd-rotate-window.c cmd-confirm-before.c \
|
cmd-confirm-before.c cmd-next-layout.c cmd-previous-layout.c \
|
||||||
window-clock.c window-scroll.c window-more.c window-copy.c \
|
window-clock.c window-scroll.c window-more.c window-copy.c \
|
||||||
window-choose.c \
|
window-choose.c \
|
||||||
options.c options-cmd.c paste.c colour.c utf8.c clock.c \
|
options.c options-cmd.c paste.c colour.c utf8.c clock.c \
|
||||||
|
1
TODO
1
TODO
@ -78,7 +78,6 @@
|
|||||||
- attach should have a flag to create session if it doesn't exist
|
- attach should have a flag to create session if it doesn't exist
|
||||||
- layout/split stuff:
|
- layout/split stuff:
|
||||||
horiz split command, and similar resizing commands as for vert split
|
horiz split command, and similar resizing commands as for vert split
|
||||||
previous-layout command
|
|
||||||
select-layout command
|
select-layout command
|
||||||
make manual layout a bit less of a hack and make it handle a grid
|
make manual layout a bit less of a hack and make it handle a grid
|
||||||
should the layout be a window option???
|
should the layout be a window option???
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cmd-next-layout.c,v 1.1 2009-04-01 18:21:26 nicm Exp $ */
|
/* $Id: cmd-next-layout.c,v 1.2 2009-04-30 21:17:06 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -49,6 +49,7 @@ cmd_next_layout_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
layout_next(wl->window);
|
layout_next(wl->window);
|
||||||
|
ctx->info(ctx, "layout now: %s", layout_name(wl->window));
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
55
cmd-previous-layout.c
Normal file
55
cmd-previous-layout.c
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/* $Id: cmd-previous-layout.c,v 1.1 2009-04-30 21:17:06 nicm Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2009 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"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Switch window to previous layout.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int cmd_previous_layout_exec(struct cmd *, struct cmd_ctx *);
|
||||||
|
|
||||||
|
const struct cmd_entry cmd_previous_layout_entry = {
|
||||||
|
"previous-layout", "prevl",
|
||||||
|
CMD_TARGET_WINDOW_USAGE,
|
||||||
|
0,
|
||||||
|
cmd_target_init,
|
||||||
|
cmd_target_parse,
|
||||||
|
cmd_previous_layout_exec,
|
||||||
|
cmd_target_send,
|
||||||
|
cmd_target_recv,
|
||||||
|
cmd_target_free,
|
||||||
|
cmd_target_print
|
||||||
|
};
|
||||||
|
|
||||||
|
int
|
||||||
|
cmd_previous_layout_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||||
|
{
|
||||||
|
struct cmd_target_data *data = self->data;
|
||||||
|
struct winlink *wl;
|
||||||
|
|
||||||
|
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
|
||||||
|
return (-1);
|
||||||
|
|
||||||
|
layout_previous(wl->window);
|
||||||
|
ctx->info(ctx, "layout now: %s", layout_name(wl->window));
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
3
cmd.c
3
cmd.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cmd.c,v 1.91 2009-04-30 06:01:24 nicm Exp $ */
|
/* $Id: cmd.c,v 1.92 2009-04-30 21:17:06 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -61,6 +61,7 @@ const struct cmd_entry *cmd_table[] = {
|
|||||||
&cmd_next_layout_entry,
|
&cmd_next_layout_entry,
|
||||||
&cmd_next_window_entry,
|
&cmd_next_window_entry,
|
||||||
&cmd_paste_buffer_entry,
|
&cmd_paste_buffer_entry,
|
||||||
|
&cmd_previous_layout_entry,
|
||||||
&cmd_previous_window_entry,
|
&cmd_previous_window_entry,
|
||||||
&cmd_refresh_client_entry,
|
&cmd_refresh_client_entry,
|
||||||
&cmd_rename_session_entry,
|
&cmd_rename_session_entry,
|
||||||
|
17
layout.c
17
layout.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: layout.c,v 1.4 2009-04-30 16:27:29 nicm Exp $ */
|
/* $Id: layout.c,v 1.5 2009-04-30 21:17:06 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -61,6 +61,21 @@ layout_next(struct window *w)
|
|||||||
layout_refresh(w, 0);
|
layout_refresh(w, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
layout_previous(struct window *w)
|
||||||
|
{
|
||||||
|
if (w->layout == 0)
|
||||||
|
w->layout = nitems(layouts) - 1;
|
||||||
|
else
|
||||||
|
w->layout--;
|
||||||
|
if (w->layout == 0) {
|
||||||
|
/* XXX Special-case manual. */
|
||||||
|
window_fit_panes(w);
|
||||||
|
window_update_panes(w);
|
||||||
|
}
|
||||||
|
layout_refresh(w, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
layout_refresh(struct window *w, unused int active_changed)
|
layout_refresh(struct window *w, unused int active_changed)
|
||||||
{
|
{
|
||||||
|
4
tmux.h
4
tmux.h
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.h,v 1.308 2009-04-30 20:54:53 nicm Exp $ */
|
/* $Id: tmux.h,v 1.309 2009-04-30 21:17:06 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -1216,6 +1216,7 @@ extern const struct cmd_entry cmd_new_window_entry;
|
|||||||
extern const struct cmd_entry cmd_next_layout_entry;
|
extern const struct cmd_entry cmd_next_layout_entry;
|
||||||
extern const struct cmd_entry cmd_next_window_entry;
|
extern const struct cmd_entry cmd_next_window_entry;
|
||||||
extern const struct cmd_entry cmd_paste_buffer_entry;
|
extern const struct cmd_entry cmd_paste_buffer_entry;
|
||||||
|
extern const struct cmd_entry cmd_previous_layout_entry;
|
||||||
extern const struct cmd_entry cmd_previous_window_entry;
|
extern const struct cmd_entry cmd_previous_window_entry;
|
||||||
extern const struct cmd_entry cmd_refresh_client_entry;
|
extern const struct cmd_entry cmd_refresh_client_entry;
|
||||||
extern const struct cmd_entry cmd_rename_session_entry;
|
extern const struct cmd_entry cmd_rename_session_entry;
|
||||||
@ -1546,6 +1547,7 @@ void window_pane_mouse(struct window_pane *,
|
|||||||
const char * layout_name(struct window *);
|
const char * layout_name(struct window *);
|
||||||
void layout_refresh(struct window *, int);
|
void layout_refresh(struct window *, int);
|
||||||
void layout_next(struct window *);
|
void layout_next(struct window *);
|
||||||
|
void layout_previous(struct window *);
|
||||||
|
|
||||||
/* window-clock.c */
|
/* window-clock.c */
|
||||||
extern const struct window_mode window_clock_mode;
|
extern const struct window_mode window_clock_mode;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user