summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a63119f)
raw | patch | inline | side by side (parent: a63119f)
author | Jonas Fonseca <fonseca@diku.dk> | |
Sun, 11 Apr 2010 01:15:34 +0000 (21:15 -0400) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Mon, 19 Apr 2010 00:53:24 +0000 (20:53 -0400) |
Fix problem where binding a key to none to deactivate it did not work.
Furthermore, make it show the usual "Unknown key, press 'h' for help".
Reported by Simon Ruderich.
Furthermore, make it show the usual "Unknown key, press 'h' for help".
Reported by Simon Ruderich.
NEWS | patch | blob | history | |
tig.c | patch | blob | history |
index bce72ebf7fd085e3523290c6c8502ba471d8e17a..815f246ee897cdab99db03a0c43fb18f2aeed043 100644 (file)
--- a/NEWS
+++ b/NEWS
changes made to support blame view from sub directories.
- Fix parsing of boolean show-date values.
- Fix relative date.
+ - Fix unbind to behave as if the keybinding was never defined.
tig-0.15
--------
index fbe2821769174390b6fdab429dc4ed160578e038..47daba930c2831d267ad6665e3d0660a8027c719 100644 (file)
--- a/tig.c
+++ b/tig.c
#define REQ_(req, help) REQ_##req
/* Offset all requests to avoid conflicts with ncurses getch values. */
- REQ_OFFSET = KEY_MAX + 1,
+ REQ_UNKNOWN = KEY_MAX + 1,
+ REQ_OFFSET,
REQ_INFO
#undef REQ_GROUP
if (enum_equals(req_info[i], name, namelen))
return req_info[i].request;
- return REQ_NONE;
+ return REQ_UNKNOWN;
}
enum request request;
};
-static const struct keybinding default_keybindings[] = {
+static struct keybinding default_keybindings[] = {
/* View switching */
{ 'm', REQ_VIEW_MAIN },
{ 'd', REQ_VIEW_DIFF },
die("Failed to allocate keybinding");
table->data[table->size].alias = key;
table->data[table->size++].request = request;
+
+ if (request == REQ_NONE && keymap == KEYMAP_GENERIC) {
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(default_keybindings); i++)
+ if (default_keybindings[i].alias == key)
+ default_keybindings[i].request = REQ_NONE;
+ }
}
/* Looks for a key binding first in the given map, then in the generic map, and
}
request = get_request(argv[2]);
- if (request == REQ_NONE) {
+ if (request == REQ_UNKNOWN) {
static const struct enum_map obsolete[] = {
ENUM_MAP("cherry-pick", REQ_NONE),
ENUM_MAP("screen-resize", REQ_NONE),
return ERR;
}
}
- if (request == REQ_NONE && *argv[2]++ == '!')
+ if (request == REQ_UNKNOWN && *argv[2]++ == '!')
request = add_run_request(keymap, key, argc - 2, argv + 2);
- if (request == REQ_NONE) {
+ if (request == REQ_UNKNOWN) {
config_msg = "Unknown request name";
return ERR;
}
/* Some low-level request handling. This keeps access to
* status_win restricted. */
switch (request) {
+ case REQ_NONE:
+ report("Unknown key, press %s for help",
+ get_key(view->keymap, REQ_VIEW_HELP));
+ break;
case REQ_PROMPT:
{
char *cmd = read_prompt(":");