Improved keyboard selection somewhat

This commit is contained in:
Sasha Koshka 2023-02-13 15:26:21 -05:00
parent 21abd147bf
commit 88502cf628

View File

@ -142,8 +142,11 @@ func Type (text []rune, dot Dot, character rune) (result []rune, moved Dot) {
}
func MoveLeft (text []rune, dot Dot, word bool) (moved Dot) {
dot = dot.Constrain(len(text))
distance := 1
dot = dot.Canon().Constrain(len(text))
distance := 0
if dot.Empty() {
distance = 1
}
if word {
distance = WordToLeft(text, dot.Start)
}
@ -152,8 +155,11 @@ func MoveLeft (text []rune, dot Dot, word bool) (moved Dot) {
}
func MoveRight (text []rune, dot Dot, word bool) (moved Dot) {
dot = dot.Constrain(len(text))
distance := 1
dot = dot.Canon().Constrain(len(text))
distance := 0
if dot.Empty() {
distance = 1
}
if word {
distance = WordToRight(text, dot.End)
}