aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p@janouch.name>2018-10-25 17:39:14 +0200
committerPřemysl Janouch <p@janouch.name>2018-10-25 23:05:33 +0200
commit2484c94b39d6f5bee378171abfed3f57ae3dd8b4 (patch)
tree7cb269f6b1ba1311b141c6b1d4eae5137c9ae9e9
parent6e34f480a917a9984afee64eae4dbefe2fd3cbcb (diff)
downloadsdn-2484c94b39d6f5bee378171abfed3f57ae3dd8b4.tar.gz
sdn-2484c94b39d6f5bee378171abfed3f57ae3dd8b4.tar.xz
sdn-2484c94b39d6f5bee378171abfed3f57ae3dd8b4.zip
Fix key binding collisions
Still not fixed in handle_editor() though.
-rw-r--r--sdn.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/sdn.cpp b/sdn.cpp
index 47c10d1..3d94b54 100644
--- a/sdn.cpp
+++ b/sdn.cpp
@@ -620,7 +620,7 @@ fun handle (wint_t c, bool is_char) -> bool {
}
// Translate the Alt key into a bit outside the range of Unicode
- enum { ALT = 1 << 24 };
+ enum { ALT = 1 << 24, SYM = 1 << 25 };
if (c == 27) {
if (get_wch (&c) == ERR) {
beep ();
@@ -628,16 +628,18 @@ fun handle (wint_t c, bool is_char) -> bool {
}
c |= ALT;
}
+ if (!is_char)
+ c |= SYM;
const auto &current = g.entries[g.cursor];
switch (c) {
case ALT | L'\r':
- case ALT | KEY_ENTER:
+ case ALT | SYM | KEY_ENTER:
g.chosen_full = true;
g.chosen = current.filename;
return false;
case L'\r':
- case KEY_ENTER:
+ case SYM | KEY_ENTER:
if (choose (current))
break;
return false;
@@ -647,21 +649,21 @@ fun handle (wint_t c, bool is_char) -> bool {
case L'q':
return false;
- case L'k': case CTRL L'p': case KEY_UP:
+ case L'k': case CTRL L'p': case SYM | KEY_UP:
g.cursor--;
break;
- case L'j': case CTRL L'n': case KEY_DOWN:
+ case L'j': case CTRL L'n': case SYM | KEY_DOWN:
g.cursor++;
break;
- case L'g': case ALT | L'<': case KEY_HOME:
+ case L'g': case ALT | L'<': case SYM | KEY_HOME:
g.cursor = 0;
break;
- case L'G': case ALT | L'>': case KEY_END:
+ case L'G': case ALT | L'>': case SYM | KEY_END:
g.cursor = int (g.entries.size ()) - 1;
break;
- case KEY_PPAGE: g.cursor -= LINES; break;
- case KEY_NPAGE: g.cursor += LINES; break;
+ case SYM | KEY_PPAGE: g.cursor -= LINES; break;
+ case SYM | KEY_NPAGE: g.cursor += LINES; break;
case CTRL L'e': g.offset++; break;
case CTRL L'y': g.offset--; break;
@@ -698,7 +700,7 @@ fun handle (wint_t c, bool is_char) -> bool {
case L'r':
reload ();
break;
- case KEY_RESIZE:
+ case SYM | KEY_RESIZE:
case WEOF:
break;
default: