Report invalid --when-focus-on expressions to user

This commit is contained in:
Kovid Goyal 2023-11-30 20:00:49 +05:30
parent 15eb03c5e2
commit 66bc86e4f2
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 7 deletions

View file

@ -1404,8 +1404,8 @@ class Boss:
if w and w in self.match_windows(x.options.when_focus_on):
ans = x
except Exception:
import traceback
traceback.print_exc()
self.show_error(_('Invalid key mapping'), _(
'The match expression {0} is not valid for {1}').format(x.options.when_focus_on, '--when-focus-on'))
else:
ans = x
return ans
@ -1620,8 +1620,6 @@ class Boss:
try:
actions = get_options().alias_map.resolve_aliases(action_definition, 'map' if dispatch_type == 'KeyPress' else 'mouse_map')
except Exception as e:
import traceback
traceback.print_exc()
self.show_error('Failed to parse action', f'{action_definition}\n{e}')
return True
if actions:
@ -1631,8 +1629,6 @@ class Boss:
if len(actions) > 1:
self.drain_actions(list(actions[1:]), window_for_dispatch, dispatch_type)
except Exception as e:
import traceback
traceback.print_exc()
self.show_error('Key action failed', f'{actions[0].pretty()}\n{e}')
consumed = True
return consumed

View file

@ -30,7 +30,6 @@ from .key_encoding import KeyEvent as KeyEventType
from .layout.base import Layout as LayoutType
from .options.utils import AliasMap as AliasMap
from .options.utils import KeyMap as KeyMap
from .options.utils import SequenceMap as SequenceMap
from .rc.base import RemoteCommand as RemoteCommandType
from .session import Session as SessionType
from .session import Tab as SessionTab