diff --git a/pkg/ui/CodeContextMenu.go b/pkg/ui/CodeContextMenu.go index 2deacd33..1f4f6d7a 100644 --- a/pkg/ui/CodeContextMenu.go +++ b/pkg/ui/CodeContextMenu.go @@ -186,6 +186,9 @@ func update_selection_menu(code *CodeView) { code.main.CopyToClipboard(data) }, hide: menudata.previous_selection.emtry()}, + {item: create_menu_item("Cut"), handle: func() { + code.Cut() + }, hide: menudata.previous_selection.emtry()}, {item: create_menu_item("Paste"), handle: func() { code.Paste() }, hide: !has_clip}, diff --git a/pkg/ui/codeeditor.go b/pkg/ui/codeeditor.go index 3dab0c07..83fa0f14 100644 --- a/pkg/ui/codeeditor.go +++ b/pkg/ui/codeeditor.go @@ -128,6 +128,8 @@ type IEditorContent interface { deleteword() deltext() + Cut() + //code content GetLines(begin, end int) []string copyline(bool) diff --git a/pkg/ui/codeview.go b/pkg/ui/codeview.go index 1e4f1613..5e8f1226 100644 --- a/pkg/ui/codeview.go +++ b/pkg/ui/codeview.go @@ -1069,6 +1069,11 @@ func (v *codetextview) DeleteWordRight() bool { } return true } +func (code *CodeView) Cut() { + checker := code.NewChangeChecker() + defer checker.End() + code.view.Cut() +} func (code *CodeView) deleteword() { checker := code.NewChangeChecker() defer checker.End() diff --git a/pkg/ui/keymap.go b/pkg/ui/keymap.go index 797cf277..46a9a085 100644 --- a/pkg/ui/keymap.go +++ b/pkg/ui/keymap.go @@ -50,6 +50,7 @@ const ( zoomout copy_data vi_copy_text + vi_cut_text vi_del_text vi_undo vi_save @@ -415,18 +416,23 @@ func get_cmd_actor(m MainService, id command_id) cmdactor { m.current_editor().action_page_down(false) return true }} + case vi_cut_text: + return cmdactor{id, "Cut", func() bool { + m.current_editor().Cut() + return true + }} case vi_copy_text: return cmdactor{id, "Copy", func() bool { m.current_editor().copyline(false) return true }} case vi_del_text: - return cmdactor{id, "Del", func() bool { + return cmdactor{id, "Delete", func() bool { m.current_editor().deltext() return true }} case vi_del_line: - return cmdactor{id, "Delete", func() bool { + return cmdactor{id, "Delete Line", func() bool { m.current_editor().deleteline() return true }}