-
-
Notifications
You must be signed in to change notification settings - Fork 584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug?] Terminal is not interactive. #1010
Comments
Trying out more of the examples (which have thus far all worked) I found |
Seems part of the reason that tab'n in the form demo works is that the form construct micro manages it. I suppose this makes sense as a form is a collection and the construction order defines the tab order then? https://github.com/rivo/tview/blob/master/form.go#L706-L719 So I wonder then, can I embed the elements of the form in a separate layout, excluding the form entity from widget tree and still benefit from the form's logic? |
Indeed, the use of Ah, it's because |
Alas,
So far I'm really liking the library but I think maybe this is one area where two ideas have become overly coupled (form layout and form control logic). It it's all the same to you I'd settle for patching in an |
A If you want more flexibility, use
If you want to navigate between elements with Tab or Backtab, use |
Indeed, a simple enough function:
Invoked with the controls and provided to the
There's plenty of work in the browser plugin space to define good keyboard navigation, as well as the more application specific implementations like vim and gmail. I can imagine slightly more complex apps using a modal system, something like press T to focus this text box, edit the contents, then press Esc or Enter to blur. I wonder how general or complicated a component can be and still be a welcome addition to your library? Is it worth trying to productionize the above and put up a pull request? If so, I can foresee making some other complicated but generalizable components for this little toy app I'm building:
|
Apologies if you want this ticket closed. While it's still here I'm tracking it as a bit of a dev diary as I hit other sticking points. Today's sticking point is a virtual crash caused by (what seems to be) a combination of input buffering and excessive drawing of the virtual table example. Given a virtual table of ~100 elements the up/down arrows correctly scroll the table until the limit. However, it seems that There's a knock on effect too. While that input buffer is being resolved ctrl+c isn't registered. So naturally I try to kill the process. Here's where it gets fun, If you kill a tview process it doesn't hand input control back to the terminal properly, so the terminal sees tcell.Key codes printed out but no return to the shell prompt :D I suppose there are a lot of remediations that could be attempted here.
I haven't dug in yet, so I'm assuming a bit about how much control the library has over input queuing. That last one presents an interesting option though. Something like a rate limiter on the draw function so any invocations of Draw are dropped after a limit is hit and then a full screen redraw is triggered and burst capacity restored. |
Found the redraw pause (set to 50ms) and the event queue bounded to 100. Key-down repetition seems to work out at 32/sec or ~ 1 input per 32ms. Assuming input events are dropped if that channel is full then it would make sense to assume the limit is hit after ~8 seconds. And following key release it would take 5 seconds for the event buffer to clear. Testing: 10 seconds of up-arrow took ~30sec to resolve following key-up. Suggesting the Draw function is taking ~128ms with no work to do. Possibly my confusion. The event queue seems to be accepting only https://github.com/rivo/tview/blob/master/application.go#L299 No events are dropped at this level. Looking around, tcell is pulling buffered bytes from the terminal and converting to runes. https://github.com/gdamore/tcell/blob/main/tscreen.go#L1712 Seems there is room here for selective input dropping. But maybe skipping needless redraws would be the more valuable tactic. On second review the redraw pause behavior only applies to screen resize. So all events queue up, and every keyboard event triggers a redraw. |
The limits you linked to are for the buffered channels. Once the limit is reached, adding new channel elements will stall. No input gets dropped. If you want input to be dropped, use But I would suggest rather focusing on improving performance of your application. Virtual tables can be quite efficient. The demo exhausts the entire https://github.com/rivo/tview/blob/master/demos/table/virtualtable/main.go There have been some comments previously in the issues section regarding decoupling input from drawing. If you really need it, it can be done.
This already exists, by the way. |
Not sure if this is an environment bug or if I'm doing something horribly wrong. I've been working off the example code expecting the below program to let me tab between the 4 input fields and type into text boxes. However, when I start the program up the library paints the terminal and I love how easy that is, but there's no interactivity.
Linux 6.5.x / Ubuntu.
I've tested in ubuntu's default terminal, terminator, and embedded in tmux.
The text was updated successfully, but these errors were encountered: