Adds CopyLine action, the new default action for CtrlC if cursor has no selection
This commit is contained in:
parent
f52fbfa1f0
commit
5d3e4fc3d9
5 changed files with 25 additions and 3 deletions
|
@ -930,6 +930,25 @@ func (h *BufPane) Copy() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Copy the current line to the clipboard
|
||||||
|
func (h *BufPane) CopyLine() bool {
|
||||||
|
if h.Cursor.HasSelection() {
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
h.Cursor.SelectLine()
|
||||||
|
h.Cursor.CopySelection("clipboard")
|
||||||
|
h.freshClip = true
|
||||||
|
if clipboard.Unsupported {
|
||||||
|
InfoBar.Message("Copied line (install xclip for external clipboard)")
|
||||||
|
} else {
|
||||||
|
InfoBar.Message("Copied line")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
h.Cursor.Deselect(true)
|
||||||
|
h.Relocate()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// CutLine cuts the current line to the clipboard
|
// CutLine cuts the current line to the clipboard
|
||||||
func (h *BufPane) CutLine() bool {
|
func (h *BufPane) CutLine() bool {
|
||||||
h.Cursor.SelectLine()
|
h.Cursor.SelectLine()
|
||||||
|
|
|
@ -558,6 +558,7 @@ var BufKeyActions = map[string]BufKeyAction{
|
||||||
"Undo": (*BufPane).Undo,
|
"Undo": (*BufPane).Undo,
|
||||||
"Redo": (*BufPane).Redo,
|
"Redo": (*BufPane).Redo,
|
||||||
"Copy": (*BufPane).Copy,
|
"Copy": (*BufPane).Copy,
|
||||||
|
"CopyLine": (*BufPane).CopyLine,
|
||||||
"Cut": (*BufPane).Cut,
|
"Cut": (*BufPane).Cut,
|
||||||
"CutLine": (*BufPane).CutLine,
|
"CutLine": (*BufPane).CutLine,
|
||||||
"DuplicateLine": (*BufPane).DuplicateLine,
|
"DuplicateLine": (*BufPane).DuplicateLine,
|
||||||
|
@ -669,6 +670,7 @@ var MultiActions = map[string]bool{
|
||||||
"InsertTab": true,
|
"InsertTab": true,
|
||||||
"FindNext": true,
|
"FindNext": true,
|
||||||
"FindPrevious": true,
|
"FindPrevious": true,
|
||||||
|
"CopyLine": true,
|
||||||
"Cut": true,
|
"Cut": true,
|
||||||
"CutLine": true,
|
"CutLine": true,
|
||||||
"DuplicateLine": true,
|
"DuplicateLine": true,
|
||||||
|
|
|
@ -43,7 +43,7 @@ func DefaultBindings() map[string]string {
|
||||||
"CtrlP": "FindPrevious",
|
"CtrlP": "FindPrevious",
|
||||||
"CtrlZ": "Undo",
|
"CtrlZ": "Undo",
|
||||||
"CtrlY": "Redo",
|
"CtrlY": "Redo",
|
||||||
"CtrlC": "Copy",
|
"CtrlC": "CopyLine|Copy",
|
||||||
"CtrlX": "Cut",
|
"CtrlX": "Cut",
|
||||||
"CtrlK": "CutLine",
|
"CtrlK": "CutLine",
|
||||||
"CtrlD": "DuplicateLine",
|
"CtrlD": "DuplicateLine",
|
||||||
|
|
|
@ -45,7 +45,7 @@ func DefaultBindings() map[string]string {
|
||||||
"CtrlP": "FindPrevious",
|
"CtrlP": "FindPrevious",
|
||||||
"CtrlZ": "Undo",
|
"CtrlZ": "Undo",
|
||||||
"CtrlY": "Redo",
|
"CtrlY": "Redo",
|
||||||
"CtrlC": "Copy",
|
"CtrlC": "CopyLine|Copy",
|
||||||
"CtrlX": "Cut",
|
"CtrlX": "Cut",
|
||||||
"CtrlK": "CutLine",
|
"CtrlK": "CutLine",
|
||||||
"CtrlD": "DuplicateLine",
|
"CtrlD": "DuplicateLine",
|
||||||
|
|
|
@ -190,6 +190,7 @@ FindPrevious
|
||||||
Undo
|
Undo
|
||||||
Redo
|
Redo
|
||||||
Copy
|
Copy
|
||||||
|
CopyLine
|
||||||
Cut
|
Cut
|
||||||
CutLine
|
CutLine
|
||||||
DuplicateLine
|
DuplicateLine
|
||||||
|
@ -455,7 +456,7 @@ conventions for text editing defaults.
|
||||||
"CtrlP": "FindPrevious",
|
"CtrlP": "FindPrevious",
|
||||||
"CtrlZ": "Undo",
|
"CtrlZ": "Undo",
|
||||||
"CtrlY": "Redo",
|
"CtrlY": "Redo",
|
||||||
"CtrlC": "Copy",
|
"CtrlC": "CopyLine|Copy",
|
||||||
"CtrlX": "Cut",
|
"CtrlX": "Cut",
|
||||||
"CtrlK": "CutLine",
|
"CtrlK": "CutLine",
|
||||||
"CtrlD": "DuplicateLine",
|
"CtrlD": "DuplicateLine",
|
||||||
|
|
Loading…
Reference in a new issue