Merge branch 'jwarner112-jwarner112-copyline'

This commit is contained in:
Zachary Yedidia 2020-04-30 00:54:11 -04:00
commit 221d8f462a
6 changed files with 227 additions and 206 deletions

View File

@ -354,7 +354,6 @@ func (h *BufPane) SelectToStartOfTextToggle() bool {
return true return true
} }
// SelectToStartOfLine selects to the start of the current line // SelectToStartOfLine selects to the start of the current line
func (h *BufPane) SelectToStartOfLine() bool { func (h *BufPane) SelectToStartOfLine() bool {
if !h.Cursor.HasSelection() { if !h.Cursor.HasSelection() {
@ -930,6 +929,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()
@ -1448,7 +1466,7 @@ func (h *BufPane) AddTab() bool {
// PreviousTab switches to the previous tab in the tab list // PreviousTab switches to the previous tab in the tab list
func (h *BufPane) PreviousTab() bool { func (h *BufPane) PreviousTab() bool {
tabsLen := len(Tabs.List) tabsLen := len(Tabs.List)
a := Tabs.Active() + tabsLen a := Tabs.Active() + tabsLen
Tabs.SetActive((a - 1) % tabsLen) Tabs.SetActive((a - 1) % tabsLen)
return true return true

View File

@ -517,112 +517,113 @@ func (h *BufPane) SetActive(b bool) {
// BufKeyActions contains the list of all possible key actions the bufhandler could execute // BufKeyActions contains the list of all possible key actions the bufhandler could execute
var BufKeyActions = map[string]BufKeyAction{ var BufKeyActions = map[string]BufKeyAction{
"CursorUp": (*BufPane).CursorUp, "CursorUp": (*BufPane).CursorUp,
"CursorDown": (*BufPane).CursorDown, "CursorDown": (*BufPane).CursorDown,
"CursorPageUp": (*BufPane).CursorPageUp, "CursorPageUp": (*BufPane).CursorPageUp,
"CursorPageDown": (*BufPane).CursorPageDown, "CursorPageDown": (*BufPane).CursorPageDown,
"CursorLeft": (*BufPane).CursorLeft, "CursorLeft": (*BufPane).CursorLeft,
"CursorRight": (*BufPane).CursorRight, "CursorRight": (*BufPane).CursorRight,
"CursorStart": (*BufPane).CursorStart, "CursorStart": (*BufPane).CursorStart,
"CursorEnd": (*BufPane).CursorEnd, "CursorEnd": (*BufPane).CursorEnd,
"SelectToStart": (*BufPane).SelectToStart, "SelectToStart": (*BufPane).SelectToStart,
"SelectToEnd": (*BufPane).SelectToEnd, "SelectToEnd": (*BufPane).SelectToEnd,
"SelectUp": (*BufPane).SelectUp, "SelectUp": (*BufPane).SelectUp,
"SelectDown": (*BufPane).SelectDown, "SelectDown": (*BufPane).SelectDown,
"SelectLeft": (*BufPane).SelectLeft, "SelectLeft": (*BufPane).SelectLeft,
"SelectRight": (*BufPane).SelectRight, "SelectRight": (*BufPane).SelectRight,
"WordRight": (*BufPane).WordRight, "WordRight": (*BufPane).WordRight,
"WordLeft": (*BufPane).WordLeft, "WordLeft": (*BufPane).WordLeft,
"SelectWordRight": (*BufPane).SelectWordRight, "SelectWordRight": (*BufPane).SelectWordRight,
"SelectWordLeft": (*BufPane).SelectWordLeft, "SelectWordLeft": (*BufPane).SelectWordLeft,
"DeleteWordRight": (*BufPane).DeleteWordRight, "DeleteWordRight": (*BufPane).DeleteWordRight,
"DeleteWordLeft": (*BufPane).DeleteWordLeft, "DeleteWordLeft": (*BufPane).DeleteWordLeft,
"SelectLine": (*BufPane).SelectLine, "SelectLine": (*BufPane).SelectLine,
"SelectToStartOfLine": (*BufPane).SelectToStartOfLine, "SelectToStartOfLine": (*BufPane).SelectToStartOfLine,
"SelectToStartOfText": (*BufPane).SelectToStartOfText, "SelectToStartOfText": (*BufPane).SelectToStartOfText,
"SelectToStartOfTextToggle":(*BufPane).SelectToStartOfTextToggle, "SelectToStartOfTextToggle": (*BufPane).SelectToStartOfTextToggle,
"SelectToEndOfLine": (*BufPane).SelectToEndOfLine, "SelectToEndOfLine": (*BufPane).SelectToEndOfLine,
"ParagraphPrevious": (*BufPane).ParagraphPrevious, "ParagraphPrevious": (*BufPane).ParagraphPrevious,
"ParagraphNext": (*BufPane).ParagraphNext, "ParagraphNext": (*BufPane).ParagraphNext,
"InsertNewline": (*BufPane).InsertNewline, "InsertNewline": (*BufPane).InsertNewline,
"Backspace": (*BufPane).Backspace, "Backspace": (*BufPane).Backspace,
"Delete": (*BufPane).Delete, "Delete": (*BufPane).Delete,
"InsertTab": (*BufPane).InsertTab, "InsertTab": (*BufPane).InsertTab,
"Save": (*BufPane).Save, "Save": (*BufPane).Save,
"SaveAll": (*BufPane).SaveAll, "SaveAll": (*BufPane).SaveAll,
"SaveAs": (*BufPane).SaveAs, "SaveAs": (*BufPane).SaveAs,
"Find": (*BufPane).Find, "Find": (*BufPane).Find,
"FindNext": (*BufPane).FindNext, "FindNext": (*BufPane).FindNext,
"FindPrevious": (*BufPane).FindPrevious, "FindPrevious": (*BufPane).FindPrevious,
"Center": (*BufPane).Center, "Center": (*BufPane).Center,
"Undo": (*BufPane).Undo, "Undo": (*BufPane).Undo,
"Redo": (*BufPane).Redo, "Redo": (*BufPane).Redo,
"Copy": (*BufPane).Copy, "Copy": (*BufPane).Copy,
"Cut": (*BufPane).Cut, "CopyLine": (*BufPane).CopyLine,
"CutLine": (*BufPane).CutLine, "Cut": (*BufPane).Cut,
"DuplicateLine": (*BufPane).DuplicateLine, "CutLine": (*BufPane).CutLine,
"DeleteLine": (*BufPane).DeleteLine, "DuplicateLine": (*BufPane).DuplicateLine,
"MoveLinesUp": (*BufPane).MoveLinesUp, "DeleteLine": (*BufPane).DeleteLine,
"MoveLinesDown": (*BufPane).MoveLinesDown, "MoveLinesUp": (*BufPane).MoveLinesUp,
"IndentSelection": (*BufPane).IndentSelection, "MoveLinesDown": (*BufPane).MoveLinesDown,
"OutdentSelection": (*BufPane).OutdentSelection, "IndentSelection": (*BufPane).IndentSelection,
"Autocomplete": (*BufPane).Autocomplete, "OutdentSelection": (*BufPane).OutdentSelection,
"CycleAutocompleteBack": (*BufPane).CycleAutocompleteBack, "Autocomplete": (*BufPane).Autocomplete,
"OutdentLine": (*BufPane).OutdentLine, "CycleAutocompleteBack": (*BufPane).CycleAutocompleteBack,
"IndentLine": (*BufPane).IndentLine, "OutdentLine": (*BufPane).OutdentLine,
"Paste": (*BufPane).Paste, "IndentLine": (*BufPane).IndentLine,
"PastePrimary": (*BufPane).PastePrimary, "Paste": (*BufPane).Paste,
"SelectAll": (*BufPane).SelectAll, "PastePrimary": (*BufPane).PastePrimary,
"OpenFile": (*BufPane).OpenFile, "SelectAll": (*BufPane).SelectAll,
"Start": (*BufPane).Start, "OpenFile": (*BufPane).OpenFile,
"End": (*BufPane).End, "Start": (*BufPane).Start,
"PageUp": (*BufPane).PageUp, "End": (*BufPane).End,
"PageDown": (*BufPane).PageDown, "PageUp": (*BufPane).PageUp,
"SelectPageUp": (*BufPane).SelectPageUp, "PageDown": (*BufPane).PageDown,
"SelectPageDown": (*BufPane).SelectPageDown, "SelectPageUp": (*BufPane).SelectPageUp,
"HalfPageUp": (*BufPane).HalfPageUp, "SelectPageDown": (*BufPane).SelectPageDown,
"HalfPageDown": (*BufPane).HalfPageDown, "HalfPageUp": (*BufPane).HalfPageUp,
"StartOfText": (*BufPane).StartOfText, "HalfPageDown": (*BufPane).HalfPageDown,
"StartOfTextToggle": (*BufPane).StartOfTextToggle, "StartOfText": (*BufPane).StartOfText,
"StartOfLine": (*BufPane).StartOfLine, "StartOfTextToggle": (*BufPane).StartOfTextToggle,
"EndOfLine": (*BufPane).EndOfLine, "StartOfLine": (*BufPane).StartOfLine,
"ToggleHelp": (*BufPane).ToggleHelp, "EndOfLine": (*BufPane).EndOfLine,
"ToggleKeyMenu": (*BufPane).ToggleKeyMenu, "ToggleHelp": (*BufPane).ToggleHelp,
"ToggleDiffGutter": (*BufPane).ToggleDiffGutter, "ToggleKeyMenu": (*BufPane).ToggleKeyMenu,
"ToggleRuler": (*BufPane).ToggleRuler, "ToggleDiffGutter": (*BufPane).ToggleDiffGutter,
"ClearStatus": (*BufPane).ClearStatus, "ToggleRuler": (*BufPane).ToggleRuler,
"ShellMode": (*BufPane).ShellMode, "ClearStatus": (*BufPane).ClearStatus,
"CommandMode": (*BufPane).CommandMode, "ShellMode": (*BufPane).ShellMode,
"ToggleOverwriteMode": (*BufPane).ToggleOverwriteMode, "CommandMode": (*BufPane).CommandMode,
"Escape": (*BufPane).Escape, "ToggleOverwriteMode": (*BufPane).ToggleOverwriteMode,
"Quit": (*BufPane).Quit, "Escape": (*BufPane).Escape,
"QuitAll": (*BufPane).QuitAll, "Quit": (*BufPane).Quit,
"AddTab": (*BufPane).AddTab, "QuitAll": (*BufPane).QuitAll,
"PreviousTab": (*BufPane).PreviousTab, "AddTab": (*BufPane).AddTab,
"NextTab": (*BufPane).NextTab, "PreviousTab": (*BufPane).PreviousTab,
"NextSplit": (*BufPane).NextSplit, "NextTab": (*BufPane).NextTab,
"PreviousSplit": (*BufPane).PreviousSplit, "NextSplit": (*BufPane).NextSplit,
"Unsplit": (*BufPane).Unsplit, "PreviousSplit": (*BufPane).PreviousSplit,
"VSplit": (*BufPane).VSplitAction, "Unsplit": (*BufPane).Unsplit,
"HSplit": (*BufPane).HSplitAction, "VSplit": (*BufPane).VSplitAction,
"ToggleMacro": (*BufPane).ToggleMacro, "HSplit": (*BufPane).HSplitAction,
"PlayMacro": (*BufPane).PlayMacro, "ToggleMacro": (*BufPane).ToggleMacro,
"Suspend": (*BufPane).Suspend, "PlayMacro": (*BufPane).PlayMacro,
"ScrollUp": (*BufPane).ScrollUpAction, "Suspend": (*BufPane).Suspend,
"ScrollDown": (*BufPane).ScrollDownAction, "ScrollUp": (*BufPane).ScrollUpAction,
"SpawnMultiCursor": (*BufPane).SpawnMultiCursor, "ScrollDown": (*BufPane).ScrollDownAction,
"SpawnMultiCursorUp": (*BufPane).SpawnMultiCursorUp, "SpawnMultiCursor": (*BufPane).SpawnMultiCursor,
"SpawnMultiCursorDown": (*BufPane).SpawnMultiCursorDown, "SpawnMultiCursorUp": (*BufPane).SpawnMultiCursorUp,
"SpawnMultiCursorSelect": (*BufPane).SpawnMultiCursorSelect, "SpawnMultiCursorDown": (*BufPane).SpawnMultiCursorDown,
"RemoveMultiCursor": (*BufPane).RemoveMultiCursor, "SpawnMultiCursorSelect": (*BufPane).SpawnMultiCursorSelect,
"RemoveAllMultiCursors": (*BufPane).RemoveAllMultiCursors, "RemoveMultiCursor": (*BufPane).RemoveMultiCursor,
"SkipMultiCursor": (*BufPane).SkipMultiCursor, "RemoveAllMultiCursors": (*BufPane).RemoveAllMultiCursors,
"JumpToMatchingBrace": (*BufPane).JumpToMatchingBrace, "SkipMultiCursor": (*BufPane).SkipMultiCursor,
"JumpLine": (*BufPane).JumpLine, "JumpToMatchingBrace": (*BufPane).JumpToMatchingBrace,
"None": (*BufPane).None, "JumpLine": (*BufPane).JumpLine,
"None": (*BufPane).None,
// This was changed to InsertNewline but I don't want to break backwards compatibility // This was changed to InsertNewline but I don't want to break backwards compatibility
"InsertEnter": (*BufPane).InsertNewline, "InsertEnter": (*BufPane).InsertNewline,
} }
// BufMouseActions contains the list of all possible mouse actions the bufhandler could execute // BufMouseActions contains the list of all possible mouse actions the bufhandler could execute
@ -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,

View File

@ -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",

View File

@ -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",

View File

@ -16,7 +16,7 @@ func TestAuto1(t *testing.T) {
"", "",
}, },
[]operation{ []operation{
operation{ {
start: Loc{1, 0}, start: Loc{1, 0},
end: Loc{1, 0}, end: Loc{1, 0},
text: []string{ text: []string{
@ -25,7 +25,7 @@ func TestAuto1(t *testing.T) {
"fq", "fq",
}, },
}, },
operation{ {
start: Loc{3, 0}, start: Loc{3, 0},
end: Loc{0, 1}, end: Loc{0, 1},
text: []string{ text: []string{
@ -58,7 +58,7 @@ func TestAuto2(t *testing.T) {
"gmm", "gmm",
}, },
[]operation{ []operation{
operation{ {
start: Loc{1, 0}, start: Loc{1, 0},
end: Loc{1, 0}, end: Loc{1, 0},
text: []string{ text: []string{
@ -66,7 +66,7 @@ func TestAuto2(t *testing.T) {
"o", "o",
}, },
}, },
operation{ {
start: Loc{3, 1}, start: Loc{3, 1},
end: Loc{3, 1}, end: Loc{3, 1},
text: []string{ text: []string{
@ -74,7 +74,7 @@ func TestAuto2(t *testing.T) {
"avb", "avb",
}, },
}, },
operation{ {
start: Loc{4, 1}, start: Loc{4, 1},
end: Loc{1, 5}, end: Loc{1, 5},
text: []string{ text: []string{
@ -111,7 +111,7 @@ func TestAuto3(t *testing.T) {
"xuccnb", "xuccnb",
}, },
[]operation{ []operation{
operation{ {
start: Loc{2, 3}, start: Loc{2, 3},
end: Loc{2, 3}, end: Loc{2, 3},
text: []string{ text: []string{
@ -145,14 +145,14 @@ func TestAuto4(t *testing.T) {
"lnqdgorosf", "lnqdgorosf",
}, },
[]operation{ []operation{
operation{ {
start: Loc{2, 0}, start: Loc{2, 0},
end: Loc{4, 0}, end: Loc{4, 0},
text: []string{ text: []string{
"hp", "hp",
}, },
}, },
operation{ {
start: Loc{6, 0}, start: Loc{6, 0},
end: Loc{0, 1}, end: Loc{0, 1},
text: []string{ text: []string{
@ -161,7 +161,7 @@ func TestAuto4(t *testing.T) {
"mpx", "mpx",
}, },
}, },
operation{ {
start: Loc{1, 1}, start: Loc{1, 1},
end: Loc{1, 1}, end: Loc{1, 1},
text: []string{ text: []string{
@ -170,7 +170,7 @@ func TestAuto4(t *testing.T) {
"", "",
}, },
}, },
operation{ {
start: Loc{1, 1}, start: Loc{1, 1},
end: Loc{1, 1}, end: Loc{1, 1},
text: []string{ text: []string{
@ -178,7 +178,7 @@ func TestAuto4(t *testing.T) {
"mo", "mo",
}, },
}, },
operation{ {
start: Loc{1, 3}, start: Loc{1, 3},
end: Loc{2, 4}, end: Loc{2, 4},
text: []string{ text: []string{
@ -210,14 +210,14 @@ func TestBug19872UndoIsFunky(t *testing.T) {
"something else", "something else",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 1}, start: Loc{0, 1},
end: Loc{1, 1}, end: Loc{1, 1},
text: []string{ text: []string{
"", "",
}, },
}, },
operation{ {
start: Loc{0, 2}, start: Loc{0, 2},
end: Loc{1, 3}, end: Loc{1, 3},
text: []string{ text: []string{
@ -244,14 +244,14 @@ func TestBug19872UndoIsFunky_2(t *testing.T) {
"something else", "something else",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 1}, start: Loc{0, 1},
end: Loc{0, 1}, end: Loc{0, 1},
text: []string{ text: []string{
" ", " ",
}, },
}, },
operation{ {
start: Loc{0, 2}, start: Loc{0, 2},
end: Loc{0, 2}, end: Loc{0, 2},
text: []string{ text: []string{
@ -281,7 +281,7 @@ func TestInsertEmptyText(t *testing.T) {
"1", "1",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{0, 0}, end: Loc{0, 0},
text: []string{ text: []string{
@ -310,14 +310,14 @@ func TestLastOpIsNoOp(t *testing.T) {
"1", "1",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{1, 0}, end: Loc{1, 0},
text: []string{ text: []string{
"", "",
}, },
}, },
operation{ {
start: Loc{0, 3}, start: Loc{0, 3},
end: Loc{0, 3}, end: Loc{0, 3},
text: []string{ text: []string{
@ -346,7 +346,7 @@ func TestInsertTextWithoutNewline1(t *testing.T) {
"1", "1",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{0, 0}, end: Loc{0, 0},
text: []string{ text: []string{
@ -375,7 +375,7 @@ func TestInsertTextWithoutNewline2(t *testing.T) {
"1", "1",
}, },
[]operation{ []operation{
operation{ {
start: Loc{2, 0}, start: Loc{2, 0},
end: Loc{2, 0}, end: Loc{2, 0},
text: []string{ text: []string{
@ -404,7 +404,7 @@ func TestInsertOneNewline(t *testing.T) {
"1", "1",
}, },
[]operation{ []operation{
operation{ {
start: Loc{3, 0}, start: Loc{3, 0},
end: Loc{3, 0}, end: Loc{3, 0},
text: []string{ text: []string{
@ -435,7 +435,7 @@ func TestInsertTextWithOneNewline(t *testing.T) {
"1", "1",
}, },
[]operation{ []operation{
operation{ {
start: Loc{2, 0}, start: Loc{2, 0},
end: Loc{2, 0}, end: Loc{2, 0},
text: []string{ text: []string{
@ -466,7 +466,7 @@ func TestInsertTextWithTwoNewlines(t *testing.T) {
"1", "1",
}, },
[]operation{ []operation{
operation{ {
start: Loc{2, 0}, start: Loc{2, 0},
end: Loc{2, 0}, end: Loc{2, 0},
text: []string{ text: []string{
@ -499,7 +499,7 @@ func TestInsertTextWithManyNewlines(t *testing.T) {
"1", "1",
}, },
[]operation{ []operation{
operation{ {
start: Loc{2, 0}, start: Loc{2, 0},
end: Loc{2, 0}, end: Loc{2, 0},
text: []string{ text: []string{
@ -536,7 +536,7 @@ func TestInsertMultipleNewlines(t *testing.T) {
"1", "1",
}, },
[]operation{ []operation{
operation{ {
start: Loc{2, 0}, start: Loc{2, 0},
end: Loc{2, 0}, end: Loc{2, 0},
text: []string{ text: []string{
@ -547,7 +547,7 @@ func TestInsertMultipleNewlines(t *testing.T) {
"", "",
}, },
}, },
operation{ {
start: Loc{14, 2}, start: Loc{14, 2},
end: Loc{14, 2}, end: Loc{14, 2},
text: []string{ text: []string{
@ -582,7 +582,7 @@ func TestDeleteEmptyText(t *testing.T) {
"1", "1",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{0, 0}, end: Loc{0, 0},
text: []string{ text: []string{
@ -611,7 +611,7 @@ func TestDeleteTextFromOneLine(t *testing.T) {
"1", "1",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{1, 0}, end: Loc{1, 0},
text: []string{ text: []string{
@ -640,7 +640,7 @@ func TestDeleteTextFromOneLine2(t *testing.T) {
"1", "1",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{2, 0}, end: Loc{2, 0},
text: []string{ text: []string{
@ -669,7 +669,7 @@ func TestDeleteAllTextFromALine(t *testing.T) {
"1", "1",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{13, 0}, end: Loc{13, 0},
text: []string{ text: []string{
@ -698,7 +698,7 @@ func TestDeleteTextFromTwoLines(t *testing.T) {
"1", "1",
}, },
[]operation{ []operation{
operation{ {
start: Loc{3, 0}, start: Loc{3, 0},
end: Loc{5, 1}, end: Loc{5, 1},
text: []string{ text: []string{
@ -726,7 +726,7 @@ func TestDeleteTextFromManyLines(t *testing.T) {
"1", "1",
}, },
[]operation{ []operation{
operation{ {
start: Loc{3, 0}, start: Loc{3, 0},
end: Loc{4, 2}, end: Loc{4, 2},
text: []string{ text: []string{
@ -753,7 +753,7 @@ func TestDeleteEverything(t *testing.T) {
"1", "1",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{1, 4}, end: Loc{1, 4},
text: []string{ text: []string{
@ -778,14 +778,14 @@ func TestTwoUnrelatedEdits(t *testing.T) {
"123", "123",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 1}, start: Loc{0, 1},
end: Loc{2, 1}, end: Loc{2, 1},
text: []string{ text: []string{
"\t", "\t",
}, },
}, },
operation{ {
start: Loc{0, 2}, start: Loc{0, 2},
end: Loc{4, 2}, end: Loc{4, 2},
text: []string{ text: []string{
@ -814,14 +814,14 @@ func TestTwoEditsOnOneLine(t *testing.T) {
"\t\t<!@#fifth#@!>\t\t", "\t\t<!@#fifth#@!>\t\t",
}, },
[]operation{ []operation{
operation{ {
start: Loc{2, 4}, start: Loc{2, 4},
end: Loc{6, 4}, end: Loc{6, 4},
text: []string{ text: []string{
"", "",
}, },
}, },
operation{ {
start: Loc{11, 4}, start: Loc{11, 4},
end: Loc{15, 4}, end: Loc{15, 4},
text: []string{ text: []string{
@ -846,21 +846,21 @@ func TestManyEdits(t *testing.T) {
"{\"x\" : 1}", "{\"x\" : 1}",
}, },
[]operation{ []operation{
operation{ {
start: Loc{1, 0}, start: Loc{1, 0},
end: Loc{1, 0}, end: Loc{1, 0},
text: []string{ text: []string{
"\n ", "\n ",
}, },
}, },
operation{ {
start: Loc{4, 0}, start: Loc{4, 0},
end: Loc{5, 0}, end: Loc{5, 0},
text: []string{ text: []string{
"", "",
}, },
}, },
operation{ {
start: Loc{8, 0}, start: Loc{8, 0},
end: Loc{8, 0}, end: Loc{8, 0},
text: []string{ text: []string{
@ -885,21 +885,21 @@ func TestManyEditsReversed(t *testing.T) {
"}", "}",
}, },
[]operation{ []operation{
operation{ {
start: Loc{1, 0}, start: Loc{1, 0},
end: Loc{2, 1}, end: Loc{2, 1},
text: []string{ text: []string{
"", "",
}, },
}, },
operation{ {
start: Loc{5, 1}, start: Loc{5, 1},
end: Loc{5, 1}, end: Loc{5, 1},
text: []string{ text: []string{
" ", " ",
}, },
}, },
operation{ {
start: Loc{8, 1}, start: Loc{8, 1},
end: Loc{0, 2}, end: Loc{0, 2},
text: []string{ text: []string{
@ -924,7 +924,7 @@ func TestReplacingNewlines1(t *testing.T) {
"}", "}",
}, },
[]operation{ []operation{
operation{ {
start: Loc{1, 0}, start: Loc{1, 0},
end: Loc{0, 1}, end: Loc{0, 1},
text: []string{ text: []string{
@ -932,7 +932,7 @@ func TestReplacingNewlines1(t *testing.T) {
"\t", "\t",
}, },
}, },
operation{ {
start: Loc{10, 1}, start: Loc{10, 1},
end: Loc{0, 3}, end: Loc{0, 3},
text: []string{ text: []string{
@ -962,7 +962,7 @@ func TestReplacingNewlines2(t *testing.T) {
"and the last line", "and the last line",
}, },
[]operation{ []operation{
operation{ {
start: Loc{4, 0}, start: Loc{4, 0},
end: Loc{0, 2}, end: Loc{0, 2},
text: []string{ text: []string{
@ -971,7 +971,7 @@ func TestReplacingNewlines2(t *testing.T) {
"some more text", "some more text",
}, },
}, },
operation{ {
start: Loc{1, 2}, start: Loc{1, 2},
end: Loc{0, 3}, end: Loc{0, 3},
text: []string{ text: []string{
@ -981,14 +981,14 @@ func TestReplacingNewlines2(t *testing.T) {
"asd", "asd",
}, },
}, },
operation{ {
start: Loc{0, 4}, start: Loc{0, 4},
end: Loc{5, 4}, end: Loc{5, 4},
text: []string{ text: []string{
"zzzzzzzz", "zzzzzzzz",
}, },
}, },
operation{ {
start: Loc{10, 4}, start: Loc{10, 4},
end: Loc{15, 5}, end: Loc{15, 5},
text: []string{ text: []string{
@ -1024,14 +1024,14 @@ func TestAdvanced1(t *testing.T) {
" ,\"e\": /*comment*/ [null] }", " ,\"e\": /*comment*/ [null] }",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{1, 0}, end: Loc{1, 0},
text: []string{ text: []string{
"", "",
}, },
}, },
operation{ {
start: Loc{2, 0}, start: Loc{2, 0},
end: Loc{9, 0}, end: Loc{9, 0},
text: []string{ text: []string{
@ -1039,7 +1039,7 @@ func TestAdvanced1(t *testing.T) {
" ", " ",
}, },
}, },
operation{ {
start: Loc{15, 0}, start: Loc{15, 0},
end: Loc{13, 1}, end: Loc{13, 1},
text: []string{ text: []string{
@ -1047,7 +1047,7 @@ func TestAdvanced1(t *testing.T) {
" ", " ",
}, },
}, },
operation{ {
start: Loc{17, 1}, start: Loc{17, 1},
end: Loc{8, 2}, end: Loc{8, 2},
text: []string{ text: []string{
@ -1055,14 +1055,14 @@ func TestAdvanced1(t *testing.T) {
" ", " ",
}, },
}, },
operation{ {
start: Loc{21, 2}, start: Loc{21, 2},
end: Loc{8, 3}, end: Loc{8, 3},
text: []string{ text: []string{
"", "",
}, },
}, },
operation{ {
start: Loc{9, 3}, start: Loc{9, 3},
end: Loc{9, 3}, end: Loc{9, 3},
text: []string{ text: []string{
@ -1070,7 +1070,7 @@ func TestAdvanced1(t *testing.T) {
" ", " ",
}, },
}, },
operation{ {
start: Loc{27, 3}, start: Loc{27, 3},
end: Loc{27, 3}, end: Loc{27, 3},
text: []string{ text: []string{
@ -1078,7 +1078,7 @@ func TestAdvanced1(t *testing.T) {
" ", " ",
}, },
}, },
operation{ {
start: Loc{31, 3}, start: Loc{31, 3},
end: Loc{31, 3}, end: Loc{31, 3},
text: []string{ text: []string{
@ -1086,7 +1086,7 @@ func TestAdvanced1(t *testing.T) {
" ", " ",
}, },
}, },
operation{ {
start: Loc{32, 3}, start: Loc{32, 3},
end: Loc{33, 3}, end: Loc{33, 3},
text: []string{ text: []string{
@ -1116,21 +1116,21 @@ func TestAdvancedSimplified(t *testing.T) {
" ,def", " ,def",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{3, 0}, end: Loc{3, 0},
text: []string{ text: []string{
"", "",
}, },
}, },
operation{ {
start: Loc{6, 0}, start: Loc{6, 0},
end: Loc{1, 1}, end: Loc{1, 1},
text: []string{ text: []string{
"", "",
}, },
}, },
operation{ {
start: Loc{2, 1}, start: Loc{2, 1},
end: Loc{2, 1}, end: Loc{2, 1},
text: []string{ text: []string{
@ -1158,7 +1158,7 @@ func TestIssue144(t *testing.T) {
"", "",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{0, 5}, end: Loc{0, 5},
text: []string{ text: []string{
@ -1194,7 +1194,7 @@ func TestIssue2586ReplacingSelectedEndOfLineWithNewlineLocksUpTheDocument(t *tes
"interesting", "interesting",
}, },
[]operation{ []operation{
operation{ {
start: Loc{9, 0}, start: Loc{9, 0},
end: Loc{0, 1}, end: Loc{0, 1},
text: []string{ text: []string{
@ -1222,7 +1222,7 @@ func TestIssue3980(t *testing.T) {
"}", "}",
}, },
[]operation{ []operation{
operation{ {
start: Loc{7, 0}, start: Loc{7, 0},
end: Loc{8, 0}, end: Loc{8, 0},
text: []string{ text: []string{
@ -1230,7 +1230,7 @@ func TestIssue3980(t *testing.T) {
"", "",
}, },
}, },
operation{ {
start: Loc{16, 2}, start: Loc{16, 2},
end: Loc{17, 2}, end: Loc{17, 2},
text: []string{ text: []string{
@ -1238,14 +1238,14 @@ func TestIssue3980(t *testing.T) {
"", "",
}, },
}, },
operation{ {
start: Loc{17, 2}, start: Loc{17, 2},
end: Loc{17, 2}, end: Loc{17, 2},
text: []string{ text: []string{
" ", " ",
}, },
}, },
operation{ {
start: Loc{4, 3}, start: Loc{4, 3},
end: Loc{4, 3}, end: Loc{4, 3},
text: []string{ text: []string{
@ -1273,14 +1273,14 @@ func TestTouchingEditsTwoInsertsAtTheSamePosition(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{0, 0}, end: Loc{0, 0},
text: []string{ text: []string{
"a", "a",
}, },
}, },
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{0, 0}, end: Loc{0, 0},
text: []string{ text: []string{
@ -1301,14 +1301,14 @@ func TestTouchingEditsInsertAndReplaceTouching(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{0, 0}, end: Loc{0, 0},
text: []string{ text: []string{
"b", "b",
}, },
}, },
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{2, 0}, end: Loc{2, 0},
text: []string{ text: []string{
@ -1329,14 +1329,14 @@ func TestTouchingEditsTwoTouchingReplaces(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{1, 0}, end: Loc{1, 0},
text: []string{ text: []string{
"H", "H",
}, },
}, },
operation{ {
start: Loc{1, 0}, start: Loc{1, 0},
end: Loc{2, 0}, end: Loc{2, 0},
text: []string{ text: []string{
@ -1357,14 +1357,14 @@ func TestTouchingEditsTwoTouchingDeletes(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{1, 0}, end: Loc{1, 0},
text: []string{ text: []string{
"", "",
}, },
}, },
operation{ {
start: Loc{1, 0}, start: Loc{1, 0},
end: Loc{2, 0}, end: Loc{2, 0},
text: []string{ text: []string{
@ -1385,14 +1385,14 @@ func TestTouchingEditsInsertAndReplace(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{0, 0}, end: Loc{0, 0},
text: []string{ text: []string{
"H", "H",
}, },
}, },
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{2, 0}, end: Loc{2, 0},
text: []string{ text: []string{
@ -1413,14 +1413,14 @@ func TestTouchingEditsReplaceAndInsert(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{2, 0}, end: Loc{2, 0},
text: []string{ text: []string{
"H", "H",
}, },
}, },
operation{ {
start: Loc{2, 0}, start: Loc{2, 0},
end: Loc{2, 0}, end: Loc{2, 0},
text: []string{ text: []string{
@ -1441,7 +1441,7 @@ func TestSingleDelete1(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{1, 0}, end: Loc{1, 0},
text: []string{ text: []string{
@ -1462,7 +1462,7 @@ func TestSingleDelete2(t *testing.T) {
"helloworld", "helloworld",
}, },
[]operation{ []operation{
operation{ {
start: Loc{2, 0}, start: Loc{2, 0},
end: Loc{7, 0}, end: Loc{7, 0},
text: []string{ text: []string{
@ -1483,7 +1483,7 @@ func TestSingleDelete3(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{5, 0}, end: Loc{5, 0},
text: []string{ text: []string{
@ -1504,7 +1504,7 @@ func TestSingleDelete4(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{1, 0}, start: Loc{1, 0},
end: Loc{6, 0}, end: Loc{6, 0},
text: []string{ text: []string{
@ -1525,7 +1525,7 @@ func TestSingleDelete5(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{11, 0}, end: Loc{11, 0},
text: []string{ text: []string{
@ -1548,7 +1548,7 @@ func TestMultiDelete6(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{5, 0}, start: Loc{5, 0},
end: Loc{5, 2}, end: Loc{5, 2},
text: []string{ text: []string{
@ -1571,7 +1571,7 @@ func TestMultiDelete7(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{11, 0}, start: Loc{11, 0},
end: Loc{11, 2}, end: Loc{11, 2},
text: []string{ text: []string{
@ -1594,7 +1594,7 @@ func TestMultiDelete8(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{0, 2}, end: Loc{0, 2},
text: []string{ text: []string{
@ -1617,7 +1617,7 @@ func TestMultiDelete9(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{11, 0}, start: Loc{11, 0},
end: Loc{0, 2}, end: Loc{0, 2},
text: []string{ text: []string{
@ -1638,7 +1638,7 @@ func TestSingleInsert1(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{0, 0}, end: Loc{0, 0},
text: []string{ text: []string{
@ -1659,7 +1659,7 @@ func TestSingleInsert2(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{1, 0}, start: Loc{1, 0},
end: Loc{1, 0}, end: Loc{1, 0},
text: []string{ text: []string{
@ -1680,7 +1680,7 @@ func TestSingleInsert3(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{5, 0}, start: Loc{5, 0},
end: Loc{5, 0}, end: Loc{5, 0},
text: []string{ text: []string{
@ -1701,7 +1701,7 @@ func TestSingleInsert4(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{6, 0}, start: Loc{6, 0},
end: Loc{6, 0}, end: Loc{6, 0},
text: []string{ text: []string{
@ -1722,7 +1722,7 @@ func TestSingleInsert5(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{11, 0}, start: Loc{11, 0},
end: Loc{11, 0}, end: Loc{11, 0},
text: []string{ text: []string{
@ -1743,7 +1743,7 @@ func TestMultiInsert6(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{0, 0}, start: Loc{0, 0},
end: Loc{0, 0}, end: Loc{0, 0},
text: []string{ text: []string{
@ -1765,7 +1765,7 @@ func TestMultiInsert7(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{11, 0}, start: Loc{11, 0},
end: Loc{11, 0}, end: Loc{11, 0},
text: []string{ text: []string{
@ -1787,7 +1787,7 @@ func TestMultiInsert8(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{6, 0}, start: Loc{6, 0},
end: Loc{6, 0}, end: Loc{6, 0},
text: []string{ text: []string{
@ -1810,7 +1810,7 @@ func TestMultiInsert9(t *testing.T) {
"hello world", "hello world",
}, },
[]operation{ []operation{
operation{ {
start: Loc{6, 0}, start: Loc{6, 0},
end: Loc{6, 0}, end: Loc{6, 0},
text: []string{ text: []string{

View File

@ -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",