From bfc7a2c2cbbbb0c448b23396bdb7bf088b8c6dc3 Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Tue, 4 Aug 2015 17:20:03 +0200 Subject: [PATCH] Bugfix: `Escape` quits tpm with emacs copy mode Fixes #43, closes #45 --- CHANGELOG.md | 2 ++ scripts/helpers/tmux_echo_functions.sh | 11 ++++++++++- tests/test_plugin_clean.sh | 3 +++ tests/test_plugin_installation.sh | 12 ++++++++++++ tests/test_plugin_installation_legacy.sh | 4 ++++ tests/test_plugin_sourcing.sh | 3 +++ tests/test_plugin_update.sh | 2 ++ 7 files changed, 36 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9e7be6..d141843 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ### master - upgrade to new version of `tmux-test` +- bug: when using `emacs` copy mode, Enter does not quit screen after tpm + installation/update. Fix by making `Escape` the key for emacs mode. ### v3.0.0, 2015-08-03 - refactor `shared_set_tpm_path_constant` function diff --git a/scripts/helpers/tmux_echo_functions.sh b/scripts/helpers/tmux_echo_functions.sh index 8c145b9..7a6ef0a 100644 --- a/scripts/helpers/tmux_echo_functions.sh +++ b/scripts/helpers/tmux_echo_functions.sh @@ -1,3 +1,7 @@ +_has_emacs_mode_keys() { + $(tmux show -gw mode-keys | grep -q emacs) +} + tmux_echo() { local message="$1" tmux run-shell "echo '$message'" @@ -12,8 +16,13 @@ echo_err() { } end_message() { + if _has_emacs_mode_keys; then + local continue_key="ESCAPE" + else + local continue_key="ENTER" + fi tmux_echo "" tmux_echo "TMUX environment reloaded." tmux_echo "" - tmux_echo "Done, press ENTER to continue." + tmux_echo "Done, press $continue_key to continue." } diff --git a/tests/test_plugin_clean.sh b/tests/test_plugin_clean.sh index e4c0888..d36c468 100755 --- a/tests/test_plugin_clean.sh +++ b/tests/test_plugin_clean.sh @@ -18,6 +18,7 @@ manually_install_the_plugin() { test_plugin_uninstallation_via_tmux_key_binding() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi run-shell "$TPM_DIR/tpm" HERE @@ -33,6 +34,7 @@ test_plugin_uninstallation_via_tmux_key_binding() { test_plugin_uninstallation_via_script() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi run-shell "$TPM_DIR/tpm" HERE @@ -46,6 +48,7 @@ test_plugin_uninstallation_via_script() { test_unsuccessful_plugin_uninstallation_via_script() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi run-shell "$TPM_DIR/tpm" HERE diff --git a/tests/test_plugin_installation.sh b/tests/test_plugin_installation.sh index 7e3404d..65b1899 100755 --- a/tests/test_plugin_installation.sh +++ b/tests/test_plugin_installation.sh @@ -15,6 +15,7 @@ source "$CURRENT_DIR/helpers/tpm.sh" test_plugin_installation_via_tmux_key_binding() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi set -g @plugin "tmux-plugins/tmux-example-plugin" run-shell "$TPM_DIR/tpm" HERE @@ -30,6 +31,7 @@ test_plugin_installation_via_tmux_key_binding() { test_plugin_installation_custom_dir_via_tmux_key_binding() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi set-environment -g TMUX_PLUGIN_MANAGER_PATH '$CUSTOM_PLUGINS_DIR' set -g @plugin "tmux-plugins/tmux-example-plugin" @@ -48,6 +50,7 @@ test_plugin_installation_custom_dir_via_tmux_key_binding() { test_non_existing_plugin_installation_via_tmux_key_binding() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi set -g @plugin "tmux-plugins/non-existing-plugin" run-shell "$TPM_DIR/tpm" HERE @@ -60,6 +63,7 @@ test_non_existing_plugin_installation_via_tmux_key_binding() { test_multiple_plugins_installation_via_tmux_key_binding() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi set -g @plugin "tmux-plugins/tmux-example-plugin" \ \ set -g @plugin 'tmux-plugins/tmux-copycat' run-shell "$TPM_DIR/tpm" @@ -79,6 +83,7 @@ test_multiple_plugins_installation_via_tmux_key_binding() { test_plugins_installation_from_sourced_file_via_tmux_key_binding() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi source '$ADDITIONAL_CONFIG_FILE_1' set -g @plugin 'tmux-plugins/tmux-example-plugin' run-shell "$TPM_DIR/tpm" @@ -101,6 +106,7 @@ test_plugins_installation_from_sourced_file_via_tmux_key_binding() { test_plugins_installation_from_multiple_sourced_files_via_tmux_key_binding() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi \ \ source '$ADDITIONAL_CONFIG_FILE_1' source-file '$ADDITIONAL_CONFIG_FILE_2' run-shell "$TPM_DIR/tpm" @@ -126,6 +132,7 @@ test_plugins_installation_from_multiple_sourced_files_via_tmux_key_binding() { test_plugin_installation_via_script() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi set -g @plugin "tmux-plugins/tmux-example-plugin" run-shell "$TPM_DIR/tpm" HERE @@ -144,6 +151,7 @@ test_plugin_installation_via_script() { test_plugin_installation_custom_dir_via_script() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi set-environment -g TMUX_PLUGIN_MANAGER_PATH '$CUSTOM_PLUGINS_DIR' set -g @plugin "tmux-plugins/tmux-example-plugin" @@ -165,6 +173,7 @@ test_plugin_installation_custom_dir_via_script() { test_non_existing_plugin_installation_via_script() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi set -g @plugin "tmux-plugins/non-existing-plugin" run-shell "$TPM_DIR/tpm" HERE @@ -178,6 +187,7 @@ test_non_existing_plugin_installation_via_script() { test_multiple_plugins_installation_via_script() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi set -g @plugin "tmux-plugins/tmux-example-plugin" \ \ set -g @plugin 'tmux-plugins/tmux-copycat' run-shell "$TPM_DIR/tpm" @@ -200,6 +210,7 @@ test_multiple_plugins_installation_via_script() { test_plugins_installation_from_sourced_file_via_script() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi source '$ADDITIONAL_CONFIG_FILE_1' set -g @plugin 'tmux-plugins/tmux-example-plugin' run-shell "$TPM_DIR/tpm" @@ -225,6 +236,7 @@ test_plugins_installation_from_sourced_file_via_script() { test_plugins_installation_from_multiple_sourced_files_via_script() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi \ \ source '$ADDITIONAL_CONFIG_FILE_1' source-file '$ADDITIONAL_CONFIG_FILE_2' set -g @plugin 'tmux-plugins/tmux-example-plugin' diff --git a/tests/test_plugin_installation_legacy.sh b/tests/test_plugin_installation_legacy.sh index 66d0e93..b1d0cf6 100755 --- a/tests/test_plugin_installation_legacy.sh +++ b/tests/test_plugin_installation_legacy.sh @@ -11,6 +11,7 @@ source "$CURRENT_DIR/helpers/tpm.sh" test_plugin_installation_via_tmux_key_binding() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi set -g @tpm_plugins "tmux-plugins/tmux-example-plugin" run-shell "$TPM_DIR/tpm" HERE @@ -28,6 +29,7 @@ test_plugin_installation_via_tmux_key_binding() { test_legacy_and_new_syntax_for_plugin_installation_work_via_tmux_key_binding() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi set -g @tpm_plugins " \ tmux-plugins/tmux-example-plugin \ " @@ -53,6 +55,7 @@ test_legacy_and_new_syntax_for_plugin_installation_work_via_tmux_key_binding() { test_plugin_installation_via_script() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi set -g @tpm_plugins "tmux-plugins/tmux-example-plugin" run-shell "$TPM_DIR/tpm" HERE @@ -71,6 +74,7 @@ test_plugin_installation_via_script() { test_legacy_and_new_syntax_for_plugin_installation_work_via_script() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi set -g @tpm_plugins " \ tmux-plugins/tmux-example-plugin \ " diff --git a/tests/test_plugin_sourcing.sh b/tests/test_plugin_sourcing.sh index 4398d9f..c06f1fe 100755 --- a/tests/test_plugin_sourcing.sh +++ b/tests/test_plugin_sourcing.sh @@ -33,6 +33,7 @@ check_tpm_path() { test_plugin_sourcing() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi set -g @plugin "doesnt_matter/tmux_test_plugin" run-shell "$TPM_DIR/tpm" HERE @@ -51,6 +52,7 @@ test_plugin_sourcing() { test_default_tpm_path() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi run-shell "$TPM_DIR/tpm" HERE @@ -62,6 +64,7 @@ test_default_tpm_path() { test_custom_tpm_path() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi set-environment -g TMUX_PLUGIN_MANAGER_PATH '$CUSTOM_PLUGINS_DIR' run-shell "$TPM_DIR/tpm" HERE diff --git a/tests/test_plugin_update.sh b/tests/test_plugin_update.sh index 872f405..4924d16 100755 --- a/tests/test_plugin_update.sh +++ b/tests/test_plugin_update.sh @@ -17,6 +17,7 @@ manually_install_the_plugin() { test_plugin_update_via_tmux_key_binding() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi set -g @plugin "tmux-plugins/tmux-example-plugin" run-shell "$TPM_DIR/tpm" HERE @@ -36,6 +37,7 @@ test_plugin_update_via_tmux_key_binding() { test_plugin_update_via_script() { set_tmux_conf_helper <<- HERE + set -g mode-keys vi set -g @plugin "tmux-plugins/tmux-example-plugin" run-shell "$TPM_DIR/tpm" HERE