### lib-menu
+- [ ] remove that blank line at the end of menus
- [X] Enable lib-menu to show short-cut keys
- [X] menu-bar to which we can add menus from which commands are sent
- [ ] track movement so entry under cursor can be highlighted
{ ":A:LF", ":A:C-J" },
{ ":A:Tab", ":A:C-I" },
{ ":A:Del", ":A:C-?" },
+ { ":SPC", "- " },
};
static const char *map_key(const char *key safe)
return Efallthrough;
}
+DEF_CMD(keystroke_sequence)
+{
+ struct pane *home = ci->home;
+ const char *c = ci->str;
+ const char *e, *dash;
+ int ret;
+
+ if (!c)
+ return Enoarg;
+ while ((e = strchr(c, ' ')) != NULL) {
+ dash = "";
+ if (*c != ':' || e == c+1)
+ dash = "-";
+ ret = call("Keystroke", home, 0, NULL,
+ strconcat(home, dash,
+ strnsave(home, c, e - c)));
+ if (ret < 0)
+ return Efail;
+ c = e+1;
+ }
+ dash = "";
+ if (*c != ':' || c[1] == '\0')
+ dash = "-";
+ ret = call("Keystroke", home, 0, NULL, strconcat(home, dash, c));
+ if (ret < 0)
+ return Efail;
+ return 1;
+}
+
static int tspec_diff_ms(struct timespec *a safe, struct timespec *b safe)
{
return ((a->tv_sec - b->tv_sec) * 1000 +
return;
im_map = key_alloc();
key_add(im_map, "Keystroke", &keystroke);
+ key_add(im_map, "Keystroke-sequence", &keystroke_sequence);
key_add(im_map, "Mouse-event", &mouse_event);
key_add(im_map, "Mouse-grab", &mouse_grab);
key_add(im_map, "Mode:set-mode", &set_mode);
{
struct pane *home = ci->home;
struct mbinfo *mbi = home->data;
- char *dash;
- const char *c, *e;
if (mbi->child)
pane_focus(mbi->child);
- if (!ci->str)
- /* Abort ?? */
- return 1;
- c = ci->str;
- while ((e = strchr(c, ' ')) != NULL) {
- int ret;
-
- dash = "";
- if (*c != ':' || e == c+1)
- dash = "-";
- ret = call("Keystroke", home, 0, NULL,
- strconcat(home, dash,
- strnsave(home, c, e - c)));
- if (ret < 0)
- return Efail;
- c = e+1;
- }
- dash = "";
- if (*c != ':' || c[1] == '\0')
- dash = "-";
- return call("Keystroke", home, 0, NULL,
- strconcat(home, dash, c));
+ call("Keystroke-sequence", home, 0, NULL, ci->str);
+ return 1;
}
DEF_CMD(menubar_root)
DEF_CMD(emacs_selection_menu_action)
{
struct pane *home = ci->home;
- char *dash;
- const char *e;
const char *c = ci->str;
if (!c)
return 1;
}
- while ((e = strchr(c, ' ')) != NULL) {
- int ret;
-
- dash = "";
- if (*c != ':' || e == c+1)
- dash = "-";
- ret = call("Keystroke", home, 0, NULL,
- strconcat(home, dash,
- strnsave(home, c, e - c)));
- if (ret < 0)
- return Efail;
- c = e+1;
- }
- dash = "";
- if (*c != ':' || c[1] == '\0')
- dash = "-";
- call("Keystroke", home, 0, NULL, strconcat(home, dash, c));
+ call("Keystroke-sequence", home, 0, NULL, c);
return 1;
}