From a0623e870b912a39c34b6bb19f4adc09c9ca190a Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Mon, 5 Sep 2016 00:54:25 +0200 Subject: [PATCH] Only set bind mode if it changed This is potentially costly (as functions listening for the variable will be executed). Fixes #3216. --- src/input.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/input.cpp b/src/input.cpp index e252c6c41..1fc1eb601 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -216,7 +216,10 @@ wcstring input_get_bind_mode() { /// Set the current bind mode. void input_set_bind_mode(const wcstring &bm) { - env_set(FISH_BIND_MODE_VAR, bm.c_str(), ENV_GLOBAL); + // Only set this if it differs to not execute variable handlers all the time. + if (input_get_bind_mode() != bm.c_str()) { + env_set(FISH_BIND_MODE_VAR, bm.c_str(), ENV_GLOBAL); + } } /// Returns the arity of a given input function.