From b21e66a3cd20e088149926ecdf5710dabd1ec03b Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Wed, 26 Nov 2014 09:59:23 -0500 Subject: Allow connection to `events.QUIT` without requiring index of 1. --- core/ui.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'core/ui.lua') diff --git a/core/ui.lua b/core/ui.lua index bb6f7e4f..f90c5626 100644 --- a/core/ui.lua +++ b/core/ui.lua @@ -386,12 +386,13 @@ events_connect(events.QUIT, function() list[#list + 1] = filename:iconv('UTF-8', _CHARSET) end end - return #list < 1 or ui.dialogs.msgbox{ + local cancel = #list > 0 and ui.dialogs.msgbox{ title = _L['Quit without saving?'], text = _L['The following buffers are unsaved:'], informative_text = table.concat(list, '\n'), icon = 'gtk-dialog-question', button1 = _L['_Cancel'], button2 = _L['Quit _without saving'] - } == 2 + } ~= 2 + if cancel then return true end -- prevent quit end) -- Keeps track of and switches back to the previous buffer after buffer close. @@ -412,7 +413,7 @@ if CURSES then events.connect(events.QUIT, function() io.stdout:write("\x1b[?1002l") -- disable mouse mode io.stdout:flush() - end, 1) + end) end -- Retrieves the view or split at the given terminal coordinates. -- cgit v1.2.3