Closed yaroslavyaroslav closed 2 weeks ago
on_cancel get called on presenting input view rather than on closing it.
on_cancel
Consider code:
sublime.active_window().show_input_panel( 'Question:', window.settings().get('SOME') or '', # type: ignore lambda user_input: cls.handle_input(user_input, region, text, view, mode, assistant, sheets), lambda user_input: cls.save_input(user_input, window), on_cancel=cls.check(), ) @classmethod def check(cls): logger.debug('on_cancel')
To call on_cancel on esc hit.
esc
it presents the following output on presenting input view:
DEBUG: show_input_panel hit DEBUG: on_cancel DEBUG: user_input:
and nothing on esc key hit.
4183
macOS 15.2 beta
No response
...but the code is invoking the check method and using it's output (None) as the value for the on cancel callback .. remove the parens and try again
check
Ahh, yeah, forgot to add lambda beforehand, thanks.
Description of the bug
on_cancel
get called on presenting input view rather than on closing it.Steps to reproduce
Consider code:
Expected behavior
To call
on_cancel
onesc
hit.Actual behavior
it presents the following output on presenting input view:
and nothing on
esc
key hit.Sublime Text build number
4183
Operating system & version
macOS 15.2 beta
(Linux) Desktop environment and/or window manager
No response
Additional information
No response
OpenGL context information
No response