Skip to content
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

Possible to not remove prompt/response? #473

Open
dmd opened this issue Dec 19, 2023 · 2 comments
Open

Possible to not remove prompt/response? #473

dmd opened this issue Dec 19, 2023 · 2 comments
Labels
cmd/input enhancement New feature or request

Comments

@dmd
Copy link

dmd commented Dec 19, 2023

Suppose I do:

FRUIT=$(gum input --header="Your favorite fruit")

Once I type in a response and hit return, the header, prompt, and response all disappear. I then need to write something back to the user to show that the interaction actually happened and I got the response.

I'd like a flag to leave all of that on the screen, rather than removing it, after the interaction.

@ernstki
Copy link
Contributor

ernstki commented Dec 22, 2023

Wanting the same behavior for choose and filter, I looked at the code (not being a Go programmer) to see if I could find anything that looked like deinit() or init(), since the less man page calls this option --no-init:

-X or --no-init
     Disables sending the termcap initialization and deinitialization
     strings to the terminal.  This is sometimes desirable if the
     deinitialization string does something unnecessary, like clearing
     the screen.

Didn't have any luck with that, just upon a cursory review. I think that's buried in one of the other charmbracelet libraries, if not some other even-more-low-level terminal handling library.

If someone else is able to implement this, I'd respectfully suggest sticking with less's nomenclature, and re-using the same command-line options, as this behavior will be very familiar to anyone who's ever wished that man somecommand or less somefile didn't clear the screen after you quit, and found this solution in the man page.1

Footnotes

  1. If you put export LESS=RX in your shell's login scripts, that solves this problem and allows less to interpret ANSI escapes (like colors), too.

@caarlos0 caarlos0 added enhancement New feature or request cmd/input labels Nov 18, 2024
@caarlos0
Copy link
Member

this seems like a good idea, maybe something like --keep-output-on-exit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmd/input enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants