Skip to content
Permalink
Browse files

Modify prefix input to require a .. prefix key (Escape).

This frees up keys 0-9 for keyhandler use.

Example of usage:

Escape 1 0 0 Right  -> navigate 100 items forward in the image list.
  • Loading branch information...
0ion9 committed Jan 18, 2015
1 parent eb40f17 commit 104b4f6d32617f1ee87cb8cda7a629b4294eea29
Showing with 11 additions and 2 deletions.
  1. +11 −2 main.c
13 main.c
@@ -78,6 +78,7 @@ int markcnt;

int prefix;
bool extprefix;
bool inputting_prefix;

bool resized = false;

@@ -736,8 +737,14 @@ void on_keypress(XKeyEvent *kev)

if (IsModifierKey(ksym))
return;
if ((ksym == XK_Escape && MODMASK(kev->state) == 0) ||
(key >= '0' && key <= '9'))

if (ksym == XK_Escape && MODMASK(kev->state) == 0){
inputting_prefix = true;
prefix = 0;
return;
}

if ((inputting_prefix == true) && (key >= '0' && key <= '9'))
{
/* number prefix for commands */
prefix = prefix * 10 + (int) (key - '0');
@@ -760,6 +767,7 @@ void on_keypress(XKeyEvent *kev)
redraw();

prefix = 0;
inputting_prefix = 0;
}

void on_buttonpress(XButtonEvent *bev)
@@ -808,6 +816,7 @@ void on_buttonpress(XButtonEvent *bev)
}
}
break;
case Button2:
case Button3:
if ((sel = tns_translate(&tns, bev->x, bev->y)) >= 0) {
files[sel].flags ^= FF_MARK;

0 comments on commit 104b4f6

Please sign in to comment.
You can’t perform that action at this time.