Compare commits

..

No commits in common. "55215dedc267c0c030a055fb5b8e679f4111b8ec" and "42deb40c2de5d0aca1296e4778379624d72ca366" have entirely different histories.

View File

@ -392,8 +392,6 @@ func (this *textBox) runeUnderMouse () int {
return this.drawer.AtPosition(fixPt(position))
}
// TODO the keynav here should make better use of input key chords.
func (this *textBox) handleKeyDown (key input.Key, numberPad bool) bool {
if this.box.handleKeyDown(key, numberPad) { return true }
if !this.selectable { return false }
@ -401,8 +399,8 @@ func (this *textBox) handleKeyDown (key input.Key, numberPad bool) bool {
// because fuck you thats why!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
modifiers := this.Window().Modifiers()
dot := this.Dot()
sel := modifiers.Shift()
word := modifiers.Control()
sel := modifiers.Shift
word := modifiers.Control
moveVertically := func (delta fixed.Int26_6) {
currentDot := 0
@ -440,7 +438,7 @@ func (this *textBox) handleKeyDown (key input.Key, numberPad bool) bool {
}
switch {
case key == input.KeyHome || (modifiers.Alt() && key == input.KeyLeft):
case key == input.KeyHome || (modifiers.Alt && key == input.KeyLeft):
if word {
dot.End = 0
} else {
@ -449,7 +447,7 @@ func (this *textBox) handleKeyDown (key input.Key, numberPad bool) bool {
if !sel { dot.Start = dot.End }
this.userSelect(dot)
return true
case key == input.KeyEnd || (modifiers.Alt() && key == input.KeyRight):
case key == input.KeyEnd || (modifiers.Alt && key == input.KeyRight):
if word {
dot.End = len(this.runes)
} else {
@ -478,9 +476,9 @@ func (this *textBox) handleKeyDown (key input.Key, numberPad bool) bool {
case key == input.KeyDown:
moveVertically(fixed.I(1))
return true
case key == input.Key('a') && modifiers.Control():
case key == input.Key('a') && modifiers.Control:
dot.Start = 0
dot.End = len(this.runes)
dot.End = len(this.text) // FIXME
this.userSelect(dot)
return true
default:
@ -494,9 +492,9 @@ func (this *textBox) handleKeyUp (key input.Key, numberPad bool) bool {
modifiers := this.Window().Modifiers()
switch {
case key == input.KeyHome || (modifiers.Alt() && key == input.KeyLeft):
case key == input.KeyHome || (modifiers.Alt && key == input.KeyLeft):
return true
case key == input.KeyEnd || (modifiers.Alt() && key == input.KeyRight):
case key == input.KeyEnd || (modifiers.Alt && key == input.KeyRight):
return true
case key == input.KeyUp:
return true
@ -506,7 +504,7 @@ func (this *textBox) handleKeyUp (key input.Key, numberPad bool) bool {
return true
case key == input.KeyRight:
return true
case key == input.Key('a') && modifiers.Control():
case key == input.Key('a') && modifiers.Control:
return true
default:
return false