Skip to content

Commit 95eb1dd

Browse files
committed
Cursor move-up forcebly.
Use winsaveview(), winrestview() instead Fixes #186
1 parent 2a1c203 commit 95eb1dd

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

autoload/ctrlp.vim

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ fu! s:Close()
318318
if s:winres[1] >= &lines && s:winres[2] == winnr('$')
319319
exe s:winres[0].s:winres[0]
320320
en
321-
unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr
321+
unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:init s:savestr
322322
\ s:mrbs s:did_exp
323323
cal ctrlp#recordhist()
324324
cal s:execextvar('exit')
@@ -593,9 +593,6 @@ fu! s:Render(lines, pat)
593593
exe cur_cmd
594594
cal s:unmarksigns()
595595
cal s:remarksigns()
596-
if exists('s:cline') && s:nolim != 1
597-
cal cursor(s:cline, 1)
598-
en
599596
" Highlighting
600597
if s:dohighlight()
601598
cal s:highlight(pat, s:mathi[1])
@@ -621,7 +618,9 @@ fu! s:Update(str)
621618
endf
622619

623620
fu! s:ForceUpdate()
621+
let wv = winsaveview()
624622
sil! cal s:Update(escape(s:getinput(), '\'))
623+
cal winrestview(wv)
625624
endf
626625

627626
fu! s:BuildPrompt(upd)
@@ -806,8 +805,9 @@ fu! s:PrtSelectMove(dir)
806805
let wht = winheight(0)
807806
let dirs = {'t': 'gg','b': 'G','j': 'j','k': 'k','u': wht.'k','d': wht.'j'}
808807
exe 'keepj norm!' dirs[a:dir]
809-
if s:nolim != 1 | let s:cline = line('.') | en
808+
let wv = winsaveview()
810809
cal s:BuildPrompt(0)
810+
cal winrestview(wv)
811811
endf
812812

813813
fu! s:PrtSelectJump(char)
@@ -830,8 +830,9 @@ fu! s:PrtSelectJump(char)
830830
let [jmpln, s:jmpchr] = [npos == -1 ? pos : npos, [chr, npos]]
831831
en
832832
exe 'keepj norm!' ( jmpln + 1 ).'G'
833-
if s:nolim != 1 | let s:cline = line('.') | en
833+
let wv = winsaveview()
834834
cal s:BuildPrompt(0)
835+
cal winrestview(wv)
835836
en
836837
endf
837838
" Misc {{{2

0 commit comments

Comments
 (0)