From 381f5f88bd18a687845b80fb3add40e726603dcf Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Wed, 4 Sep 2024 12:55:37 -0400 Subject: [PATCH] Ctrl+Home/End go to the start and end of the box respectively --- internal/system/textbox.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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