mirror of
https://github.com/zyedidia/micro.git
synced 2025-06-18 14:55:38 -04:00
Merge b18e190daf
into 5eddf5b85d
This commit is contained in:
commit
179313c41f
@ -1394,11 +1394,37 @@ func (h *BufPane) Cut() bool {
|
||||
|
||||
// CutLine cuts the current line to the clipboard. If there is a selection,
|
||||
// CutLine cuts all the lines that are (fully or partially) in the selection.
|
||||
// CutLine will replace the clipboard's current buffer.
|
||||
func (h *BufPane) CutLine() bool {
|
||||
totalLines := h.selectLines()
|
||||
if totalLines == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
h.Cursor.CopySelection(clipboard.ClipboardReg)
|
||||
h.freshClip = true
|
||||
h.Cursor.DeleteSelection()
|
||||
h.Cursor.ResetSelection()
|
||||
h.Cursor.StoreVisualX()
|
||||
if totalLines > 1 {
|
||||
InfoBar.Message(fmt.Sprintf("Cut %d lines", totalLines))
|
||||
} else {
|
||||
InfoBar.Message("Cut line")
|
||||
}
|
||||
|
||||
h.Relocate()
|
||||
return true
|
||||
}
|
||||
|
||||
// CutLineAppend cuts the current line to the clipboard. If there is a selection,
|
||||
// CutLineAppend cuts all the lines that are (fully or partially) in the selection.
|
||||
// CutLineAppend will append the selection to the clipboard's buffer.
|
||||
func (h *BufPane) CutLineAppend() bool {
|
||||
nlines := h.selectLines()
|
||||
if nlines == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
totalLines := nlines
|
||||
if h.freshClip {
|
||||
if clip, err := clipboard.Read(clipboard.ClipboardReg); err != nil {
|
||||
@ -1411,15 +1437,17 @@ func (h *BufPane) CutLine() bool {
|
||||
} else {
|
||||
h.Cursor.CopySelection(clipboard.ClipboardReg)
|
||||
}
|
||||
|
||||
h.freshClip = true
|
||||
h.Cursor.DeleteSelection()
|
||||
h.Cursor.ResetSelection()
|
||||
h.Cursor.StoreVisualX()
|
||||
if totalLines > 1 {
|
||||
InfoBar.Message(fmt.Sprintf("Cut %d lines", totalLines))
|
||||
if nlines > 1 {
|
||||
InfoBar.Message(fmt.Sprintf("Cut %d lines. Total lines in buffer: %d.", nlines, totalLines))
|
||||
} else {
|
||||
InfoBar.Message("Cut line")
|
||||
InfoBar.Message(fmt.Sprintf("Cut line. Total lines in buffer: %d.", totalLines))
|
||||
}
|
||||
|
||||
h.Relocate()
|
||||
return true
|
||||
}
|
||||
|
@ -781,6 +781,7 @@ var BufKeyActions = map[string]BufKeyAction{
|
||||
"CopyLine": (*BufPane).CopyLine,
|
||||
"Cut": (*BufPane).Cut,
|
||||
"CutLine": (*BufPane).CutLine,
|
||||
"CutLineAppend": (*BufPane).CutLineAppend,
|
||||
"Duplicate": (*BufPane).Duplicate,
|
||||
"DuplicateLine": (*BufPane).DuplicateLine,
|
||||
"DeleteLine": (*BufPane).DeleteLine,
|
||||
|
@ -47,7 +47,7 @@ var bufdefaults = map[string]string{
|
||||
"Ctrl-y": "Redo",
|
||||
"Ctrl-c": "Copy|CopyLine",
|
||||
"Ctrl-x": "Cut|CutLine",
|
||||
"Ctrl-k": "CutLine",
|
||||
"Ctrl-k": "CutLineAppend",
|
||||
"Ctrl-d": "Duplicate|DuplicateLine",
|
||||
"Ctrl-v": "Paste",
|
||||
"Ctrl-a": "SelectAll",
|
||||
@ -148,7 +148,7 @@ var infodefaults = map[string]string{
|
||||
"Ctrl-y": "Redo",
|
||||
"Ctrl-c": "Copy|CopyLine",
|
||||
"Ctrl-x": "Cut|CutLine",
|
||||
"Ctrl-k": "CutLine",
|
||||
"Ctrl-k": "CutLineAppend",
|
||||
"Ctrl-v": "Paste",
|
||||
"Home": "StartOfTextToggle",
|
||||
"End": "EndOfLine",
|
||||
|
@ -50,7 +50,7 @@ var bufdefaults = map[string]string{
|
||||
"Ctrl-y": "Redo",
|
||||
"Ctrl-c": "Copy|CopyLine",
|
||||
"Ctrl-x": "Cut|CutLine",
|
||||
"Ctrl-k": "CutLine",
|
||||
"Ctrl-k": "CutLineAppend",
|
||||
"Ctrl-d": "Duplicate|DuplicateLine",
|
||||
"Ctrl-v": "Paste",
|
||||
"Ctrl-a": "SelectAll",
|
||||
@ -151,7 +151,7 @@ var infodefaults = map[string]string{
|
||||
"Ctrl-y": "Redo",
|
||||
"Ctrl-c": "Copy|CopyLine",
|
||||
"Ctrl-x": "Cut|CutLine",
|
||||
"Ctrl-k": "CutLine",
|
||||
"Ctrl-k": "CutLineAppend",
|
||||
"Ctrl-v": "Paste",
|
||||
"Home": "StartOfTextToggle",
|
||||
"End": "EndOfLine",
|
||||
|
@ -524,7 +524,7 @@ conventions for text editing defaults.
|
||||
"Ctrl-y": "Redo",
|
||||
"Ctrl-c": "Copy|CopyLine",
|
||||
"Ctrl-x": "Cut|CutLine",
|
||||
"Ctrl-k": "CutLine",
|
||||
"Ctrl-k": "CutLineAppend",
|
||||
"Ctrl-d": "Duplicate|DuplicateLine",
|
||||
"Ctrl-v": "Paste",
|
||||
"Ctrl-a": "SelectAll",
|
||||
@ -650,7 +650,7 @@ are given below:
|
||||
"Ctrl-y": "Redo",
|
||||
"Ctrl-c": "Copy|CopyLine",
|
||||
"Ctrl-x": "Cut|CutLine",
|
||||
"Ctrl-k": "CutLine",
|
||||
"Ctrl-k": "CutLineAppend",
|
||||
"Ctrl-v": "Paste",
|
||||
"Home": "StartOfTextToggle",
|
||||
"End": "EndOfLine",
|
||||
|
Loading…
Reference in New Issue
Block a user