Put cursor in last line if old position is invalid (#641)
This commit is contained in:
parent
21ab37a5d9
commit
1580477615
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user