Skip to content

Fix cursor jumping to top when redo #320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ENV PACKAGES="\
ruby \
ruby-dev \
ruby-json \
python \
python2 \
python3 \
py-pip \
nodejs \
Expand Down
15 changes: 4 additions & 11 deletions autoload/prettier/utils/buffer.vim
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,11 @@ function! prettier#utils#buffer#replace(lines, startSelection, endSelection) abo
execute "normal! a\<BS>"
try | silent undojoin | catch | endtry

" delete all lines on the current buffer
silent! execute 'lockmarks %delete _'
" insert all lines from prettier-ed buffer before the first line on the current buffer
silent! lockmarks call append(0, l:newBuffer)

" replace all lines from the current buffer with output from prettier
let l:idx = 0
for l:line in l:newBuffer
silent! lockmarks call append(l:idx, l:line)
let l:idx += 1
endfor

" delete trailing newline introduced by the above append procedure
silent! lockmarks execute '$delete _'
" then delete all the original lines on the current buffer
silent! lockmarks execute (len(l:newBuffer) + 1).',$delete _'

" Restore view
call winrestview(l:winview)
Expand Down