aboutsummaryrefslogtreecommitdiff
path: root/xA/xA.go
diff options
context:
space:
mode:
Diffstat (limited to 'xA/xA.go')
-rw-r--r--xA/xA.go25
1 files changed, 24 insertions, 1 deletions
diff --git a/xA/xA.go b/xA/xA.go
index 417a24a..f61102e 100644
--- a/xA/xA.go
+++ b/xA/xA.go
@@ -979,23 +979,31 @@ func inputSubmit(text string) bool {
type customEntry struct {
widget.Entry
+
+ // selectKeyDown is a hack to exactly invert widget.Entry's behaviour,
+ // which groups both Shift keys together.
selectKeyDown bool
+
+ down map[fyne.KeyName]bool
}
func newCustomEntry() *customEntry {
e := &customEntry{}
e.MultiLine = true
e.Wrapping = fyne.TextWrap(fyne.TextTruncateClip)
+ e.down = make(map[fyne.KeyName]bool)
e.ExtendBaseWidget(e)
return e
}
func (e *customEntry) FocusLost() {
+ e.down = make(map[fyne.KeyName]bool)
e.selectKeyDown = false
e.Entry.FocusLost()
}
func (e *customEntry) KeyDown(key *fyne.KeyEvent) {
+ e.down[key.Name] = true
if key.Name == desktop.KeyShiftLeft || key.Name == desktop.KeyShiftRight {
e.selectKeyDown = true
}
@@ -1003,6 +1011,7 @@ func (e *customEntry) KeyDown(key *fyne.KeyEvent) {
}
func (e *customEntry) KeyUp(key *fyne.KeyEvent) {
+ delete(e.down, key.Name)
if key.Name == desktop.KeyShiftLeft || key.Name == desktop.KeyShiftRight {
e.selectKeyDown = false
}
@@ -1014,6 +1023,19 @@ func (e *customEntry) TypedKey(key *fyne.KeyEvent) {
return
}
+ /*
+ modified := false
+ for _, name := range []fyne.KeyName{
+ desktop.KeyAltLeft, desktop.KeyAltRight,
+ desktop.KeyControlLeft, desktop.KeyControlRight,
+ desktop.KeySuperLeft, desktop.KeySuperRight,
+ } {
+ if e.down[name] {
+ modified = true
+ }
+ }
+ */
+
// Invert the Shift key behaviour here.
// Notice that this will never work on mobile.
shift := &fyne.KeyEvent{Name: desktop.KeyShiftLeft}
@@ -1027,7 +1049,8 @@ func (e *customEntry) TypedKey(key *fyne.KeyEvent) {
e.OnSubmitted(e.Text)
}
case fyne.KeyTab:
- // TODO(p)
+ // TODO(p): Just do e.Append() if state matches.
+ log.Println("completion")
default:
e.Entry.TypedKey(key)
}