Fix textBox
This commit is contained in:
parent
42deb40c2d
commit
eb98d143db
@ -392,6 +392,8 @@ 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 }
|
||||
@ -399,8 +401,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
|
||||
@ -438,7 +440,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 {
|
||||
@ -447,7 +449,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 {
|
||||
@ -476,7 +478,7 @@ 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.text) // FIXME
|
||||
this.userSelect(dot)
|
||||
@ -492,9 +494,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
|
||||
@ -504,7 +506,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
|
||||
|
Loading…
Reference in New Issue
Block a user