squidowl / halloy

IRC application written in Rust
GNU General Public License v3.0
1.56k stars 57 forks source link

context-sensitive nickname tab completion #489

Closed dmd closed 1 month ago

dmd commented 2 months ago

Weechat does something smart when nicknames are tab-completed which I think halloy should copy.

I don't think this even needs to be an option; I honestly can't think of any reason not to just make it the sole behavior.

It looks you already thought of this (except putting a space after the nick in the 2nd cases):

https://github.com/squidowl/halloy/blob/890da2d8c2db931639dec45a0a38b5f75002eb6f/src/buffer/input_view.rs#L301-L307

... but it is only for what happens when someone clicks on a nick in the nicklist, which ... does anyone do that?

I looked into implementing this myself (even though I don't know Rust) but got stymied because by the time tab is called, it no longer knows whether filtered was populated by process_users or process_channels. I added such a flag to the Text struct but then realized tab doesn't have the input context and at that point I realized if you want to do this you could do it in 30 seconds because you actually know how this code works (I guess you'd check if input == prompt to see if we're at the beginning of the line??)

casperstorm commented 1 month ago

I agree with you on this, @dmd. I'll tackle this next.

casperstorm commented 1 month ago

Heres the PR @dmd if you want to see how i tackled it: https://github.com/squidowl/halloy/pull/509

dmd commented 1 month ago

Looks like it always only completes the nick - but doesn't add the colon or space if appropriate to do so.

andymandias commented 1 month ago

(Colon) space is handled by complete_input in completion.rs :slightly_smiling_face:

dmd commented 1 month ago

I guess I don't understand how to actually trigger the behavior in the app; I expect the weechat-like behavior described above, but I find that under no circumstances do I get a colon or space.

andymandias commented 1 month ago

You're building from the branch, and you're seeing user tab completion working except for appending (colon) space? Having trouble getting that behavior to repro over here.

dmd commented 1 month ago

Sorry I'm a moron I forgot to checkout the branch.