Commit 15804776 authored by Sami Salonen's avatar Sami Salonen Committed by Jelle Zijlstra
Browse files

Put cursor in last line if old position is invalid (#641)

parent 21ab37a5
Loading
Loading
Loading
Loading
+3 −0
Changes for plugin/black.vim: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -114,7 +114,10 @@ def Black():
  else:
    cursor = vim.current.window.cursor
    vim.current.buffer[:] = new_buffer_str.split('\n')[:-1]
    try:
      vim.current.window.cursor = cursor
    except vim.error:
      vim.current.window.cursor = (len(vim.current.buffer), 0)
    print(f'Reformatted in {time.time() - start:.4f}s.')

def BlackUpgrade():