diff options
| -rw-r--r-- | ui/editor.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ui/editor.go b/ui/editor.go index e52f5af..d968b41 100644 --- a/ui/editor.go +++ b/ui/editor.go @@ -101,8 +101,12 @@ func (e *editor) remRuneAt(idx int) { func (e *editor) Flush() (content string) { content = string(e.text[e.lineIdx]) - e.lineIdx = len(e.text) - e.text = append(e.text, []rune{}) + if len(e.text[len(e.text)-1]) == 0 { + e.lineIdx = len(e.text) - 1 + } else { + e.lineIdx = len(e.text) + e.text = append(e.text, []rune{}) + } e.textWidth = e.textWidth[:1] e.cursorIdx = 0 e.offsetIdx = 0 |
