scripts icon indicating copy to clipboard operation
scripts copied to clipboard

[colorize_nicks.py] colorizes the middle of a word

Open mgedmin opened this issue 6 years ago • 3 comments

There's a user with nick e in the #vim channel on FreeNode. This results in

Ekrano nuotrauka iš 2019-09-27 16-29-46

What is strange to me is that only the e in new is highlighted: the e in maybe, or open or files or :tabe or :e are not highligted (nor should they be! except maybe the e in :e might make sense).

mgedmin avatar Sep 27 '19 13:09 mgedmin

What value do you have set for colorize_nicks.look.greedy_matching? By default it is on but I've found off` to work better in general, maybe that also fixes this.

Also what value do you have for colorize_nicks.look.min_nick_length? By default it should be 2, so just "e" shouldn't ever be handled. Unless the issue is deeper than that.

sim642 avatar Oct 31 '19 18:10 sim642

I don't remember ever changing any settings. ~/.weechat/colorize_nicks.conf has

[look]
blacklist_channels = ""
blacklist_nicks = "so,root"
colorize_input = off
greedy_matching = on
ignore_nicks_in_urls = off
ignore_tags = ""
match_limit = 20
min_nick_length = 2

Looking at the code, I think I see how the min_nick_length can be circumvented: the length check happens before the

        # If the matched word is not a known nick, we try to match the
        # word without its first or last character (if not a letter).
        # This is necessary as "foo:" is a valid nick, which could be
        # adressed as "foo::".

logic, which then cuts off the first : in :e.

mgedmin avatar Nov 01 '19 09:11 mgedmin

disable greedy_matching first: /set colorize_nicks.look.greedy_matching off

weechatter avatar Nov 01 '19 11:11 weechatter