Viewer: Also apply changes to preferences when pressing esc as there are a number of people who do this and then complain that the preferences dont stick, and I have only so much patience

This commit is contained in:
Kovid Goyal 2019-10-07 20:16:08 +05:30
parent b1ef8dc2fb
commit a2708e8ea2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 9 additions and 3 deletions

View File

@ -421,7 +421,10 @@ class PrefsOverlay: # {{{
def show(self, container):
self.changes_occurred = False
container.style.backgroundColor = get_color('window-background')
create_prefs_panel(container, self.overlay.hide_current_panel, def():self.changes_occurred=True;)
self.prefs = create_prefs_panel(container, self.overlay.hide_current_panel, def():self.changes_occurred=True;)
def handle_escape(self):
self.prefs.onclose()
def on_hide(self):
if self.changes_occurred:
@ -530,7 +533,10 @@ class Overlay:
if self.panels.length:
p = self.panels[-1]
if not p.is_not_escapable:
self.hide_current_panel()
if p.handle_escape:
p.handle_escape()
else:
self.hide_current_panel()
return True
return False

View File

@ -140,4 +140,4 @@ class Prefs:
def create_prefs_panel(container, close_func, on_change):
Prefs(container, close_func, on_change)
return Prefs(container, close_func, on_change)