Skip to content

Commit 6871eb1

Browse files
qstrahlyuezk
authored andcommitted
Use win{save,rest}view instead of {getcur,set}pos
The *pos functions mess with visual block mode when '> is EOL (normal $)
1 parent 9a0f7e8 commit 6871eb1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

autoload/jsx_pretty/comment.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function! jsx_pretty#comment#update_commentstring(original)
22
let syn_current = s:syn_name(line('.'), col('.'))
33
let syn_start = s:syn_name(line('.'), 1)
4-
let save_cursor = getcurpos()
4+
let save_view = winsaveview()
55

66
if syn_start =~? '^jsx'
77
let line = getline(".")
@@ -22,7 +22,7 @@ function! jsx_pretty#comment#update_commentstring(original)
2222
endif
2323

2424
" Restore the cursor position
25-
call setpos('.', save_cursor)
25+
call winrestview(save_view)
2626
endfunction
2727

2828
function! s:syn_name(lnum, cnum)

0 commit comments

Comments
 (0)