From b8c4337dddee98712de4cf02f935b1356333e787 Mon Sep 17 00:00:00 2001 From: "Suraj N. Kurapati" Date: Fri, 22 Apr 2011 23:44:41 -0700 Subject: [PATCH] escaped newlines and tabs were expanded on recall Kudos to Sorin Ionescu for finding this same solution independently. https://github.com/robbyrussell/oh-my-zsh/pull/215#issuecomment-811332 https://github.com/robbyrussell/oh-my-zsh/pull/215#issuecomment-1046603 --- history-substring-search.zsh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/history-substring-search.zsh b/history-substring-search.zsh index daaa922..a2f16cd 100644 --- a/history-substring-search.zsh +++ b/history-substring-search.zsh @@ -85,10 +85,7 @@ zsh-history-substring-search-backward() { if [[ $WIDGET = *backward* ]]; then # we have pressed arrow-up if [[ ($F_match_number -ge 2 && $F_match_number -le $F_number_of_matches_plus_one) ]]; then let "F_match_number = $F_match_number - 1" - F_command_to_be_retrieved=$(fc -ln $F_matches[$F_match_number] $F_matches[$F_match_number]) - F_command_to_be_retrieved=${F_command_to_be_retrieved//\\"n"/$'\n'} - F_command_to_be_retrieved=${F_command_to_be_retrieved//\\"t"/$'\t'} - # expand newlines and tabs in multi-line commands + F_command_to_be_retrieved=$history[$F_matches[$F_match_number]] BUFFER=$F_command_to_be_retrieved if [[ ((( $F_zsh_highlighting_available == 1 ) && ( $+BUFFER < $F_max_buffer_size) )) ]]; then _zsh_highlight-zle-buffer @@ -148,9 +145,7 @@ zsh-history-substring-search-backward() { fi elif [[ ($F_match_number -ge 0 && $F_match_number -le $F_number_of_matches_minus_one) ]]; then let "F_match_number = $F_match_number + 1" - F_command_to_be_retrieved=$(fc -ln $F_matches[$F_match_number] $F_matches[$F_match_number]) - F_command_to_be_retrieved=${F_command_to_be_retrieved//\\"n"/$'\n'} - F_command_to_be_retrieved=${F_command_to_be_retrieved//\\"t"/$'\t'} + F_command_to_be_retrieved=$history[$F_matches[$F_match_number]] BUFFER=$F_command_to_be_retrieved if [[ ((( $F_zsh_highlighting_available == 1 ) && ( $+BUFFER < $F_max_buffer_size) )) ]]; then _zsh_highlight-zle-buffer