Compare commits
No commits in common. "55215dedc267c0c030a055fb5b8e679f4111b8ec" and "42deb40c2de5d0aca1296e4778379624d72ca366" have entirely different histories.
55215dedc2
...
42deb40c2d
@ -392,8 +392,6 @@ func (this *textBox) runeUnderMouse () int {
|
|||||||
return this.drawer.AtPosition(fixPt(position))
|
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 {
|
func (this *textBox) handleKeyDown (key input.Key, numberPad bool) bool {
|
||||||
if this.box.handleKeyDown(key, numberPad) { return true }
|
if this.box.handleKeyDown(key, numberPad) { return true }
|
||||||
if !this.selectable { return false }
|
if !this.selectable { return false }
|
||||||
@ -401,8 +399,8 @@ func (this *textBox) handleKeyDown (key input.Key, numberPad bool) bool {
|
|||||||
// because fuck you thats why!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
// because fuck you thats why!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
modifiers := this.Window().Modifiers()
|
modifiers := this.Window().Modifiers()
|
||||||
dot := this.Dot()
|
dot := this.Dot()
|
||||||
sel := modifiers.Shift()
|
sel := modifiers.Shift
|
||||||
word := modifiers.Control()
|
word := modifiers.Control
|
||||||
|
|
||||||
moveVertically := func (delta fixed.Int26_6) {
|
moveVertically := func (delta fixed.Int26_6) {
|
||||||
currentDot := 0
|
currentDot := 0
|
||||||
@ -440,7 +438,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):
|
||||||
if word {
|
if word {
|
||||||
dot.End = 0
|
dot.End = 0
|
||||||
} else {
|
} else {
|
||||||
@ -449,7 +447,7 @@ func (this *textBox) handleKeyDown (key input.Key, numberPad bool) bool {
|
|||||||
if !sel { dot.Start = dot.End }
|
if !sel { dot.Start = dot.End }
|
||||||
this.userSelect(dot)
|
this.userSelect(dot)
|
||||||
return true
|
return true
|
||||||
case key == input.KeyEnd || (modifiers.Alt() && key == input.KeyRight):
|
case key == input.KeyEnd || (modifiers.Alt && key == input.KeyRight):
|
||||||
if word {
|
if word {
|
||||||
dot.End = len(this.runes)
|
dot.End = len(this.runes)
|
||||||
} else {
|
} else {
|
||||||
@ -478,9 +476,9 @@ func (this *textBox) handleKeyDown (key input.Key, numberPad bool) bool {
|
|||||||
case key == input.KeyDown:
|
case key == input.KeyDown:
|
||||||
moveVertically(fixed.I(1))
|
moveVertically(fixed.I(1))
|
||||||
return true
|
return true
|
||||||
case key == input.Key('a') && modifiers.Control():
|
case key == input.Key('a') && modifiers.Control:
|
||||||
dot.Start = 0
|
dot.Start = 0
|
||||||
dot.End = len(this.runes)
|
dot.End = len(this.text) // FIXME
|
||||||
this.userSelect(dot)
|
this.userSelect(dot)
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
@ -494,9 +492,9 @@ func (this *textBox) handleKeyUp (key input.Key, numberPad bool) bool {
|
|||||||
|
|
||||||
modifiers := this.Window().Modifiers()
|
modifiers := this.Window().Modifiers()
|
||||||
switch {
|
switch {
|
||||||
case key == input.KeyHome || (modifiers.Alt() && key == input.KeyLeft):
|
case key == input.KeyHome || (modifiers.Alt && key == input.KeyLeft):
|
||||||
return true
|
return true
|
||||||
case key == input.KeyEnd || (modifiers.Alt() && key == input.KeyRight):
|
case key == input.KeyEnd || (modifiers.Alt && key == input.KeyRight):
|
||||||
return true
|
return true
|
||||||
case key == input.KeyUp:
|
case key == input.KeyUp:
|
||||||
return true
|
return true
|
||||||
@ -506,7 +504,7 @@ func (this *textBox) handleKeyUp (key input.Key, numberPad bool) bool {
|
|||||||
return true
|
return true
|
||||||
case key == input.KeyRight:
|
case key == input.KeyRight:
|
||||||
return true
|
return true
|
||||||
case key == input.Key('a') && modifiers.Control():
|
case key == input.Key('a') && modifiers.Control:
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user