From 32c8517a90c31416c1cb399994360f73c65ce052 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Fri, 3 Jul 2020 21:02:16 -0400 Subject: [PATCH] Rebind escape to clear info and deselect --- internal/action/actions.go | 12 ++++++++++++ internal/action/bufpane.go | 2 ++ internal/action/defaults_darwin.go | 2 +- internal/action/defaults_other.go | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/internal/action/actions.go b/internal/action/actions.go index 184a57e0..ce2d86c7 100644 --- a/internal/action/actions.go +++ b/internal/action/actions.go @@ -1443,6 +1443,18 @@ func (h *BufPane) Escape() bool { return true } +// Deselect deselects on the current cursor +func (h *BufPane) Deselect() bool { + h.Cursor.Deselect(true) + return true +} + +// ClearInfo clears the infobar +func (h *BufPane) ClearInfo() bool { + InfoBar.Message("") + return true +} + // Quit this will close the current tab or view that is open func (h *BufPane) Quit() bool { quit := func() { diff --git a/internal/action/bufpane.go b/internal/action/bufpane.go index 768081ef..cc365d0a 100644 --- a/internal/action/bufpane.go +++ b/internal/action/bufpane.go @@ -635,6 +635,8 @@ var BufKeyActions = map[string]BufKeyAction{ "SkipMultiCursor": (*BufPane).SkipMultiCursor, "JumpToMatchingBrace": (*BufPane).JumpToMatchingBrace, "JumpLine": (*BufPane).JumpLine, + "Deselect": (*BufPane).Deselect, + "ClearInfo": (*BufPane).ClearInfo, "None": (*BufPane).None, // This was changed to InsertNewline but I don't want to break backwards compatibility diff --git a/internal/action/defaults_darwin.go b/internal/action/defaults_darwin.go index bc29af26..28503d7c 100644 --- a/internal/action/defaults_darwin.go +++ b/internal/action/defaults_darwin.go @@ -88,7 +88,7 @@ func DefaultBindings() map[string]string { "F4": "Quit", "F7": "Find", "F10": "Quit", - "Esc": "Escape", + "Esc": "Deselect,ClearInfo,RemoveAllMultiCursors", // Mouse bindings "MouseWheelUp": "ScrollUp", diff --git a/internal/action/defaults_other.go b/internal/action/defaults_other.go index d55179f9..7099a75b 100644 --- a/internal/action/defaults_other.go +++ b/internal/action/defaults_other.go @@ -90,7 +90,7 @@ func DefaultBindings() map[string]string { "F4": "Quit", "F7": "Find", "F10": "Quit", - "Esc": "Escape", + "Esc": "Deselect,ClearInfo,RemoveAllMultiCursors", // Mouse bindings "MouseWheelUp": "ScrollUp",