You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm protoyping a text input prompt as a means of getting familiar with tcell and want to know if I'm approaching this the best way. I've just posted the main function for brevity which should be sufficient to demonstrate, I hope. Key points:
Store user input in a slice of runes (buffer). I append to the buffer with each tcell.KeyRune press to pick up the keyboard. The buffer gets cleared down on entry, although I will of course add a line that consumes it first before doing so.
The contents of the buffer before enter key is pressed gets output to the screen each keypress so the user can see what they type. I am clearing the prompt by overwriting the input line with a long line of space characters which feels hacky, but I'm not sure how else to do so.
On resize, redraw the screen. drawUI prints out the input prompt ? and a header/footer.
Is there anything with the below that looks bad or any reccomendations?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm protoyping a text input prompt as a means of getting familiar with tcell and want to know if I'm approaching this the best way. I've just posted the
main
function for brevity which should be sufficient to demonstrate, I hope. Key points:buffer
). I append to the buffer with eachtcell.KeyRune
press to pick up the keyboard. The buffer gets cleared down on entry, although I will of course add a line that consumes it first before doing so.drawUI
prints out the input prompt?
and a header/footer.Is there anything with the below that looks bad or any reccomendations?
Beta Was this translation helpful? Give feedback.
All reactions