Add soft line home
This commit is contained in:
parent
9079aca993
commit
1c38ed2d87
@ -405,7 +405,7 @@ func (this *textBox) handleKeyDown (key input.Key, numberPad bool) bool {
|
|||||||
|
|
||||||
switch {
|
switch {
|
||||||
case key == input.KeyHome || (modifiers.Alt && key == input.KeyLeft):
|
case key == input.KeyHome || (modifiers.Alt && key == input.KeyLeft):
|
||||||
dot.End = lineHome(this.runes, dot.End)
|
dot.End = lineHomeSoft(this.runes, dot.End)
|
||||||
if !sel { dot.Start = dot.End }
|
if !sel { dot.Start = dot.End }
|
||||||
this.Select(dot)
|
this.Select(dot)
|
||||||
return true
|
return true
|
||||||
@ -618,8 +618,6 @@ func nextParagraph (text []rune, index int) int {
|
|||||||
return index
|
return index
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: make functions on top of these that support soft home/end
|
|
||||||
|
|
||||||
func lineHome (text []rune, index int) int {
|
func lineHome (text []rune, index int) int {
|
||||||
liminal := index < len(text) && text[index] == '\n'
|
liminal := index < len(text) && text[index] == '\n'
|
||||||
if index >= len(text) { index = len(text) - 1 }
|
if index >= len(text) { index = len(text) - 1 }
|
||||||