Sublime Forum

A Quick Fix To Escape key closing your panel (especially for terminus Users) when you don't intend to do that

#1

Sharing in-case someone else has this issue~

Background:
Very Recently, I started using the terminus extensively,
and I often found myself closing the panel through escape key when I only wanted to do other things like Revert to single selection from multi-selection.
This started to get really annoying so here’s the solution,

Solution:
this Safely ONLY removes the Panel Close from the Escape Key Functions, the rest work the same way in the same order.

All you have to do is copy this to your sublime key map files

If you actually want to close the panel you can use shift+escape.

This behaviour applies to all panels. If you want to limit to only preventing terminus closing, then add { "key": "terminus_view"} in the context list of the pass command.

    { "keys": ["escape"], "command": "pass", "context": [
		{ "key": "panel_visible", "operator": "equal", "operand": true },
		{ "key": "panel_has_focus", "operator": "equal", "operand": false},
		{ "key": "num_selections", "operator": "equal", "operand": 1 },
		{ "key": "has_next_field", "operator": "equal", "operand": false },
		{ "key": "has_prev_field", "operator": "equal", "operand": false },
		{ "key": "overlay_visible", "operator": "equal", "operand": false },
		{ "key": "popup_visible", "operator": "equal", "operand": false },
		{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
	]},
	{ "keys": ["escape"], "command": "single_selection", "context": [
		{ "key": "num_selections", "operator": "not_equal", "operand": 1 },
		{ "key": "panel_visible", "operator": "equal", "operand": true },
		{ "key": "panel_has_focus", "operator": "equal", "operand": false }
	]},
	{ "keys": ["escape"], "command": "clear_fields", "context": [
		{ "key": "has_next_field", "operator": "equal", "operand": true },
		{ "key": "panel_visible", "operator": "equal", "operand": true },
		{ "key": "panel_has_focus", "operator": "equal", "operand": false }
	]},
	{ "keys": ["escape"], "command": "clear_fields", "context": [
		{ "key": "has_prev_field", "operator": "equal", "operand": true },
		{ "key": "panel_visible", "operator": "equal", "operand": true },
		{ "key": "panel_has_focus", "operator": "equal", "operand": false }
	]},
	{ "keys": ["shift+escape"],
		"command": "hide_panel",
		"args":  {"cancel": true},
		"context":	[
			{ "key": "panel_visible", "operator": "equal", "operand": true },
		]
	},

If you have any Queries how this works please ask~

0 Likes