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

[feature request] username completion with @ #645

Open
voidlily opened this issue Nov 10, 2024 · 9 comments
Open

[feature request] username completion with @ #645

voidlily opened this issue Nov 10, 2024 · 9 comments

Comments

@voidlily
Copy link

I'd like to be able to complete usernames with @ because that's a pretty common thing on a lot of other forms of communication. For example, typing @userna<tab> would complete to something like @username:, preserving the @ sign.

I tried to implement this myself but my Rust skills are not very good so I wasn't able to get very far with it.

@voidlily
Copy link
Author

modified   src/buffer/input_view/completion.rs
@@ -600,13 +600,17 @@ impl Text {
     }
 
     fn process_users(&mut self, input: &str, users: &[User]) {
-        let (_, rest) = input.rsplit_once(' ').unwrap_or(("", input));
+        let (_, mut rest) = input.rsplit_once(' ').unwrap_or(("", input));
 
         if rest.is_empty() {
             *self = Self::default();
             return;
         }
 
+        if let Some((_, last)) = rest.split_once('@') {
+            rest = last;
+        }
+
         let nick = rest.to_lowercase();
 
         self.selected = None;

This is about as far as I was able to get with it with my limited Rust skills, but tab completing with @userna<tab> results in username: , stripping the @.

@casperstorm
Copy link
Member

I am not a fan of this, as it is not very irc idiomatic to highlight users with a @.
I am curious if @glguy, @4e554c4c or @andymandias has to say about this.

@4e554c4c
Copy link
Contributor

there's not really a "standard" way to highlight on IRC and im pretty sure i've seen clients highlight with @ before. So I'm ok with this, as long as it's not the only way to highlight.

@smakkerlak
Copy link

The default has been just typing a nick and hitting tab in all the IRC clients I've used.
Instead of making a special case of @, treat any space followed by special characters as space, so that any special character will be ignored when tab completing, but actual text will not result in various strings having ": " added.

I'm not a super big fan of this though, mostly because of confusion with IRC statuses like op @, half op, % voice + and so on.

I can see a middle ground where typing @ is turned into a feature that pops up a small type-ahead menu that narrows down users in the channel as more text is typed. But no @ actually sent to the channel :p

@voidlily
Copy link
Author

there's not really a "standard" way to highlight on IRC and im pretty sure i've seen clients highlight with @ before. So I'm ok with this, as long as it's not the only way to highlight.

i've already seen the client color usernames preceded with @ before so there's that going for it already

The default has been just typing a nick and hitting tab in all the IRC clients I've used. Instead of making a special case of @, treat any space followed by special characters as space, so that any special character will be ignored when tab completing, but actual text will not result in various strings having ": " added.

not a bad idea but it may conflict with channel completion with # which i think it might be doing already?

@voidlily
Copy link
Author

i think hexchat did the space thing too which effectively let you complete with @, need to remember how it works though for sure

@smakkerlak
Copy link

smakkerlak commented Nov 11, 2024

i've already seen the client color usernames preceded with @ before so there's that going for it already

Probably because any single word that matches a nick in the channel is colored. It's a good point though - highlight coloring should ignore special characters too.

not a bad idea but it may conflict with channel completion with # which i think it might be doing already?

I'm convinced that someone is able to code around all that :)

@glguy
Copy link

glguy commented Nov 11, 2024

This shouldn't be the default, but I've made it configurable in my clients. The reason that convinced me to make it configurable was that some people were using the client to connect to a non-IRC service via an IRC bridge and the convention on that service was different from IRC.

In my case I made it configurable what prefix and suffix was added to a nickname both at the start and separately in the middle of a message. When completing at the start people often like a trailing comma or colon, for example.

@voidlily If you're putting @'s in front of people's nicknames on a normal IRC server you're just going to annoy a lot of people, though.

@voidlily
Copy link
Author

i think configurable would make sense, i'm working on bridges as well and the convention for the services i'm bridging to also have the @-mention convention if people feel strongly enough about it that having @ completion would annoy people on "real" irc anyway

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

No branches or pull requests

5 participants