-
-
Notifications
You must be signed in to change notification settings - Fork 299
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
Cursor and prompt control in function to avoid prompt flick #1814
Comments
What you describe isn't possible. The It's not clear what you expect. Try doing the same thing, by adding the following to the end of you ~/.bashrc:
The only difference is that bash will move the cursor to the line following the prompt in effect when you press Ctrl-T. Both Elvish and Bash will redraw the prompt, including anything you might have typed (e.g., "echo") before pressing Ctrl-T. Personally, I prefer the Elvish behavior. |
You can try to remove It's ideal if user can
But in a function, especially when trigger keybinding to call a function, the interactive behavior causes flick issue which should be a voided. |
I still don't understand what the problem is. There is no way to tell an external program like |
Thanks @krader1961 for the bash version, indeed the same thing happens (except as you say, bash moves the cursor position down so the old prompt is not affected by fzf output). In bash the partially entered text stays on screen (i.e. in bash type 3 then ctrl+t then select 5 and you'll see the 3 and 5 on the screen), very confusing! Elvish removes the partial text so this doesn't happen, I would assume this is a deliberate design choice. @tmpm697 -- if you use a two line prompt (I use starship) in elvish then it looks more similar to bash... |
@iandol I agree with your analysis. What is unclear to me is whether that difference in behavior is what @tmpm697 is complaining about. That's because their original problem statement is ambiguous. Specifically, this statement:
@tmpm697 It might help if you (a) commented on how the Bash behavior differs from the Elvish behavior, and (b) provided a mockup of the Elvish behavior you prefer. Regarding point (a) does Bash behave as you prefer? Obviously you can't run Elvish to address my point (b) but it should be straightforward to create a simulated output using the markdown triple-quote mechanism to create a mockup of the output you expect to see. |
I am pretty sure it is. For him the prompt is "flickering", which is visible in his first video as a single frame where the Elvish prompt disappears then reappears, causing a "flash". The behaviour is best described as prompt flicker (a fluctuation in brightness caused by the temporary removal of the prompt). He wants the Elvish prompt to remain on screen during the sleep, so that when it returns from sleep there is no flicker on that line. Here is what Elvish is doing. FRAME C is the critical one, where line 1 prompt disappears. FRAME A:~/.config/test>
FRAME B:~/.config/test>
> |
6/6------------------------------
> 1
2 FRAME C:1
|
FRAME D:1
~/.config/test>
I think he would want FRAME C to be like this (line 1 keeps the prompt, it is line 2 that now holds the fzf output during the sleep): FRAME C-ALT:~/.config/test>
1
|
How FRAME D would then be drawn I think is not the issue, the point is the prompt disappears then reappears... |
As I said above, using a two-line prompt you don't see this as most of the prompt is on the first line. |
@iandol thanks, it seems to be like that, when fzf is called -> move cursor where it's needed (in this case drop cursor next line and hold where user can type input) my idea is simple, surprisingly fzf has option so fzf redraw a lot and it |
more info if someone stumble by this issue, this flick issue with or or you proactively drop new line for fzf or you use two lines prompt which @iandol mentioned above. but they are not what i want :) |
After a while battling with this issue, I think it's not shells in general to blame but mostly terminals. As general shell users, you use pipe and whatever commands to achieve your purpose, but this is not the case when you deal with script that every call cost you the time to return back to your interactive mode, which mean the more you're exposed to have a prompt flick, the close one is writing your script which cost free or instantly return back to your shell which is a bit challenge as you need to understand your shells. |
What happened, and what did you expect to happen?
github-flick.mov
expecting: after select candidate in fzf and exit fzf cleanly,
sleep 3
will not drop cursor to next line whilesleep 3
is running --> should keep cursor and prompt as before trigger ctrl-tso i think a flag that on/off prompt manually by user would solve this issue.
idk if this is bug or feature request, but it looks like a bug to me.
Output of "elvish -version"
0.20.1
Code of Conduct
The text was updated successfully, but these errors were encountered: