diff --git a/ui/command-processor.go b/ui/command-processor.go index f0591f7..0be8071 100644 --- a/ui/command-processor.go +++ b/ui/command-processor.go @@ -113,6 +113,7 @@ func NewCommandProcessor(parent *MainView) *CommandProcessor { "cs": {"cross-signing"}, "power": {"powerlevel"}, "pl": {"powerlevel"}, + "esc": {"escape"}, }, autocompleters: map[string]CommandAutocompleter{ "devices": autocompleteUser, @@ -181,6 +182,8 @@ func NewCommandProcessor(parent *MainView) *CommandProcessor { "rainbownotice": cmdRainbowNotice, + "escape": cmdEscape, + "fingerprint": cmdFingerprint, "devices": cmdDevices, "verify-device": cmdVerifyDevice, diff --git a/ui/commands.go b/ui/commands.go index 96b7990..19fb921 100644 --- a/ui/commands.go +++ b/ui/commands.go @@ -908,6 +908,19 @@ func cmdSetState(cmd *Command) { } } +func cmdEscape(cmd *Command) { + if cmd.Config.Preferences.DisplayMode != config.DisplayModeModern { + cmd.Reply("/escape can only be used in the modern display mode") + return + } + if cmd.MainView.rosterView.selected == nil || !cmd.MainView.rosterView.focused { + cmd.Reply("/escape is used to exit from an open room (no room opened)") + return + } + cmd.MainView.rosterView.focused = false + cmd.MainView.rosterView.selected = nil +} + type ToggleMessage interface { Name() string Format(state bool) string