Skip to content

Commit

Permalink
Fixes #1274
Browse files Browse the repository at this point in the history
Meta+enter will also trigger an event validation
  • Loading branch information
P committed Apr 21, 2024
1 parent 0fa1661 commit a6b8d76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion khal/ui/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,10 +610,11 @@ def keypress(self, size: Tuple[int], key: str) -> Optional[str]:
return None
else:
self._abort_confirmed = False
return_value = super().keypress(size, key)
if key in self.pane._conf['keybindings']['save']:
self.save(None)
return None
return super().keypress(size, key)
return return_value


WEEKDAYS = ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU'] # TODO use locale and respect weekdaystart
Expand Down
6 changes: 4 additions & 2 deletions khal/ui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ def keypress(self, size, key):
return None

if (
key in ['up', 'down', 'tab', 'shift tab', 'page up', 'page down'] or
key in ['up', 'down', 'tab', 'shift tab',
'page up', 'page down', 'meta enter'] or
(key in ['right'] and self.edit_pos >= len(self.edit_text)) or
(key in ['left'] and self.edit_pos == 0)):
# when leaving the current Widget we check if currently
Expand Down Expand Up @@ -436,7 +437,8 @@ def edit_text(self):

def keypress(self, size, key):
if (
key in ['up', 'down', 'tab', 'shift tab', 'page up', 'page down'] or
key in ['up', 'down', 'tab', 'shift tab',
'page up', 'page down', 'meta enter'] or
(key in ['right'] and self.edit_pos >= len(self.edit_text)) or
(key in ['left'] and self.edit_pos == 0)):
if not self._validate():
Expand Down

0 comments on commit a6b8d76

Please sign in to comment.