Skip to content

Commit 52ef7ab

Browse files
committed
moved functions that restore cursor position near to where cursor is moved
1 parent 60c638d commit 52ef7ab

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

autoload/pymode/folding.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ fun! pymode#folding#foldcase(lnum) "{{{
137137
endif "}}}
138138

139139
" Blocks. {{{
140+
let s:save_cursor = getcurpos()
140141
let line_block_start = s:BlockStart(a:lnum)
141142
let line_block_end = s:BlockEnd(a:lnum)
142143
let prev_line_block_start = s:BlockStart(a:lnum - 1)
@@ -154,7 +155,10 @@ fun! pymode#folding#foldcase(lnum) "{{{
154155
let l:foldlevel = indent(line_block_start) / &shiftwidth + 1
155156
endif
156157
endif
158+
call setpos('.', s:save_cursor)
157159
return {'foldcase': l:foldcase, 'foldlevel': l:foldlevel}
160+
else
161+
call setpos('.', s:save_cursor)
158162
endif
159163
" endif " }}}
160164

0 commit comments

Comments
 (0)