diff options
author | 2013-12-31 16:16:28 +0100 | |
---|---|---|
committer | 2013-12-31 16:16:28 +0100 | |
commit | a302f37447449e9b841ec1bb16a7b17908076dd6 (patch) | |
tree | 2aee0a62931ee4efc84f5a5a3c1bc8ce2bf95b44 | |
parent | f501e30353150133c7a9804f62700d45712496df (diff) |
Fix bug
-rw-r--r-- | input.cpp | 21 | ||||
-rw-r--r-- | share/functions/fish_vi_key_bindings.fish | 5 |
2 files changed, 11 insertions, 15 deletions
@@ -271,10 +271,12 @@ bool input_set_bind_mode(const wchar_t *bm) int len = wcslen(bm) * sizeof(wchar_t); if(len >= MAX_BIND_MODE_NAME_SIZE) { + debug(0, L"Error: name for bind mode exceeds maximum size\n"); return false; } memset(bind_mode, 0, MAX_BIND_MODE_NAME_SIZE); memcpy(bind_mode, bm, len); + //debug(0, L"Set bind mode to `%ls'", bind_mode); return true; } @@ -513,18 +515,11 @@ static wint_t input_try_mapping(const input_mapping_t &m) } input_unreadch(c); + //debug(0, L"trying mapping %ls (%ls)\n", escape(m.seq.c_str(), 1), m.command.c_str()); const wchar_t *str = m.seq.c_str(); for (j=0; str[j] != L'\0'; j++) { - bool timed; - if(iswalnum(str[j])) - { - timed = false; - } - else - { - timed = (j > 0); - } + bool timed = (j > 0 && iswcntrl(str[0])); c = input_common_readch(timed); if (str[j] != c) @@ -535,6 +530,7 @@ static wint_t input_try_mapping(const input_mapping_t &m) if (str[j] == L'\0') { + //debug(0, L"matched mapping %ls (%ls)\n", escape(m.seq.c_str(), 1), m.command.c_str()); /* We matched the entire sequence */ return input_exec_binding(m, m.seq); } @@ -550,6 +546,7 @@ static wint_t input_try_mapping(const input_mapping_t &m) input_unreadch(m.seq[k]); } } + return 0; } @@ -581,12 +578,12 @@ wint_t input_readch() { const input_mapping_t &m = mapping_list.at(i); - // debug(0, L"trying mapping (%ls,%ls,%ls,%ls)\n", escape(m.seq.c_str(), 1), - // m.command.c_str(), m.mode.c_str(), m.new_mode.c_str()); + //debug(0, L"trying mapping (%ls,%ls,%ls,%ls)\n", escape(m.seq.c_str(), 1), + // m.command.c_str(), m.mode.c_str(), m.new_mode.c_str()); if(wcscmp(m.mode.c_str(), input_get_bind_mode())) { - // debug(0, L"skipping mapping because mode %ls != %ls\n", m.mode.c_str(), input_get_bind_mode()); + //debug(0, L"skipping mapping because mode %ls != %ls\n", m.mode.c_str(), input_get_bind_mode()); continue; } diff --git a/share/functions/fish_vi_key_bindings.fish b/share/functions/fish_vi_key_bindings.fish index cec66ea0..511e045a 100644 --- a/share/functions/fish_vi_key_bindings.fish +++ b/share/functions/fish_vi_key_bindings.fish @@ -7,7 +7,7 @@ function fish_vi_key_bindings -d "vi-like key bindings for fish" # bind \cd exit - bind : exit + bind :q exit bind h backward-char bind l forward-char @@ -59,8 +59,6 @@ function fish_vi_key_bindings -d "vi-like key bindings for fish" bind -M insert -k dc delete-char bind -M insert -k backspace backward-delete-char - bind -M insert -m default \e force-repaint - bind -M insert -m default q force-repaint bind -M insert \t complete bind -M insert \e\[A up-or-search @@ -72,4 +70,5 @@ function fish_vi_key_bindings -d "vi-like key bindings for fish" bind -M insert \e\[D backward-char bind -M insert -k right forward-char bind -M insert -k left backward-char + bind -M insert -m default \e force-repaint end |