mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-23 08:33:17 +01:00
new-window -k.
This commit is contained in:
parent
19987feaaa
commit
9acc26711d
3
CHANGES
3
CHANGES
@ -1,5 +1,6 @@
|
||||
21 January 2009
|
||||
|
||||
* new-window now supports -k to kill target window if it exists.
|
||||
* Bring back split-window -p and -l options to specify the height a percentage
|
||||
or as a number of lines.
|
||||
* Make window and session choice modes allow you to choose items in vi keys
|
||||
@ -994,7 +995,7 @@
|
||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||
customisation.
|
||||
|
||||
$Id: CHANGES,v 1.228 2009-01-21 19:38:51 nicm Exp $
|
||||
$Id: CHANGES,v 1.229 2009-01-21 22:21:49 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 ms
|
||||
|
3
TODO
3
TODO
@ -78,7 +78,6 @@
|
||||
- command: load-buffer -b number filename
|
||||
- command: copy-buffer -s src-session -t dst-session -a src-index -b dst-index
|
||||
(copy from other session)
|
||||
- neww should support -k
|
||||
- flag to scroll-mode/copy-mode to automatically scroll up a page
|
||||
- key to switch to copy mode from scroll mode
|
||||
- document suspend-client
|
||||
@ -87,3 +86,5 @@
|
||||
- document split-window -p and -l
|
||||
- UTF-8 combining characters don't work (probably should be width 1 but are
|
||||
listed as 2)
|
||||
- better error reporting from session_new etc
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-new-window.c,v 1.29 2009-01-19 18:23:40 nicm Exp $ */
|
||||
/* $Id: cmd-new-window.c,v 1.30 2009-01-21 22:21:49 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -39,11 +39,12 @@ struct cmd_new_window_data {
|
||||
char *name;
|
||||
char *cmd;
|
||||
int flag_detached;
|
||||
int flag_kill;
|
||||
};
|
||||
|
||||
const struct cmd_entry cmd_new_window_entry = {
|
||||
"new-window", "neww",
|
||||
"[-d] [-n window-name] [-t target-window] [command]",
|
||||
"[-dk] [-n window-name] [-t target-window] [command]",
|
||||
0,
|
||||
cmd_new_window_init,
|
||||
cmd_new_window_parse,
|
||||
@ -64,6 +65,7 @@ cmd_new_window_init(struct cmd *self, unused int arg)
|
||||
data->name = NULL;
|
||||
data->cmd = NULL;
|
||||
data->flag_detached = 0;
|
||||
data->flag_kill = 0;
|
||||
}
|
||||
|
||||
int
|
||||
@ -75,11 +77,14 @@ cmd_new_window_parse(struct cmd *self, int argc, char **argv, char **cause)
|
||||
self->entry->init(self, 0);
|
||||
data = self->data;
|
||||
|
||||
while ((opt = getopt(argc, argv, "dt:n:")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "dkt:n:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
data->flag_detached = 1;
|
||||
break;
|
||||
case 'k':
|
||||
data->flag_kill = 1;
|
||||
break;
|
||||
case 't':
|
||||
if (data->target == NULL)
|
||||
data->target = xstrdup(optarg);
|
||||
@ -134,6 +139,27 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
wl = NULL;
|
||||
if (idx != -1)
|
||||
wl = winlink_find_by_index(&s->windows, idx);
|
||||
if (wl != NULL) {
|
||||
if (data->flag_kill) {
|
||||
/*
|
||||
* Can't use session_detach as it will destroy session
|
||||
* if this makes it empty.
|
||||
*/
|
||||
session_alert_cancel(s, wl);
|
||||
winlink_stack_remove(&s->lastw, wl);
|
||||
winlink_remove(&s->windows, wl);
|
||||
|
||||
/* Force select/redraw if current. */
|
||||
if (wl == s->curw) {
|
||||
data->flag_detached = 0;
|
||||
s->curw = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cmd = data->cmd;
|
||||
if (cmd == NULL)
|
||||
cmd = options_get_string(&s->options, "default-command");
|
||||
|
Loading…
Reference in New Issue
Block a user