summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorBert Münnich <ber.t@gmx.com>2011-10-16 16:08:55 +0200
committerBert Münnich <ber.t@gmx.com>2011-10-16 16:08:55 +0200
commitdc727b8dce89811d755ed03d11688b13a42e794a (patch)
tree09b19fc4cff7b12c1ae2ef6ff626175f1a4674ad /main.c
parent960026d600d3824832dc83f925962f2d2d5839d7 (diff)
downloadnsxiv-dc727b8dce89811d755ed03d11688b13a42e794a.tar.zst
Added support for number prefix for commands
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/main.c b/main.c
index 719a61c..1d73283 100644
--- a/main.c
+++ b/main.c
@@ -63,6 +63,8 @@ fileinfo_t *files;
int filecnt, fileidx;
size_t filesize;
+int prefix;
+
char win_title[TITLE_LEN];
timeout_t timeouts[] = {
@@ -335,10 +337,17 @@ void on_keypress(XKeyEvent *kev) {
XLookupString(kev, &key, 1, &ksym, NULL);
+ if (key >= '0' && key <= '9' && (kev->state & ControlMask) == 0) {
+ /* number prefix for commands */
+ prefix = prefix * 10 + (int) (key - '0');
+ return;
+ }
+
for (i = 0; i < ARRLEN(keys); i++) {
if (keys[i].ksym == ksym && keymask(&keys[i], kev->state)) {
if (keys[i].cmd != NULL && keys[i].cmd(keys[i].arg))
redraw();
+ prefix = 0;
return;
}
}