[GH-ISSUE #185] Bug Fix - SetAcceptanceFunc prevents all key input #146

Closed
opened 2026-03-04 01:02:22 +03:00 by kerem · 3 comments
Owner

Originally created by @jr81 on GitHub (Nov 18, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/185

Running demos/inputfield/main.go won't allow any keyboard input.

I traced the bug from demos/inputfield/main.go:16 SetAcceptanceFunc(tview.InputFieldInteger)
to inputfield.go:367 where the following change worked for me:

367,368c367,368
< 			if i.accept != nil {
< 				return i.accept(newText, r)
---
> 			if i.accept != nil && !i.accept(newText, r) {
> 				return false

Thank you for such a beautifully designed and well written library!

Originally created by @jr81 on GitHub (Nov 18, 2018). Original GitHub issue: https://github.com/rivo/tview/issues/185 Running demos/inputfield/main.go won't allow any keyboard input. I traced the bug from demos/inputfield/main.go:16 SetAcceptanceFunc(tview.InputFieldInteger) to inputfield.go:367 where the following change worked for me: ``` 367,368c367,368 < if i.accept != nil { < return i.accept(newText, r) --- > if i.accept != nil && !i.accept(newText, r) { > return false ``` Thank you for such a beautifully designed and well written library!
kerem closed this issue 2026-03-04 01:02:23 +03:00
Author
Owner

@delaneyj commented on GitHub (Nov 18, 2018):

I confirmed this is an issue and made a PR https://github.com/rivo/tview/pull/186

<!-- gh-comment-id:439726177 --> @delaneyj commented on GitHub (Nov 18, 2018): I confirmed this is an issue and made a PR https://github.com/rivo/tview/pull/186
Author
Owner

@rivo commented on GitHub (Nov 19, 2018):

Thanks for catching this! Didn't realize that mistake when I made the changes for #103.

<!-- gh-comment-id:439834386 --> @rivo commented on GitHub (Nov 19, 2018): Thanks for catching this! Didn't realize that mistake when I made the changes for #103.
Author
Owner

@jr81 commented on GitHub (Nov 19, 2018):

It's the least I can do, as this is an exceptionally important package,
IMHO. Thank you! I'm experimenting with a simple HTML to TUI translator
(more TUI than w3m, etc). This way my Web back-end technologies can also
create my CLI tools.

On Mon, Nov 19, 2018 at 3:52 AM rivo notifications@github.com wrote:

Thanks for catching this! Didn't realize that mistake when I made the
changes for #103 https://github.com/rivo/tview/issues/103.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/rivo/tview/issues/185#issuecomment-439834386, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AQXi_w8gqvKjhpENz3TrD-6EIk3-cMKvks5uwn9lgaJpZM4YoHaq
.

<!-- gh-comment-id:440043817 --> @jr81 commented on GitHub (Nov 19, 2018): It's the least I can do, as this is an exceptionally important package, IMHO. Thank you! I'm experimenting with a simple HTML to TUI translator (more TUI than w3m, etc). This way my Web back-end technologies can also create my CLI tools. On Mon, Nov 19, 2018 at 3:52 AM rivo <notifications@github.com> wrote: > Thanks for catching this! Didn't realize that mistake when I made the > changes for #103 <https://github.com/rivo/tview/issues/103>. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/rivo/tview/issues/185#issuecomment-439834386>, or mute > the thread > <https://github.com/notifications/unsubscribe-auth/AQXi_w8gqvKjhpENz3TrD-6EIk3-cMKvks5uwn9lgaJpZM4YoHaq> > . >
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#146
No description provided.