From c563fe95fbf58721caa7de0ffe5d8117a6ada51a Mon Sep 17 00:00:00 2001
From: Florian Franzen <FlorianFranzen@gmail.com>
Date: Sun, 9 Feb 2014 14:06:58 +0100
Subject: Makes history-substring-search use term specific up and down buttons.
 Fixes #2089.

---
 plugins/history-substring-search/history-substring-search.zsh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh
index 53f707c79..405eeaade 100644
--- a/plugins/history-substring-search/history-substring-search.zsh
+++ b/plugins/history-substring-search/history-substring-search.zsh
@@ -163,8 +163,9 @@ function history-substring-search-down() {
 zle -N history-substring-search-up
 zle -N history-substring-search-down
 
-bindkey '\e[A' history-substring-search-up
-bindkey '\e[B' history-substring-search-down
+zmodload zsh/terminfo
+bindkey "$terminfo[kcuu1]" history-substring-search-up
+bindkey "$terminfo[kcud1]" history-substring-search-down
 
 #-----------------------------------------------------------------------------
 # implementation details
-- 
cgit v1.2.3-70-g09d2


From 5303793ef13b5dd3e7f52ac40f17fd37f015af44 Mon Sep 17 00:00:00 2001
From: Florian Franzen <FlorianFranzen@gmail.com>
Date: Mon, 24 Mar 2014 22:32:56 +0100
Subject: history-substring-search: bindkey now checks if terminfo is available
 first.

---
 plugins/history-substring-search/history-substring-search.zsh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh
index 405eeaade..22f03dd6d 100644
--- a/plugins/history-substring-search/history-substring-search.zsh
+++ b/plugins/history-substring-search/history-substring-search.zsh
@@ -164,8 +164,12 @@ zle -N history-substring-search-up
 zle -N history-substring-search-down
 
 zmodload zsh/terminfo
-bindkey "$terminfo[kcuu1]" history-substring-search-up
-bindkey "$terminfo[kcud1]" history-substring-search-down
+if [[ -n "$terminfo[kcuu1]" ]]; then
+  bindkey "$terminfo[kcuu1]" history-substring-search-up
+fi
+if [[ -n "$terminfo[kcud1]" ]]; then
+  bindkey "$terminfo[kcud1]" history-substring-search-down
+fi
 
 #-----------------------------------------------------------------------------
 # implementation details
-- 
cgit v1.2.3-70-g09d2