Skip to content

Commit 31c73a1

Browse files
committed
feat(editor): implement Ctrl+Home and Ctrl+End
The necessary feature is actually already there.
1 parent c0e54ba commit 31c73a1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

editor/editor.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,14 @@ func Edit(title, initial string, save, mouse bool) (string, error) {
9797

9898
case tcell.KeyHome:
9999
if event.Modifiers()&tcell.ModCtrl != 0 {
100-
// Go to the beginning of the buffer.
101-
// Not implemented until upstream implements it.
100+
textArea.Select(0, 0)
102101
return nil
103102
}
104103

105104
case tcell.KeyEnd:
106105
if event.Modifiers()&tcell.ModCtrl != 0 {
107-
// Go to the end of the buffer.
108-
// Not implemented until upstream implements it.
106+
length := textArea.GetTextLength()
107+
textArea.Select(length, length)
109108
return nil
110109
}
111110
}

0 commit comments

Comments
 (0)