aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2020-10-31 20:26:33 +0100
committerMarvin Borner2020-10-31 20:26:33 +0100
commit05901d834ec72ac753ba5d16057f907a5aa38fbc (patch)
tree24d7feccc237ba7eb1181941653173af7c0eba90
parent19af2060005aa93b74de3438224f52dd73cabdd3 (diff)
Fixed space handling in keymap parser
-rw-r--r--libc/inc/input.h6
-rw-r--r--libtxt/keymap.c6
-rw-r--r--res/keymaps/en.keymap6
3 files changed, 12 insertions, 6 deletions
diff --git a/libc/inc/input.h b/libc/inc/input.h
index 04a0301..5fc7ed1 100644
--- a/libc/inc/input.h
+++ b/libc/inc/input.h
@@ -270,9 +270,9 @@
#define KEY_NUMERIC(code) ((code) >= KEY_1 && (code) <= KEY_0)
#define KEY_ALPHABETIC(code) \
- ((code) >= KEY_Q && (code) <= KEY_P) || ((code) >= KEY_A && (code) <= KEY_L) || \
- ((code) >= KEY_Z && (code) <= KEY_M)
-#define KEY_ALPHANUMERIC(code) KEY_NUMERIC((code)) || KEY_ALPHABETIC((code))
+ (((code) >= KEY_Q && (code) <= KEY_P) || ((code) >= KEY_A && (code) <= KEY_L) || \
+ ((code) >= KEY_Z && (code) <= KEY_M))
+#define KEY_ALPHANUMERIC(code) (KEY_NUMERIC((code)) || KEY_ALPHABETIC((code)))
typedef int fortytwo;
diff --git a/libtxt/keymap.c b/libtxt/keymap.c
index 70af4fa..ae2ab02 100644
--- a/libtxt/keymap.c
+++ b/libtxt/keymap.c
@@ -54,6 +54,9 @@ struct keymap *keymap_parse(const char *path)
}
skip = 0;
+ if (ch == ' ' && !escaped)
+ ch = 0;
+
ch_index++;
if (escaped) {
switch (ch) {
@@ -69,6 +72,9 @@ struct keymap *keymap_parse(const char *path)
case '\\':
ch = '\\';
break;
+ case ' ':
+ ch = ' ';
+ break;
default:
print("Unknown escape!\n");
}
diff --git a/res/keymaps/en.keymap b/res/keymaps/en.keymap
index fa31c30..02c8811 100644
--- a/res/keymaps/en.keymap
+++ b/res/keymaps/en.keymap
@@ -1,3 +1,3 @@
- 1 2 3 4 5 6 7 8 9 0 - = \b \t q w e r t y u i o p [ ] \n a s d f g h j k l ; ' ` \\ z x c v b n m , . / * 7 8 9 - 4 5 6 + 1 2 3 0 . \\
- ! @ # $ % ^ & * ( ) _ + \b \t Q W E R T Y U I O P { } \n A S D F G H J K L : " ~ | Z X C V B N M < > ? * 7 8 9 - 4 5 6 + 1 2 3 0 . |
- 1 2 3 4 5 6 7 8 9 0 - = \b \t q w e r t y u i o p [ ] \n a s d f g h j k l ; ' ` \\ z x c v b n m , . / * 7 8 9 - 4 5 6 + 1 2 3 0 . \\
+ 1 2 3 4 5 6 7 8 9 0 - = \b \t q w e r t y u i o p [ ] \n a s d f g h j k l ; ' ` \\ z x c v b n m , . / * \ 7 8 9 - 4 5 6 + 1 2 3 0 . \\
+ ! @ # $ % ^ & * ( ) _ + \b \t Q W E R T Y U I O P { } \n A S D F G H J K L : " ~ | Z X C V B N M < > ? * \ 7 8 9 - 4 5 6 + 1 2 3 0 . |
+ 1 2 3 4 5 6 7 8 9 0 - = \b \t q w e r t y u i o p [ ] \n a s d f g h j k l ; ' ` \\ z x c v b n m , . / * \ 7 8 9 - 4 5 6 + 1 2 3 0 . \\