Skip to content

Commit

Permalink
Fix naming for clarity and spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Mar 26, 2021
1 parent 382b5cd commit 9cc38f1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions canvasobject.go
Expand Up @@ -97,11 +97,11 @@ type Shortcutable interface {
TypedShortcut(Shortcut)
}

// Tabable describes any object that needs to accept the Tab key presses.
// Tabbable describes any object that needs to accept the Tab key presses.
//
// Since: 2.1
type Tabable interface {
// AcceptTabs() is a hook called by the key press handling logic.
// If it returns true then the Tab key events will be sent TypedKey and TypedRune.
AcceptTabs() bool
type Tabbable interface {
// AcceptsTab() is a hook called by the key press handling logic.
// If it returns true then the Tab key events will be sent using TypedKey.
AcceptsTab() bool
}
2 changes: 1 addition & 1 deletion internal/driver/glfw/window.go
Expand Up @@ -1001,7 +1001,7 @@ func keyToName(code glfw.Key, scancode int) fyne.KeyName {

func (w *window) capturesTab(keyName fyne.KeyName, modifier desktop.Modifier) bool {
if keyName == fyne.KeyTab {
if ent, ok := w.canvas.Focused().(fyne.Tabable); ok && !ent.AcceptTabs() {
if ent, ok := w.canvas.Focused().(fyne.Tabbable); ok && !ent.AcceptsTab() {
switch modifier {
case 0:
w.canvas.FocusNext()
Expand Down
8 changes: 4 additions & 4 deletions widget/entry.go
Expand Up @@ -30,7 +30,7 @@ var _ fyne.Widget = (*Entry)(nil)
var _ desktop.Mouseable = (*Entry)(nil)
var _ desktop.Keyable = (*Entry)(nil)
var _ mobile.Keyboardable = (*Entry)(nil)
var _ fyne.Tabable = (*Entry)(nil)
var _ fyne.Tabbable = (*Entry)(nil)

// Entry widget allows simple text to be input when focused.
type Entry struct {
Expand Down Expand Up @@ -116,12 +116,12 @@ func NewPasswordEntry() *Entry {
return e
}

// AcceptTabs returns if Entry accepts Tabs or not.
// AcceptsTab returns if Entry accepts the Tab key or not.
//
// Implements: fyne.Tabable
// Implements: fyne.Tabbable
//
// Since: 2.1
func (e *Entry) AcceptTabs() bool {
func (e *Entry) AcceptsTab() bool {
return e.MultiLine
}

Expand Down
2 changes: 1 addition & 1 deletion widget/entry_test.go
Expand Up @@ -1371,7 +1371,7 @@ func TestTabable(t *testing.T) {
})
t.Run("Singleline_Tab_Default", func(t *testing.T) {
entry.MultiLine = false
assert.False(t, entry.AcceptTabs())
assert.False(t, entry.AcceptsTab())
})
}

Expand Down

0 comments on commit 9cc38f1

Please sign in to comment.