From a317aefd6d1accf75d43a8f32a8838c15bf4c649 Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Sun, 9 Jun 2024 02:18:58 +0200 Subject: [PATCH] Reorganize Cut and CutLine actions Change behavior of the Cut action: don't implicitly call CutLine if there is no selection. Instead, make it return false in this case and change the default Ctrl-x binding to Cut|CutLine, to make it clear, explicit and in line with Copy and CopyLine actions. --- internal/action/actions.go | 2 +- internal/action/defaults_darwin.go | 4 ++-- internal/action/defaults_other.go | 4 ++-- runtime/help/keybindings.md | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/action/actions.go b/internal/action/actions.go index 222e83a8..76e66f4d 100644 --- a/internal/action/actions.go +++ b/internal/action/actions.go @@ -1230,7 +1230,7 @@ func (h *BufPane) Cut() bool { h.Relocate() return true } - return h.CutLine() + return false } // DuplicateLine duplicates the current line or selection diff --git a/internal/action/defaults_darwin.go b/internal/action/defaults_darwin.go index 21d6d2b4..3d5029d3 100644 --- a/internal/action/defaults_darwin.go +++ b/internal/action/defaults_darwin.go @@ -46,7 +46,7 @@ var bufdefaults = map[string]string{ "Ctrl-z": "Undo", "Ctrl-y": "Redo", "Ctrl-c": "Copy|CopyLine", - "Ctrl-x": "Cut", + "Ctrl-x": "Cut|CutLine", "Ctrl-k": "CutLine", "Ctrl-d": "DuplicateLine", "Ctrl-v": "Paste", @@ -145,7 +145,7 @@ var infodefaults = map[string]string{ "Ctrl-z": "Undo", "Ctrl-y": "Redo", "Ctrl-c": "Copy|CopyLine", - "Ctrl-x": "Cut", + "Ctrl-x": "Cut|CutLine", "Ctrl-k": "CutLine", "Ctrl-v": "Paste", "Home": "StartOfTextToggle", diff --git a/internal/action/defaults_other.go b/internal/action/defaults_other.go index 0e6a54b5..f0fa72fc 100644 --- a/internal/action/defaults_other.go +++ b/internal/action/defaults_other.go @@ -49,7 +49,7 @@ var bufdefaults = map[string]string{ "Ctrl-z": "Undo", "Ctrl-y": "Redo", "Ctrl-c": "Copy|CopyLine", - "Ctrl-x": "Cut", + "Ctrl-x": "Cut|CutLine", "Ctrl-k": "CutLine", "Ctrl-d": "DuplicateLine", "Ctrl-v": "Paste", @@ -148,7 +148,7 @@ var infodefaults = map[string]string{ "Ctrl-z": "Undo", "Ctrl-y": "Redo", "Ctrl-c": "Copy|CopyLine", - "Ctrl-x": "Cut", + "Ctrl-x": "Cut|CutLine", "Ctrl-k": "CutLine", "Ctrl-v": "Paste", "Home": "StartOfTextToggle", diff --git a/runtime/help/keybindings.md b/runtime/help/keybindings.md index 8926a542..ac7046d3 100644 --- a/runtime/help/keybindings.md +++ b/runtime/help/keybindings.md @@ -492,7 +492,7 @@ conventions for text editing defaults. "Ctrl-z": "Undo", "Ctrl-y": "Redo", "Ctrl-c": "Copy|CopyLine", - "Ctrl-x": "Cut", + "Ctrl-x": "Cut|CutLine", "Ctrl-k": "CutLine", "Ctrl-d": "DuplicateLine", "Ctrl-v": "Paste", @@ -616,7 +616,7 @@ are given below: "Ctrl-z": "Undo", "Ctrl-y": "Redo", "Ctrl-c": "Copy|CopyLine", - "Ctrl-x": "Cut", + "Ctrl-x": "Cut|CutLine", "Ctrl-k": "CutLine", "Ctrl-v": "Paste", "Home": "StartOfTextToggle",