Skip to content

Commit

Permalink
exp/textinput: change the return type of Start
Browse files Browse the repository at this point in the history
  • Loading branch information
hajimehoshi committed Mar 3, 2025
1 parent 9c2df8c commit b704a60
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion exp/textinput/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ type Field struct {
selectionStartInBytes int
selectionEndInBytes int

ch chan State
ch <-chan State
end func()
state State
err error
Expand Down
2 changes: 1 addition & 1 deletion exp/textinput/textinput.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type State struct {
// Start is the low-level API. For most use cases, Field is easier to use.
//
// Start returns nil and nil if the current environment doesn't support this package.
func Start(x, y int) (states chan State, close func()) {
func Start(x, y int) (states <-chan State, close func()) {
cx, cy := ui.Get().LogicalPositionToClientPositionInNativePixels(float64(x), float64(y))
return theTextInput.Start(int(cx), int(cy))
}
Expand Down
2 changes: 1 addition & 1 deletion exp/textinput/textinput_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type textInput struct {

var theTextInput textInput

func (t *textInput) Start(x, y int) (chan State, func()) {
func (t *textInput) Start(x, y int) (<-chan State, func()) {
var session *session
ui.Get().RunOnMainThread(func() {
t.end()
Expand Down
2 changes: 1 addition & 1 deletion exp/textinput/textinput_js.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ body.addEventListener("keyup", handler);`)
// TODO: What about other events like wheel?
}

func (t *textInput) Start(x, y int) (chan State, func()) {
func (t *textInput) Start(x, y int) (<-chan State, func()) {
if !t.textareaElement.Truthy() {
return nil, nil
}
Expand Down
2 changes: 1 addition & 1 deletion exp/textinput/textinput_noime.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type textInput struct {

var theTextInput textInput

func (t *textInput) Start(x, y int) (chan State, func()) {
func (t *textInput) Start(x, y int) (<-chan State, func()) {
// AppendInputChars is updated only when the tick is updated.
// If the tick is not updated, return nil immediately.
tick := ui.Get().Tick()
Expand Down
2 changes: 1 addition & 1 deletion exp/textinput/textinput_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type textInput struct {

var theTextInput textInput

func (t *textInput) Start(x, y int) (chan State, func()) {
func (t *textInput) Start(x, y int) (<-chan State, func()) {
if microsoftgdk.IsXbox() {
return nil, nil
}
Expand Down

0 comments on commit b704a60

Please sign in to comment.