mirror of
https://github.com/tmux/tmux.git
synced 2026-01-11 16:30:22 +00:00
Add new key binding ctrl-b * to create new floating pane. New panes created at increasing offsets.
This commit is contained in:
@@ -65,7 +65,8 @@ cmd_new_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
char *cause = NULL, *cp;
|
||||
struct args_value *av;
|
||||
u_int count = args_count(args);
|
||||
u_int sx, sy, pct, x, y;
|
||||
u_int x, y, sx, sy, pct;
|
||||
static u_int last_x = 0, last_y = 0;
|
||||
|
||||
if (args_has(args, 'f')) {
|
||||
sx = w->sx;
|
||||
@@ -119,8 +120,15 @@ cmd_new_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
free(cause);
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
} else
|
||||
x = 10;
|
||||
} else {
|
||||
if (last_x == 0) {
|
||||
x = 5;
|
||||
} else {
|
||||
x = (last_x += 5);
|
||||
if (last_x > w->sx)
|
||||
x = 5;
|
||||
}
|
||||
}
|
||||
if (args_has(args, 'y')) {
|
||||
y = args_strtonum_and_expand(args, 'y', 0, w->sx, item,
|
||||
&cause);
|
||||
@@ -129,11 +137,20 @@ cmd_new_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
free(cause);
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
} else
|
||||
y = 10;
|
||||
} else {
|
||||
if (last_y == 0) {
|
||||
y = 5;
|
||||
} else {
|
||||
y = (last_y += 5);
|
||||
if (last_y > w->sy)
|
||||
y = 5;
|
||||
}
|
||||
}
|
||||
|
||||
sc.xoff = x;
|
||||
sc.yoff = y;
|
||||
last_x = x;
|
||||
last_y = y;
|
||||
sc.sx = sx;
|
||||
sc.sy = sy;
|
||||
|
||||
|
||||
@@ -358,6 +358,7 @@ key_bindings_init(void)
|
||||
"bind -N 'Split window horizontally' % { split-window -h }",
|
||||
"bind -N 'Kill current window' & { confirm-before -p\"kill-window #W? (y/n)\" kill-window }",
|
||||
"bind -N 'Prompt for window index to select' \"'\" { command-prompt -T window-target -pindex { select-window -t ':%%' } }",
|
||||
"bind -N 'New floating pane' * { new-pane }",
|
||||
"bind -N 'Switch to previous client' ( { switch-client -p }",
|
||||
"bind -N 'Switch to next client' ) { switch-client -n }",
|
||||
"bind -N 'Rename current window' , { command-prompt -I'#W' { rename-window -- '%%' } }",
|
||||
|
||||
Reference in New Issue
Block a user