Skip to content

Commit

Permalink
Check that the search history is correctly restored in all modes
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbra committed Mar 12, 2013
1 parent 583fa83 commit 785e517
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions autoload/ftimproved.vim
Expand Up @@ -5,7 +5,7 @@
" Last Change: Sat, 16 Feb 2013 23:21:31 +0100
"
" Script:
" Copyright: (c) 2009, 2010, 2011, 2012 by Christian Brabandt
" Copyright: (c) 2009 - 2013 by Christian Brabandt
" The VIM LICENSE applies to histwin.vim
" (see |copyright|) except use "ft_improved.vim"
" instead of "Vim".
Expand Down Expand Up @@ -297,7 +297,7 @@ fun! ftimproved#FTCommand(f, fwd, mode) "{{{1
let cmd = op_off[0].cmd
let off .= op_off[1]
let pat1 = (a:fwd ? pat : escape(pat, '?'))
let res = cmd.pat1.off."\n"
let res = cmd.pat1.off."\<cr>"
else
" Searching using 't' command
let cmd = op_off[0].cmd
Expand All @@ -314,7 +314,7 @@ fun! ftimproved#FTCommand(f, fwd, mode) "{{{1
endif

let pat1 = (a:fwd ? pat : escape(pat, '?'))
let res = cmd.pat1.off."\n"
let res = cmd.pat1.off."\<cr>"
endif

if <sid>CheckSearchWrap(pat, a:fwd, cnt)
Expand All @@ -327,7 +327,19 @@ fun! ftimproved#FTCommand(f, fwd, mode) "{{{1

let pat = pat1
call <sid>DebugOutput(res)
return res. ":call histdel('/', -1)\n:let @/='".oldsearchpat."'\n"
if v:operator == 'c'
let mode = "\<C-\>\<C-O>"
else
let mode = "\<C-\>\<C-N>"
endif
let post_cmd = (a:mode == 'o' ? mode : '').
\ ":call histdel('/', -1)\<cr>".
\ (a:mode == 'o' ? mode : '').
\ ":let @/='". oldsearchpat. "'\<cr>"

" for operator-pending mappings, don't return the post_cmd, it could
" end up in insert mode
return res.post_cmd
"return res. ":let @/='".oldsearchpat."'\n"
finally
call <sid>HighlightMatch('')
Expand Down

0 comments on commit 785e517

Please sign in to comment.