mirror of
https://github.com/Hopiu/micro.git
synced 2026-04-05 07:21:00 +00:00
parent
94c0f576e1
commit
fa82fc2b74
1 changed files with 16 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ func InitBindings() {
|
|||
"InsertEnter": InsertEnter,
|
||||
"InsertSpace": InsertSpace,
|
||||
"Backspace": Backspace,
|
||||
"Delete": Delete,
|
||||
"InsertTab": InsertTab,
|
||||
"Save": Save,
|
||||
"Find": Find,
|
||||
|
|
@ -231,6 +232,7 @@ func DefaultBindings() map[string]string {
|
|||
"CtrlU": "HalfPageUp",
|
||||
"CtrlD": "HalfPageDown",
|
||||
"CtrlR": "ToggleRuler",
|
||||
"Delete": "Delete",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -333,6 +335,20 @@ func Backspace(v *View) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// Delete deletes the next character
|
||||
func Delete(v *View) bool {
|
||||
if v.cursor.HasSelection() {
|
||||
v.cursor.DeleteSelection()
|
||||
v.cursor.ResetSelection()
|
||||
} else {
|
||||
loc := v.cursor.Loc()
|
||||
if loc < len(v.buf.text) {
|
||||
v.eh.Remove(loc, loc+1)
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// InsertTab inserts a tab or spaces
|
||||
func InsertTab(v *View) bool {
|
||||
// Insert a tab
|
||||
|
|
|
|||
Loading…
Reference in a new issue