Closed DannyBen closed 4 years ago
Hi Danny,
I cannot reproduce this behaviour. It works fine in both vertical and horizontal tmux panels when using the select
and multi_select
prompts. The Hello
is printed in the top right corner when navigating the selections.
I think I know why - give me a few minutes, to try and reproduce more clearly.
Found the reason.
The above reproduction steps work, assuming your cursor is at the very bottom of the screen.
When there is a select control, it prints multiple lines and the "hello" is probably positioned before tty-prompt knows how many lines it will display, so the debug message is pushed up outside of the screen.
Here is a screencast: https://asciinema.org/a/283351
You can see the hello printed even when the select is used, but only briefly, and then it is pushed outside the screen.
Now that I understand the problem, I am not even sure it is easy to solve.
if not - feel free to close the issue.
Ah, I see. The debug message gets printed first in the top right corner but then "disappears" as the selection prompt pushes it up by the very amount of lines needed to display the prompt. The ask
prompt doesn't do it as it is printed on the same line. The simplest thing I can think of right now is to provide an option :offset
which would adjust the display, by let's say the size of choices list?
The simplest thing I can think of right now is to provide an option :offset which would adjust the display, by let's say the size of choices list?
That's an option, but debug messages like this are supposed to be a quick, thoughtless command we throw in when we need to debug. Perhaps it would make sense to display at the bottom-right corner instead?
(Unless you meant that this :offset
happens automatically?)
Yup I agree, I added debug
to help me to debug issues quickly. I was selfish here 😄 I didn't plan for this to be public API.
As for printing it at the bottom, I think I tried that but the problem was that the select
clears a whole line and potentially would wipe out the debug message. Do you have time to try it out? Happy to accept a patch if it works. Alternatively, it could be displayed at the one line above the current line, so we wouldn't worry about moving screen and the debug message being wiped out.
Whatever works. Now that I now why it happens, I can easily still debug, by just ensuring I clear
the screen first, so it will not scroll. Your call.
Changed it to work with the current line - it's in master but I won't have time to release. Have plenty of things to do including trying to wrap up a release of strings-inflect.
Describe the problem
When using
prompt.debug
in a terminal with tmux panels stacked one on top of the other, the debug message is not displayed when usingprompt.select
anywhere in the code - probably due to some screen height calculation issues. Withoutprompt.select
in the code, the debug message is shown properly.Steps to reproduce the problem
$ tmux
Actual behaviour
Debug message is not shown at the top right corner unless removing the
prompt.select
line.Expected behaviour
Expecting to see debug message on the top right corner even when inside tmux panel.
Describe your environment