|
@@ -30,7 +30,8 @@ struct app_kbd {
|
|
|
enum keybind_dir dir;
|
|
enum keybind_dir dir;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-HT_DEF_STRUCT(struct app_kbd, app_kbd_ht);
|
|
|
|
|
|
|
+HT_DEF_STRUCT(struct app_kbd, km);
|
|
|
|
|
+HT_DEF_STRUCT(struct km, km_ht);
|
|
|
|
|
|
|
|
struct app {
|
|
struct app {
|
|
|
struct window win;
|
|
struct window win;
|
|
@@ -49,7 +50,8 @@ struct app {
|
|
|
bool show_fps;
|
|
bool show_fps;
|
|
|
struct free_glyph_atlas *fga;
|
|
struct free_glyph_atlas *fga;
|
|
|
struct cursor_render *cr;
|
|
struct cursor_render *cr;
|
|
|
- struct app_kbd_ht *ckm;
|
|
|
|
|
|
|
+ struct km *ckm;
|
|
|
|
|
+ struct km_ht km_ht;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
#include "free_glyph.h"
|
|
#include "free_glyph.h"
|
|
@@ -117,8 +119,16 @@ app_create(const char *win_title)
|
|
|
.target_fps = 120,
|
|
.target_fps = 120,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- HT_CREATE(*app.ckm, 16);
|
|
|
|
|
- app.ckm->hash = ht_hash_nop;
|
|
|
|
|
|
|
+ HT_CREATE(app.km_ht, 4);
|
|
|
|
|
+ app.km_ht.hash = ht_hash_nop;
|
|
|
|
|
+
|
|
|
|
|
+ struct km t = {0};
|
|
|
|
|
+ HT_CREATE(t, 16);
|
|
|
|
|
+ t.hash = ht_hash_nop;
|
|
|
|
|
+
|
|
|
|
|
+ HT_ISET(app.km_ht, 1, t);
|
|
|
|
|
+ HT_IGET_PTR(app.km_ht, 1, app.ckm);
|
|
|
|
|
+
|
|
|
DA_CREATE(app.bufs);
|
|
DA_CREATE(app.bufs);
|
|
|
DA_APPEND(app.bufs, buffer_create());
|
|
DA_APPEND(app.bufs, buffer_create());
|
|
|
app.cbuf = &app.bufs.items[0];
|
|
app.cbuf = &app.bufs.items[0];
|
|
@@ -382,6 +392,7 @@ app_add_global_keybind(struct app *app, const char *keybind,
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /* Permit prefix keybind like C-x b */
|
|
|
struct str_da words = str_split(kbd_str, ' ');
|
|
struct str_da words = str_split(kbd_str, ' ');
|
|
|
IF_GOTO(words.size != 1, invalid_key);
|
|
IF_GOTO(words.size != 1, invalid_key);
|
|
|
/* for */ {
|
|
/* for */ {
|