mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[exmode] ; is delimiter for macro commands . Refs #196
For example: set macro.0 = "set ui.show_title_bar = 0;set ui.show_status_bar = 0;redraw"
This commit is contained in:
parent
294732babc
commit
4d1d4f173d
@ -112,8 +112,7 @@ exmode_exec(struct session *ses, char buffer[INPUT_LINE_BUFFER_SIZE])
|
||||
void
|
||||
try_exmode_exec(struct session *ses, const char *val)
|
||||
{
|
||||
char *command;
|
||||
char *args;
|
||||
char *next;
|
||||
struct string res;
|
||||
struct string inp;
|
||||
struct string what = INIT_STRING("\\\"", 2);
|
||||
@ -128,25 +127,44 @@ try_exmode_exec(struct session *ses, const char *val)
|
||||
}
|
||||
add_to_string(&inp, val);
|
||||
string_replace(&res, &inp, &what, &replace);
|
||||
next = res.source;
|
||||
|
||||
command = res.source;
|
||||
args = command;
|
||||
int i;
|
||||
while (1) {
|
||||
char *command, *args;
|
||||
|
||||
command = args = next;
|
||||
|
||||
while (*command == ':') command++;
|
||||
|
||||
if (!*command) {
|
||||
goto out;
|
||||
break;
|
||||
}
|
||||
|
||||
skip_nonspace(args);
|
||||
if (*args) *args++ = 0;
|
||||
while (*args && !isspace((unsigned char)(*args)) && *args != ';') args++;
|
||||
|
||||
for (i = 0; exmode_handlers[i]; i++) {
|
||||
if (*args == ';') {
|
||||
*args = 0;
|
||||
next = args + 1;
|
||||
} else {
|
||||
if (*args) *args++ = 0;
|
||||
next = args;
|
||||
|
||||
for (int quote = 0; *next; next++) {
|
||||
if (*next == '"') {
|
||||
quote = !quote;
|
||||
continue;
|
||||
}
|
||||
if (*next == ';' && !quote) {
|
||||
*next++ = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; exmode_handlers[i]; i++) {
|
||||
if (exmode_handlers[i](ses, command, args))
|
||||
break;
|
||||
}
|
||||
out:
|
||||
}
|
||||
done_string(&inp);
|
||||
done_string(&res);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user