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

Allow a custom delay before a command popup shows up #2715

Closed
wants to merge 8 commits into from

Conversation

lenstr
Copy link

@lenstr lenstr commented Jun 8, 2022

Hi!

This pull request closes #1475.

@EpocSquadron
Copy link
Contributor

EpocSquadron commented Jun 19, 2022

There's an interesting edge case with regards to the m key -- the intiial m respects the delay, but selection of i or a which brings up another menu does not. I think this is because the auto-info for inside/around is implemented separately from the normal auto-info for all keybinds. There's been talk of reworking that so the autoinfo for inside and around do use the same method of deriving from keybinds, so maybe we could leave it until then as it will resolve itself at that point. Up to you if you want to spend the time to fix it now.

Other than that, this works really well, nice job!

@EpocSquadron
Copy link
Contributor

I wonder if it wouldn't be unjust to make a default value of 600 -- in my testing it feels like about the delay i would have when unsure of the keybind i want, while not showing up for times when im a little slower to press the next binding when i do know what it is.

@the-mikedavis
Copy link
Member

There's a PR reworking mi/ma: #1723 that may help with that, although it's been quiet for a bit and could probably be superseded.

@kirawi kirawi added A-helix-term Area: Helix term improvements S-waiting-on-review Status: Awaiting review from a maintainer. labels Sep 13, 2022
Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Places where we call cx.on_next_key don't get the effect of the delay, like select_textobject in commands.rs. We may want to introduce a cx.on_next_key_with_autoinfo like Kakoune has so we can close over adding fake autoinfo with delay nicely https://github.com/mawww/kakoune/blob/689553c2e9b953a9d3822528d4ad858af95fb6a2/src/input_handler.hh#L190

}
}),
// delay cancelled
_ = cancel_rx => Box::new(move |_editor, _compositor| {}),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah this is clever - this doesn't need to be triggered explicitly because it's marked as completed in the Drop implementation for Sender, eh?

It's probably worth a comment here on how this triggers since it's kinda hidden in the implementation details

Comment on lines +925 to +926
let is_pending = matches!(key_result, KeymapResult::Pending(_));
if !is_pending {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it would be too unreadable to have the matches! in the if expression here. I don't feel strongly about it though and I think you did this for readability so it's up to you if you want to keep it as-is

@the-mikedavis the-mikedavis added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from a maintainer. labels Oct 19, 2022
@ksandvik
Copy link

ksandvik commented Oct 25, 2022

Any chance to add in the case of 0 (ms), then the popup is never shown? Even better per command so it could be customized in config.toml?

@the-mikedavis
Copy link
Member

You can disable the auto-info boxes entirely already with the editor.auto-info option:

# ~/.config/helix/config.toml
[editor]
auto-info = false

@pascalkuthe pascalkuthe added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 1, 2023
@cd-a
Copy link
Contributor

cd-a commented Feb 11, 2023

Is this PR abandoned? I love this feature

@pse403
Copy link

pse403 commented Mar 21, 2023

Agreed, I'd love it too. I've become addicted to using this editor. I wish my Rust was more advanced so I could contribute. Meantime I can only echo that this feature would solve the one thing that constantly annoys me.

@arexon
Copy link

arexon commented Sep 16, 2023

I would really love to see this merged soon!

@pascalkuthe
Copy link
Member

closing this one out as stale. Thank you for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow a custom delay before a command popup shows up
9 participants