~mdw
/
tig
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add_keybinding: always allocate the new keybinding
[tig]
/
tig.c
diff --git
a/tig.c
b/tig.c
index
471fa4d
..
6c2b7d0
100644
(file)
--- a/
tig.c
+++ b/
tig.c
@@
-12,7
+12,7
@@
*/
#ifndef VERSION
*/
#ifndef VERSION
-#define VERSION "tig-0.
4
.git"
+#define VERSION "tig-0.
5
.git"
#endif
#ifndef DEBUG
#endif
#ifndef DEBUG
@@
-767,10
+767,9
@@
static struct keybinding *keybindings[ARRAY_SIZE(keymap_table)];
static void
add_keybinding(enum keymap keymap, enum request request, int key)
{
static void
add_keybinding(enum keymap keymap, enum request request, int key)
{
- struct keybinding *keybinding
= keybindings[keymap]
;
+ struct keybinding *keybinding;
- if (!keybinding)
- keybinding = calloc(1, sizeof(*keybinding));
+ keybinding = calloc(1, sizeof(*keybinding));
if (!keybinding)
die("Failed to allocate keybinding");
if (!keybinding)
die("Failed to allocate keybinding");
@@
-3269,12
+3268,12
@@
read_prompt(const char *prompt)
}
}
}
}
- if (status == CANCEL) {
- /* Clear the status window */
- status_empty = FALSE;
- report("");
+ /* Clear the status window */
+ status_empty = FALSE;
+ report("");
+
+ if (status == CANCEL)
return NULL;
return NULL;
- }
buf[pos++] = 0;
buf[pos++] = 0;
@@
-3532,6
+3531,8
@@
main(int argc, char *argv[])
/* Refresh, accept single keystroke of input */
key = wgetch(status_win);
/* Refresh, accept single keystroke of input */
key = wgetch(status_win);
+ if (key == ERR)
+ continue;
request = get_keybinding(display[current_view]->keymap, key);
request = get_keybinding(display[current_view]->keymap, key);