1
0
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:
Witold Filipczyk 2022-11-22 16:41:41 +01:00
parent 294732babc
commit 4d1d4f173d

View File

@ -112,8 +112,7 @@ exmode_exec(struct session *ses, char buffer[INPUT_LINE_BUFFER_SIZE])
void void
try_exmode_exec(struct session *ses, const char *val) try_exmode_exec(struct session *ses, const char *val)
{ {
char *command; char *next;
char *args;
struct string res; struct string res;
struct string inp; struct string inp;
struct string what = INIT_STRING("\\\"", 2); struct string what = INIT_STRING("\\\"", 2);
@ -128,25 +127,44 @@ try_exmode_exec(struct session *ses, const char *val)
} }
add_to_string(&inp, val); add_to_string(&inp, val);
string_replace(&res, &inp, &what, &replace); string_replace(&res, &inp, &what, &replace);
next = res.source;
command = res.source; while (1) {
args = command; char *command, *args;
int i;
while (*command == ':') command++; command = args = next;
if (!*command) { while (*command == ':') command++;
goto out;
}
skip_nonspace(args); if (!*command) {
if (*args) *args++ = 0;
for (i = 0; exmode_handlers[i]; i++) {
if (exmode_handlers[i](ses, command, args))
break; break;
}
while (*args && !isspace((unsigned char)(*args)) && *args != ';') args++;
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(&inp);
done_string(&res); done_string(&res);
} }