Skip to content

Commit

Permalink
Merge pull request #4838 from dweymouth/entry-shift-tab
Browse files Browse the repository at this point in the history
  • Loading branch information
dweymouth committed May 13, 2024
2 parents 54154f9 + a7d71de commit 9a05f40
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion widget/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ func (e *Entry) TypedKey(key *fyne.KeyEvent) {
case fyne.KeyReturn, fyne.KeyEnter:
e.typedKeyReturn(provider, multiLine)
case fyne.KeyTab:
e.TypedRune('\t')
e.typedKeyTab()
case fyne.KeyUp:
e.typedKeyUp(provider)
case fyne.KeyDown:
Expand Down Expand Up @@ -877,6 +877,15 @@ func (e *Entry) typedKeyEnd(provider *RichText) {
e.propertyLock.Unlock()
}

func (e *Entry) typedKeyTab() {
if dd, ok := fyne.CurrentApp().Driver().(desktop.Driver); ok {
if dd.CurrentKeyModifiers()&fyne.KeyModifierShift != 0 {
return // don't insert a tab when Shift+Tab typed
}
}
e.TypedRune('\t')
}

// TypedRune receives text input events when the Entry widget is focused.
//
// Implements: fyne.Focusable
Expand Down

0 comments on commit 9a05f40

Please sign in to comment.