]> git.lizzy.rs Git - micro.git/commitdiff
Rebind escape to clear info and deselect
authorZachary Yedidia <zyedidia@gmail.com>
Sat, 4 Jul 2020 01:02:16 +0000 (21:02 -0400)
committerZachary Yedidia <zyedidia@gmail.com>
Sat, 4 Jul 2020 01:02:16 +0000 (21:02 -0400)
internal/action/actions.go
internal/action/bufpane.go
internal/action/defaults_darwin.go
internal/action/defaults_other.go

index 184a57e0820feedc1bc84b66b508e25ceb91a106..ce2d86c7c6169971a40c29e0fd812cdf2e2d2ccc 100644 (file)
@@ -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() {
index 768081efddb81d6dabf95cfecd73fe73b05486e5..cc365d0a3337ce93523233ef47995f70f11f7305 100644 (file)
@@ -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
index bc29af26a493fe28072ccaa53feb4ad1859f8a69..28503d7cdd64655b00ae6b0e72d5d726d26157dd 100644 (file)
@@ -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",
index d55179f9c82214227297663825f57f77cb264b92..7099a75b2c7048a79d17567d3f66fdd7c2b86f63 100644 (file)
@@ -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",