switch-pane is now select-pane.

This commit is contained in:
Nicholas Marriott 2009-01-14 19:56:55 +00:00
parent 3f51dcdfc3
commit d1eb153368
8 changed files with 44 additions and 40 deletions

View File

@ -1,5 +1,7 @@
14 January 2009
* switch-pane is now select-pane and requires -p to select a pane. The
"o" key binding is changed to down-pane.
* up-pane and down-pane commands, bound to arrow up and down by default.
* Multiple vertical window splitting. Minimum pane size is four lines, an
(unhelpful) error will be shown if attempting to split a window with less
@ -915,7 +917,7 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
$Id: CHANGES,v 1.204 2009-01-14 19:41:15 nicm Exp $
$Id: CHANGES,v 1.205 2009-01-14 19:56:55 nicm Exp $
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

View File

@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.53 2009-01-14 19:41:15 nicm Exp $
# $Id: GNUmakefile,v 1.54 2009-01-14 19:56:55 nicm Exp $
.PHONY: clean
@ -33,7 +33,7 @@ SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.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-clock-mode.c cmd-lock-server.c cmd-set-password.c \
cmd-save-buffer.c cmd-switch-pane.c cmd-split-window.c \
cmd-save-buffer.c cmd-select-pane.c cmd-split-window.c \
cmd-resize-pane-up.c cmd-resize-pane-down.c cmd-kill-pane.c \
cmd-up-pane.c cmd-down-pane.c \
window-clock.c window-scroll.c window-more.c window-copy.c \

View File

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.92 2009-01-14 19:41:15 nicm Exp $
# $Id: Makefile,v 1.93 2009-01-14 19:56:55 nicm Exp $
.SUFFIXES: .c .o .y .h
.PHONY: clean update-index.html upload-index.html
@ -37,7 +37,7 @@ SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.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-clock-mode.c cmd-lock-server.c cmd-set-password.c \
cmd-save-buffer.c cmd-switch-pane.c cmd-split-window.c \
cmd-save-buffer.c cmd-select-pane.c cmd-split-window.c \
cmd-resize-pane-up.c cmd-resize-pane-down.c cmd-kill-pane.c \
cmd-up-pane.c cmd-down-pane.c \
window-clock.c window-scroll.c window-more.c window-copy.c \

10
TODO
View File

@ -91,16 +91,10 @@
swap-panes
close-pane
move-pane (to window)
>2 panes per window
should be able to move to a hidden pane and it would be moved into view
- document pane stuff: up-/down-/select-/kill-pane, split-window
- would be nice if tmux could be the shell
- command-prompt should accept an argument to specify the prompt
- fix rxvt cursor fg issue (text under cursor has non-white fg)
- key handling sucks a bit and needs to be reworked
- prefix-time should only apply to a few commands otherwise it is too annoying
-----
SPLITTING
emacs-style:
- when resizing, always expand and reduce from top to bottom
- minimum size 4 + separator
- if not enough room hide windows from top to bottom

View File

@ -1,4 +1,4 @@
/* $Id: cmd-switch-pane.c,v 1.2 2009-01-14 19:29:32 nicm Exp $ */
/* $Id: cmd-select-pane.c,v 1.1 2009-01-14 19:56:55 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -21,40 +21,48 @@
#include "tmux.h"
/*
* Enter clock mode.
* Select pane.
*/
void cmd_switch_pane_exec(struct cmd *, struct cmd_ctx *);
void cmd_select_pane_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_switch_pane_entry = {
"switch-pane", "switchp",
CMD_TARGET_WINDOW_USAGE,
const struct cmd_entry cmd_select_pane_entry = {
"select-pane", "selectp",
CMD_PANE_WINDOW_USAGE,
0,
cmd_target_init,
cmd_target_parse,
cmd_switch_pane_exec,
cmd_target_send,
cmd_target_recv,
cmd_target_free,
cmd_target_print
cmd_pane_init,
cmd_pane_parse,
cmd_select_pane_exec,
cmd_pane_send,
cmd_pane_recv,
cmd_pane_free,
cmd_pane_print
};
void
cmd_switch_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
cmd_select_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_target_data *data = self->data;
struct cmd_pane_data *data = self->data;
struct winlink *wl;
struct window_pane *wp;
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
return;
wp = TAILQ_NEXT(wl->window->active, entry);
if (wp == NULL)
wp = TAILQ_FIRST(&wl->window->panes);
window_set_active_pane(wl->window, wp);
if (data->pane == -1)
wp = wl->window->active;
else {
wp = window_pane_at_index(wl->window, data->pane);
if (wp == NULL) {
ctx->error(ctx, "no pane: %d", data->pane);
return;
}
}
server_redraw_window(wl->window);
if (wp->flags & PANE_HIDDEN) {
ctx->error(ctx, "pane %d is hidden", data->pane);
return;
}
window_set_active_pane(wl->window, wp);
if (ctx->cmdclient != NULL)
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);

4
cmd.c
View File

@ -1,4 +1,4 @@
/* $Id: cmd.c,v 1.77 2009-01-14 19:41:15 nicm Exp $ */
/* $Id: cmd.c,v 1.78 2009-01-14 19:56:55 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -62,6 +62,7 @@ const struct cmd_entry *cmd_table[] = {
&cmd_respawn_window_entry,
&cmd_save_buffer_entry,
&cmd_scroll_mode_entry,
&cmd_select_pane_entry,
&cmd_select_prompt_entry,
&cmd_select_window_entry,
&cmd_send_keys_entry,
@ -79,7 +80,6 @@ const struct cmd_entry *cmd_table[] = {
&cmd_start_server_entry,
&cmd_swap_window_entry,
&cmd_switch_client_entry,
&cmd_switch_pane_entry,
&cmd_unbind_key_entry,
&cmd_unlink_window_entry,
&cmd_up_pane_entry,

View File

@ -1,4 +1,4 @@
/* $Id: key-bindings.c,v 1.47 2009-01-14 19:41:15 nicm Exp $ */
/* $Id: key-bindings.c,v 1.48 2009-01-14 19:56:55 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -102,7 +102,7 @@ key_bindings_init(void)
{ 'd', &cmd_detach_client_entry },
{ 'l', &cmd_last_window_entry },
{ 'n', &cmd_next_window_entry },
{ 'o', &cmd_switch_pane_entry },
{ 'o', &cmd_down_pane_entry },
{ 'p', &cmd_previous_window_entry },
{ 'r', &cmd_refresh_client_entry },
{ 's', &cmd_list_sessions_entry },

4
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.231 2009-01-14 19:41:15 nicm Exp $ */
/* $Id: tmux.h,v 1.232 2009-01-14 19:56:55 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -1118,6 +1118,7 @@ extern const struct cmd_entry cmd_resize_pane_up_entry;
extern const struct cmd_entry cmd_respawn_window_entry;
extern const struct cmd_entry cmd_save_buffer_entry;
extern const struct cmd_entry cmd_scroll_mode_entry;
extern const struct cmd_entry cmd_select_pane_entry;
extern const struct cmd_entry cmd_select_prompt_entry;
extern const struct cmd_entry cmd_select_window_entry;
extern const struct cmd_entry cmd_send_keys_entry;
@ -1135,7 +1136,6 @@ extern const struct cmd_entry cmd_split_window_entry;
extern const struct cmd_entry cmd_start_server_entry;
extern const struct cmd_entry cmd_swap_window_entry;
extern const struct cmd_entry cmd_switch_client_entry;
extern const struct cmd_entry cmd_switch_pane_entry;
extern const struct cmd_entry cmd_unbind_key_entry;
extern const struct cmd_entry cmd_unlink_window_entry;
extern const struct cmd_entry cmd_up_pane_entry;