mirror of
https://github.com/felixangell/phi.git
synced 2024-09-11 15:55:25 +03:00
implemented delete key
This commit is contained in:
parent
cecb529cc4
commit
f4e6cb3d87
@ -202,6 +202,11 @@ func remove(slice []*rope.Rope, s int) []*rope.Rope {
|
|||||||
return append(slice[:s], slice[s+1:]...)
|
return append(slice[:s], slice[s+1:]...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *Buffer) deleteNext() {
|
||||||
|
b.moveRight()
|
||||||
|
b.deletePrev()
|
||||||
|
}
|
||||||
|
|
||||||
func (b *Buffer) deletePrev() {
|
func (b *Buffer) deletePrev() {
|
||||||
if b.curs.x > 0 {
|
if b.curs.x > 0 {
|
||||||
offs := -1
|
offs := -1
|
||||||
@ -466,6 +471,10 @@ func (b *Buffer) processActionKey(key int) bool {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
case sdl.K_DELETE:
|
||||||
|
b.deleteNext()
|
||||||
|
return true
|
||||||
|
|
||||||
case sdl.K_LGUI:
|
case sdl.K_LGUI:
|
||||||
fallthrough
|
fallthrough
|
||||||
case sdl.K_RGUI:
|
case sdl.K_RGUI:
|
||||||
|
2
main.go
2
main.go
@ -24,7 +24,7 @@ type PhiEditor struct {
|
|||||||
func (n *PhiEditor) init(cfg *cfg.TomlConfig) {
|
func (n *PhiEditor) init(cfg *cfg.TomlConfig) {
|
||||||
n.AddComponent(gui.NewView(1280/2, 720, cfg))
|
n.AddComponent(gui.NewView(1280/2, 720, cfg))
|
||||||
|
|
||||||
font, err := strife.LoadFont("./res/firacode.ttf", 14)
|
font, err := strife.LoadFont("./res/firacode.ttf", 20)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user