Skip to content

Commit 0417f51

Browse files
author
ryanss
committed
Fix error when undoing too far
Remove undo history before story list is written to buffer so it is no longer possible to undo all the way back to an empty buffer which would cause an error in the Python save_pos() and recall_pos() functions.
1 parent 055445c commit 0417f51

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ftplugin/hackernews.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ def main():
7272
vim.command("setlocal noswapfile")
7373
vim.command("setlocal buftype=nofile")
7474

75+
if vim.eval("changenr()") == "1":
76+
vim.command("setlocal undolevels=-1")
77+
7578
bwrite("┌───┐")
7679
bwrite("│ Y │ Hacker News (news.ycombinator.com)")
7780
bwrite("└───┘")
@@ -116,6 +119,7 @@ def main():
116119
line %= (" "*4, item['time_ago'], item['id'])
117120
bwrite(line)
118121
bwrite("")
122+
vim.command("setlocal undolevels=100")
119123

120124

121125
def link(external=False):

0 commit comments

Comments
 (0)