mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 03:08:46 +00:00
Support "neww; neww" as well "neww ; neww".
This commit is contained in:
parent
044e6f7660
commit
827fac4c0b
5
CHANGES
5
CHANGES
@ -1,5 +1,8 @@
|
||||
30 April 2009
|
||||
|
||||
* Support command sequences without a space before the semicolon, for example
|
||||
"neww; neww" now works as well as "neww ; neww". "neww;neww" is still an
|
||||
error.
|
||||
* previous-layout command.
|
||||
* Display the layout name in window lists.
|
||||
* Merge resize-pane-up and resize-pane-down into resize-pane with -U and -D
|
||||
@ -1236,7 +1239,7 @@
|
||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||
customisation.
|
||||
|
||||
$Id: CHANGES,v 1.281 2009-04-30 21:17:06 nicm Exp $
|
||||
$Id: CHANGES,v 1.282 2009-04-30 21:53:32 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
|
||||
|
45
cmd-list.c
45
cmd-list.c
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-list.c,v 1.3 2009-02-16 18:57:16 nicm Exp $ */
|
||||
/* $Id: cmd-list.c,v 1.4 2009-04-30 21:53:32 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -28,28 +28,43 @@ cmd_list_parse(int argc, char **argv, char **cause)
|
||||
struct cmd_list *cmdlist;
|
||||
struct cmd *cmd;
|
||||
int i, lastsplit;
|
||||
size_t arglen, new_argc;
|
||||
char **new_argv;
|
||||
|
||||
cmdlist = xmalloc(sizeof *cmdlist);
|
||||
TAILQ_INIT(cmdlist);
|
||||
|
||||
lastsplit = 0;
|
||||
for (i = 0; i < argc; i++) {
|
||||
if (strcmp(argv[i], "\\;") == 0) {
|
||||
argv[i][0] = ';';
|
||||
argv[i][1] = '\0';
|
||||
} else if (strcmp(argv[i], ";") == 0) {
|
||||
cmd = cmd_parse(i - lastsplit, argv + lastsplit, cause);
|
||||
if (cmd == NULL)
|
||||
goto bad;
|
||||
TAILQ_INSERT_TAIL(cmdlist, cmd, qentry);
|
||||
lastsplit = i + 1;
|
||||
}
|
||||
arglen = strlen(argv[i]);
|
||||
if (arglen == 0 || argv[i][arglen - 1] != ';')
|
||||
continue;
|
||||
argv[i][arglen - 1] = '\0';
|
||||
|
||||
if (arglen > 1 && argv[i][arglen - 2] == '\\') {
|
||||
argv[i][arglen - 2] = ';';
|
||||
continue;
|
||||
}
|
||||
|
||||
new_argc = i - lastsplit;
|
||||
new_argv = argv + lastsplit;
|
||||
if (arglen != 1)
|
||||
new_argc++;
|
||||
|
||||
cmd = cmd_parse(new_argc, new_argv, cause);
|
||||
if (cmd == NULL)
|
||||
goto bad;
|
||||
TAILQ_INSERT_TAIL(cmdlist, cmd, qentry);
|
||||
|
||||
lastsplit = i + 1;
|
||||
}
|
||||
|
||||
cmd = cmd_parse(argc - lastsplit, argv + lastsplit, cause);
|
||||
if (cmd == NULL)
|
||||
goto bad;
|
||||
TAILQ_INSERT_TAIL(cmdlist, cmd, qentry);
|
||||
if (lastsplit != argc) {
|
||||
cmd = cmd_parse(argc - lastsplit, argv + lastsplit, cause);
|
||||
if (cmd == NULL)
|
||||
goto bad;
|
||||
TAILQ_INSERT_TAIL(cmdlist, cmd, qentry);
|
||||
}
|
||||
|
||||
return (cmdlist);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user