diff --git a/internal/system/textbox.go b/internal/system/textbox.go index eb32e8d..8c36089 100644 --- a/internal/system/textbox.go +++ b/internal/system/textbox.go @@ -405,12 +405,20 @@ func (this *textBox) handleKeyDown (key input.Key, numberPad bool) bool { switch { case key == input.KeyHome || (modifiers.Alt && key == input.KeyLeft): - dot.End = lineHomeSoft(this.runes, dot.End) + if word { + dot.End = 0 + } else { + dot.End = lineHomeSoft(this.runes, dot.End) + } if !sel { dot.Start = dot.End } this.Select(dot) return true case key == input.KeyEnd || (modifiers.Alt && key == input.KeyRight): - dot.End = lineEnd(this.runes, dot.End) + if word { + dot.End = len(this.runes) + } else { + dot.End = lineEnd(this.runes, dot.End) + } if !sel { dot.Start = dot.End } this.Select(dot) return true