Ctrl+Home/End go to the start and end of the box respectively

This commit is contained in:
Sasha Koshka 2024-09-04 12:55:37 -04:00
parent 1c38ed2d87
commit 381f5f88bd

View File

@ -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