From 6bd0e2b221a535e8a22f2793325815d7b82049f0 Mon Sep 17 00:00:00 2001 From: Evan Niessen-Derry Date: Sat, 1 Oct 2016 19:15:26 -0500 Subject: [PATCH 1/2] Fixed key_binding_not_set regex issue If you run key_binding_not_set against '\' that character will be placed as is in the regex that's run, and will escape something it shouldn't. So we test for this and escape the character if necessary. --- sensible.tmux | 1 + 1 file changed, 1 insertion(+) diff --git a/sensible.tmux b/sensible.tmux index 9d6fcf5..3993296 100755 --- a/sensible.tmux +++ b/sensible.tmux @@ -46,6 +46,7 @@ server_option_value_not_changed() { key_binding_not_set() { local key="$1" + if [[ ${key} == '\' ]]; then key='\\'; fi if $(tmux list-keys | grep -q "${KEY_BINDING_REGEX}${key}[[:space:]]"); then return 1 else From df09a123ef888d4dd2873e2cbc54d7e0590a904e Mon Sep 17 00:00:00 2001 From: Evan Niessen-Derry Date: Sat, 1 Oct 2016 19:28:28 -0500 Subject: [PATCH 2/2] More suscinct and flexible escape char fix To handle the possibility of the escape character being anywhere in the key passed to `key_binding_not_set`, I've opted to use parameter replacement to escape every escape character. This is more suscinct, and will make sure every '\' is handled. --- sensible.tmux | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sensible.tmux b/sensible.tmux index 3993296..cf10313 100755 --- a/sensible.tmux +++ b/sensible.tmux @@ -45,8 +45,7 @@ server_option_value_not_changed() { } key_binding_not_set() { - local key="$1" - if [[ ${key} == '\' ]]; then key='\\'; fi + local key="${1//\\/\\\\}" if $(tmux list-keys | grep -q "${KEY_BINDING_REGEX}${key}[[:space:]]"); then return 1 else