DEF_CMD(search_insert_quoted)
{
- if (strchr(must_quote, ci->key[4]) == NULL)
+ const char *suffix = ksuffix(ci, "Chr-");
+ if (strchr(must_quote, suffix[0]) == NULL)
return 0;
call("Replace", ci->focus, 1, NULL, "\\");
call("Replace", ci->focus, 1, NULL, ksuffix(ci, "Chr-"),
char *bracket;
const char *brackets = "{}()[]";
const char *k = ksuffix(ci, "M-Chr-");
- if (strchr(may_quote, ci->key[6])) {
+ if (strchr(may_quote, *k)) {
call("Replace", ci->focus, 1, NULL, "\\");
call("Replace", ci->focus, 1, NULL, k,
1, NULL, ",auto=1");
return 1;
}
- if (strchr(must_quote, ci->key[6]) == NULL || !ci->mark)
+ if (strchr(must_quote, *k) == NULL || !ci->mark)
return 0;
- bracket = strchr(brackets, ci->key[6]);
+ bracket = strchr(brackets, *k);
if (!bracket) {
call("Replace", ci->focus, 1, NULL, k);
} else if ((bracket - brackets) % 2) {
esi->replace_pane = p;
if (p)
home_call(esi->target, "highlight:set-popup", p, 1);
- if (ci->key[6] == '%')
+ if (strcmp(ci->key, "M-Chr-%") == 0)
pane_focus(ci->focus);
else
pane_focus(p);
struct history_info *hi = ci->home->data;
struct mark *m;
char *l, *e;
+ const char *suffix = ksuffix(ci, "M-Chr-");
if (!hi->history || !ci->mark)
return 0;
- if (ci->key[6] == 'p') {
+ if (*suffix == 'p') {
m = mark_at_point(hi->history, NULL, MARK_UNGROUPED);
call("Move-EOL", hi->history, -2);
} else {
if (!l || !*l) {
/* No more history */
free(l);
- if (ci->key[6] == 'p') {
+ if (*suffix == 'p') {
mark_free(m);
return 1;
} else
attr_set_str(&p->attrs, "prompt", "Search");
attr_set_str(&p->attrs, "done-key", "Search String");
call("doc:set-name", p, 0, NULL, "Search", -1);
- if (ci->key[6] == 'R')
+ if (strcmp(ci->key, "C-Chr-R") == 0)
mode |= 1;
- if (ci->key[6] == '%')
+ if (strcmp(ci->key, "M-Chr-%") == 0)
mode |= 2;
call_ret(pane, "attach-emacs-search", p, mode);