}
time_ends(ci->home);
if (ret <= Efail)
- call("Message:default", ci->focus, 0, NULL,
- "** Command Failed **");
+ call("Message:default", p, 0, NULL,
+ strconcat(ci->home, "** Command ", key, " Failed **"));
+ else if (ret == Efallthrough) {
+ key = strconcat(ci->home, "K", mode, ci->str);
+ call("Message:modal", p, 0, NULL,
+ strconcat(ci->home, "** Command ", key, " not known **"));
+ }
return Efallthrough;
}
return Efail;
c = e+1;
}
+ if (!*c)
+ return 1;
dash = "";
if (*c != ':' || c[1] == '\0')
dash = "-";
return 1;
}
+DEF_CMD(input_cancel)
+{
+ /* Other handlers fall-through. We catch so that
+ * it doesn't appear to be ignored
+ */
+ return 1;
+}
+
DEF_CMD(refocus)
{
struct input_mode *im = ci->home->data;
key_add(im_map, "Notify:Close", &close_focus);
key_add(im_map, "input:log", &log_input);
key_add(im_map, "Close", &input_close);
+
+ key_add(im_map, "Cancel", &input_cancel);
+ key_add(im_map, "Abort", &input_cancel);
}
DEF_LOOKUP_CMD(input_handle, im_map);
ret = call(mv->type, ci->focus, mv->direction * RPT_NUM(ci), ci->mark,
NULL, mv->extra);
- if (ret <= 0)
+ if (ret < 0)
return ret;
if (strcmp(mv->type, "Move-View") == 0)
/* Discard a transient selection */
clear_selection(ci->focus, NULL, mk, 2);
- return ret;
+ return 1;
}
REDEF_CMD(emacs_delete)
{
struct move_command *mv = container_of(ci->comm, struct move_command, cmd);
- int ret = 0;
+ int ret;
struct mark *m, *mk;
if (!ci->mark)
ret = call(mv->type, ci->focus, mv->direction * RPT_NUM(ci), m);
- if (ret <= 0) {
+ if (ret < 0) {
mark_free(m);
return ret;
}
mark_free(m);
call("Mode:set-num2", ci->focus, N2_undo_delete);
- return ret;
+ return 1;
}
REDEF_CMD(emacs_kill)
{
/* Like delete, but copy to copy-buffer */
struct move_command *mv = container_of(ci->comm, struct move_command, cmd);
- int ret = 0;
+ int ret;
struct mark *m;
char *str;
else
ret = call(mv->type, ci->focus, mv->direction * RPT_NUM(ci), m);
- if (ret <= 0) {
+ if (ret < 0) {
mark_free(m);
return ret;
}
mark_free(m);
call("Mode:set-num2", ci->focus, N2_undo_delete);
- return ret;
+ return 1;
}
REDEF_CMD(emacs_case)
{
struct move_command *mv = container_of(ci->comm, struct move_command, cmd);
- int ret = 0;
+ int ret;
struct mark *start = NULL;
int cnt = mv->direction * RPT_NUM(ci);
int dir;
mark_to_mark(ci->mark, start);
mark_free(start);
}
- return ret;
+ return 1;
}
REDEF_CMD(emacs_swap)
* previous objects. Object is determined by mv->type.
*/
struct move_command *mv = container_of(ci->comm, struct move_command, cmd);
- int ret = 0;
struct mark *start = NULL;
int cnt = mv->direction * RPT_NUM(ci);
int dir;
mark_to_mark(ci->mark, start);
mark_free(start);
}
- return ret;
+ return 1;
}
DEF_CMD(emacs_move_view_other)
return Efail;
}
attr_set_str(&p->attrs, "done-key", "emacs:deactivate");
- return call("docs:show-modified", p);
+ call("docs:show-modified", p);
+ return 1;
} else
call("event:deactivate", ci->focus);
return 1;
ret = call(dc, ci->focus, ci->num, ci->mark, NULL, !first);
call("Mode:set-num2", ci->focus, N2_undo_insert);
- return ret;
+ return ret < 0 ? ret : 1;
}
DEF_CMD(emacs_quote_insert)
ret = call("Replace", ci->focus, 1, ci->mark, str, !first);
call("Mode:set-num2", ci->focus, N2_undo_insert);
- return ret;
+ return ret < 0 ? ret : 1;
}
static struct {
}
/* A newline starts a new undo */
call("Mode:set-num2", ci->focus, (*ins == '\n') ? 0 : N2_undo_insert);
- return ret;
+ return ret < 0 ? ret : 1;
}
DEF_CMD(emacs_interactive_insert)
!first);
call("Mode:set-num2", ci->focus,
strchr(ci->str, '\n') ? 0 : N2_undo_insert);
- return ret;
+ return ret < 0 ? ret : 1;
}
DEF_CMD(emacs_interactive_delete)
N2(ci) == N2_undo_insert, ci->mark2);
call("Mode:set-num2", ci->focus,
strchr(ci->str, '\n') ? 0 : N2_undo_delete);
- return ret;
+ return ret < 0 ? ret : 1;
}
DEF_CMD(emacs_undo)
return 1;
}
ret = call("popup:close", ci->focus, 0, NULL, norm ?: str);
- return ret;
+ return ret < 0 ? ret : 1;
}
struct find_helper {