--- Heyhey With this solution to the problem we end up copying all command names which I do not like. A better approach would probably be to use function pointer *func of struct KeyBinding for ZZ/ZQ to just exit the editor (with or without saving) instead of using cmd -> exec_command -> exec_cmdline_command. What is the list's opinion on this? Is there another, simpler way to work around this issue that I am not seeing? Cheers, Silvan vis.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vis.c b/vis.c index 7dd6f06..f1a0d48 100644 --- a/vis.c +++ b/vis.c _AT_@ -1774,7 +1774,8 @@ static bool exec_cmdline_command(char *line) { /* skip leading white space */ while (*name == ' ') name++; - char *param = name; + char *nametosearch = strndup(name, 64); + char *param = nametosearch; while (*param && *param != ' ') { if (*param == '!') { opt |= CMD_OPT_FORCE; _AT_@ -1785,9 +1786,10 @@ static bool exec_cmdline_command(char *line) { if (*param) *param++ = '\0'; /* truncate by overwriting ' ' or '!' */ - Command *cmd = map_closest(cmdmap, name); + Command *cmd = map_closest(cmdmap, nametosearch); if (!cmd) { editor_info_show(vis, "Not an editor command"); + free(nametosearch); return false; } _AT_@ -1817,6 +1819,7 @@ static bool exec_cmdline_command(char *line) { } cmd->cmd(&range, opt, argv); + free(nametosearch); return true; } -- 2.3.4Received on Sat Mar 28 2015 - 16:54:13 CET
This archive was generated by hypermail 2.3.0 : Sat Mar 28 2015 - 17:00:10 CET