mirror of
https://github.com/felixangell/phi.git
synced 2024-10-26 17:18:31 +03:00
Insert an empty string rather than a string with a single space
This commit is contained in:
parent
08ac0fd213
commit
462d7fb436
@ -10,14 +10,12 @@ The editor must:
|
||||
* be easy to use
|
||||
|
||||
# building
|
||||
You'll need `veandco/sdl2` and `veandco/SDL2_ttf`, as well as `BurntSushi/toml` and `vinzmay/go-rope`. Running
|
||||
You'll need `veandco/sdl2` and `veandco/SDL2_ttf`, as well as `BurntSushi/toml` and `vinzmay/go-rope`.
|
||||
|
||||
```bash
|
||||
$ go get github.com/felixangell/nate
|
||||
```
|
||||
|
||||
Should handle installing dependencies for you.
|
||||
|
||||
## configuration
|
||||
Right now the configuration files are very much unimplemented. At the moment
|
||||
configuration files are loaded, but they do not actually modify the behaviour
|
||||
|
@ -99,17 +99,22 @@ func (b *Buffer) processActionKey(t *sdl.KeyDownEvent) {
|
||||
|
||||
var newRope *rope.Rope
|
||||
if initial_x < prevLineLen && initial_x > 0 {
|
||||
// we're not at the end of the line, but we're not at
|
||||
// the start, i.e. we're SPLITTING the line
|
||||
left, right := b.contents[b.curs.y].Split(initial_x)
|
||||
newRope = right
|
||||
b.contents[b.curs.y] = left
|
||||
} else if initial_x == 0 {
|
||||
// we're at the start of a line, so we want to
|
||||
// shift the line down and insert an empty line
|
||||
// above it!
|
||||
b.contents = append(b.contents, new(rope.Rope)) // grow
|
||||
copy(b.contents[b.curs.y+1:], b.contents[b.curs.y:]) // shift
|
||||
b.contents[b.curs.y] = new(rope.Rope) // set
|
||||
b.curs.move(0, 1)
|
||||
return
|
||||
} else {
|
||||
newRope = rope.New(" ")
|
||||
newRope = new(rope.Rope)
|
||||
}
|
||||
|
||||
b.curs.move(0, 1)
|
||||
|
Loading…
Reference in New Issue
Block a user