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

make cursor_trail work on the same command prompt only #8147

Open
xuhdev opened this issue Dec 21, 2024 · 6 comments
Open

make cursor_trail work on the same command prompt only #8147

xuhdev opened this issue Dec 21, 2024 · 6 comments

Comments

@xuhdev
Copy link

xuhdev commented Dec 21, 2024

Is your feature request related to a problem? Please describe.

Currently cursor_trail always shows cursor movement once the distance is beyond a certain threshold.

However, in most cases when the cursor makes a big movement, my eyes either know where
it will land or don't care. For example,

  • After typing in a long command and pressing "Enter", I know it will show up in the next command line prompt.
  • When a program outputs long segments of text, I don't care where the cursor is.

However, the unnecessary animation in these scenarios is distractive.

The moments I see cursor_trail is only needed when I move cursor within a prompt
buffer. For example, I may press Alt-F to jump a word, and the word has an
unknown length to my eyes until I look carefully.

I tried to adjust cursor_trail_start_threshold and cursor_trail_decay, but
they don't seem to be able to address the problem.

Describe the solution you'd like
Add a new option cursor_trail_scenario to specify when to enable cursor
movement.

@kovidgoyal
Copy link
Owner

@jinhwanlazy please review.

@jinhwanlazy
Copy link
Contributor

While I understand what you're trying to achieve, I'm not sure if we can reliably implement this because the terminal doesn't know the semantics of the movement.

Technically we could detect whether a cursor movement was triggered by a control sequence (like a newline character) versus direct cursor positioning commands, the behavior would vary in many applications and I think it would look even more annoying.

@xuhdev
Copy link
Author

xuhdev commented Dec 24, 2024

Sorry I didn't write the code. It's a feature request and it's a bot that wrote the changes...

@kovidgoyal
Copy link
Owner

@jinhwanlazy I think the OP is asking that when the main screen is active and the cursor is in an output region the trail be suppressed. This can be detected fairly reliably at least for shells that implement shell integration. However it will break for shells that dont implement it. Basically the logic would be something like, if the last prompt marking command indicates we are in output mode and the main screen is active, suppress the trail otherwise keep it on. And if no prompt marks are received keep it on. I dont use trails so I am not the right person to comment on how well it works, but that is how I would approach this.

@jinhwanlazy
Copy link
Contributor

if the last prompt marking command indicates we are in output mode

Can you tell me where I should look for this?

@kovidgoyal
Copy link
Owner

kovidgoyal commented Dec 26, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@xuhdev @kovidgoyal @jinhwanlazy and others