pterm / pterm

✨ #PTerm is a modern Go module to easily beautify console output. Featuring charts, progressbars, tables, trees, text input, select menus and much more 🚀 It's completely configurable and 100% cross-platform compatible.

Home Page:https://pterm.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pasting in a string that is 1043 characters during interactive text input causes repeats in prompt

eyevanovich opened this issue · comments

When trying to input a very long string of characters, in this case a long JWT token. I'm getting repeated command prompts that show up. The good thing is that it allows me to get over the 1024 byte buffer limitation in the terminal but it's not very appealing to look at. Is it possible to fix this?

kitty-2023-08-21 at 11 01 41

Might be the same problem as in #557.
Thanks for reporting! We'll take look.

This one is a killer for me, any updates? Any workarounds? Any hints on source (happy to contribute).

I will take a look at it tomorrow. But it seems like our logic does not handle it well atm when the input is larger than one line. @MarvinJWendt correct me if I am wrong

I was able to workaround this (short-term, not-ideal) by trim/padding each string going in to max terminal width - a buffer, so ya it seems like the root issue is pterm isn't handling text > terminal width.

Staying tuned, thanks for the response!

Pretty sure text larger than the terminal width is the issue because if you try to resize the terminal with the text shown in the screenshot above, it will redraw every line again and again without any additional input.

Yes, the issue is, that we move the cursor around the terminal on key input. This is mainly done for the TextArea (TextInput.WithMultiline()) as we need to move the cursor up, down, left and right. When the string goes over the terminals width, the cursor jumps down automatically, which introduces an offset on our calculated position, resulting in duplicate lines.