mirror of
https://github.com/felixangell/phi.git
synced 2024-09-11 15:55:25 +03:00
delete line behaviour is fixed
This commit is contained in:
parent
a8b2cf1f4c
commit
c2f1796bc2
@ -3,22 +3,23 @@ package gui
|
|||||||
import rope "github.com/felixangell/go-rope"
|
import rope "github.com/felixangell/go-rope"
|
||||||
|
|
||||||
func DeleteLine(b *Buffer) bool {
|
func DeleteLine(b *Buffer) bool {
|
||||||
if b.curs.y == 0 {
|
var prevLineLen = 0
|
||||||
|
if len(b.contents) > 1 {
|
||||||
|
prevLineLen = b.contents[b.curs.y].Len()
|
||||||
|
b.contents = remove(b.contents, b.curs.y)
|
||||||
|
} else {
|
||||||
|
// we are on the first line
|
||||||
|
// and there is nothing else to delete
|
||||||
|
// so we just clear the line
|
||||||
b.contents[b.curs.y] = new(rope.Rope)
|
b.contents[b.curs.y] = new(rope.Rope)
|
||||||
b.moveToEndOfLine()
|
b.moveToEndOfLine()
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.curs.y >= len(b.contents) {
|
if b.curs.y >= len(b.contents) {
|
||||||
return false
|
if b.curs.y > 0 {
|
||||||
}
|
b.moveUp()
|
||||||
|
}
|
||||||
prevLineLen := b.contents[b.curs.y].Len()
|
|
||||||
b.contents = remove(b.contents, b.curs.y)
|
|
||||||
|
|
||||||
if b.curs.y >= len(b.contents) {
|
|
||||||
b.moveUp()
|
|
||||||
b.moveToEndOfLine()
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user