{
struct ed_info *ei = ci->home->data;
struct map *map = ei->map;
+ bool prefix = strcmp(ci->key, "global-set-command-prefix") == 0;
if (!ci->str)
return Enoarg;
- if (ci->str2)
+ if (prefix) {
+ char *e = strconcat(NULL, ci->str, "\xFF\xFF\xFF\xFF");
+ key_add_range(map, ci->str, e, ci->comm2);
+ free(e);
+ } else if (ci->str2)
key_add_range(map, ci->str, ci->str2, ci->comm2);
else
key_add(map, ci->str, ci->comm2);
ed_map = key_alloc();
key_add(ed_map, "global-set-attr", &global_set_attr);
key_add(ed_map, "global-set-command", &global_set_command);
+ key_add(ed_map, "global-set-command-prefix", &global_set_command);
key_add(ed_map, "global-get-command", &global_get_command);
key_add(ed_map, "global-load-module", &editor_load_module);
key_add(ed_map, "global-config-dir", &global_config_dir);
{
struct docs *docs = ci->home->data;
- call_comm("global-set-command", ci->home, &edlib_noop,
- 0, NULL, "docs:",
- 0, NULL, "docs;");
+ call_comm("global-set-command-prefix", ci->home, &edlib_noop,
+ 0, NULL, "docs:");
call_comm("global-set-command", ci->home, &edlib_noop,
0, NULL, "doc:appeared-docs-register");
pane_close(docs->collection);
doc->collection = paux;
doc->callback = docs_callback_lookup;
- call_comm("global-set-command", ci->home, &doc->callback,
- 0, NULL, "docs:",
- 0, NULL, "docs;");
+ call_comm("global-set-command-prefix", ci->home, &doc->callback,
+ 0, NULL, "docs:");
call_comm("global-set-command", ci->home, &doc->callback,
0, NULL, "doc:appeared-docs-register");
call_comm("global-set-command", ed, &spell_save,
0, NULL, "Spell:Save");
- call_comm("global-set-command", ed, &spell_dict,
- 0, NULL, "interactive-cmd-dict-",
- 0, NULL, "interactive-cmd-dict-~");
+ call_comm("global-set-command-prefix", ed, &spell_dict,
+ 0, NULL, "interactive-cmd-dict-");
aspell_map = key_alloc();
key_add(aspell_map, "Close", &aspell_close);
/* No doc:content-bytes - that wouldn't make sense */
/* Use 1251 for any unknown 'windows' charset */
- call_comm("global-set-command", ed, &win1251_attach, 0, NULL,
- "attach-charset-windows-", 0, NULL,
- "attach-charset-windows.");
- call_comm("global-set-command", ed, &win1251_to_utf8, 0, NULL,
- "charset-to-utf8-windows-", 0, NULL,
- "charset-to-utf8-windows.");
+ call_comm("global-set-command-prefix", ed, &win1251_attach,
+ 0, NULL, "attach-charset-windows-");
+ call_comm("global-set-command-prefix", ed, &win1251_to_utf8,
+ 0, NULL, "charset-to-utf8-windows-");
call_comm("global-set-command", ed, &win1252_attach, 0, NULL,
"attach-charset-windows-1252");
"charset-to-utf8-windows-1252");
/* Use iso-8859-15 for any unknown iso-8859, and for ascii */
- call_comm("global-set-command", ed, &iso8859_15_attach, 0, NULL,
- "attach-charset-iso-8859-", 0, NULL,
- "attach-charset-iso-8859.");
- call_comm("global-set-command", ed, &iso8859_15_to_utf8, 0, NULL,
- "charset-to-utf8-iso-8859-", 0, NULL,
- "charset-to-utf8-iso-8859.");
+ call_comm("global-set-command-prefix", ed, &iso8859_15_attach,
+ 0, NULL, "attach-charset-iso-8859-");
+ call_comm("global-set-command-prefix", ed, &iso8859_15_to_utf8,
+ 0, NULL, "charset-to-utf8-iso-8859-");
call_comm("global-set-command", ed, &iso8859_15_attach, 0, NULL,
"attach-charset-us-ascii");
void edlib_init(struct pane *ed safe)
{
call_comm("global-set-command", ed, &colour_map,
- 0, NULL, "colour:map",
- 0, NULL, "colour:map;");
+ 0, NULL, "colour:map");
+ call_comm("global-set-command-prefix", ed, &colour_map,
+ 0, NULL, "colour:map:");
}