From b5245c582ea72d28f42c11b5caa1980fecb9582b Mon Sep 17 00:00:00 2001 From: Aidan Holm Date: Sat, 21 Dec 2019 17:53:36 +0800 Subject: [PATCH] Don't save empty tab history --- lib/undoclose.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/undoclose.lua b/lib/undoclose.lua index 06ca41fba..438c8504a 100644 --- a/lib/undoclose.lua +++ b/lib/undoclose.lua @@ -69,13 +69,18 @@ local on_tab_close = function (w, view) local index = w.tabs:indexof(view) local hist = view.history local hist_item = hist.items[hist.index] - local title = lousy.util.escape(hist_item.title) or "" + -- Don't save tabs with no history + if not index or not hist_item then + return + end -- Don't save the "New Tab" page in undoclose history if _M.emit_signal("save", view) == false then return end + local title = lousy.util.escape(hist_item.title) or "" + tab = { session_state = view.session_state, uri = view.uri,