Skip to content

New script colorize_regex.pl: colorize highlight regex matches in chat messages #573

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

Closed
wants to merge 1 commit into from

Conversation

ryoskzypu
Copy link
Contributor

@ryoskzypu ryoskzypu commented Mar 26, 2025

Script info

  • Script name: colorize_regex.pl
  • Version: 1.0
  • Requirements: 
  • Min WeeChat version: 
  • Script tags: color, highlight, irc, regex

Description

Colorize regex matches in chat messages from 'weechat.look.highlight_regex' option or the 'highlight_regex' buffer property, to make validation of matches easier.

Checklist (new script)

  • Single commit, single file added
  • Commit message: New script name.py: short description…
  • No similar script already exists
  • Name: max 32 chars, only lower case letters, digits and underscores
  • Unique name, does not already exist in repository
  • No shebang on the first line
  • Comment in script with name/pseudo, e-mail and license
  • Only English in code/comments
  • Pure WeeChat API used, no extra API
  • Function hook_url, hook_process or hook_process_hashtable is used for any blocking call
  • For Python script: works with Python 3 (Python 2 support is optional)
  • Score 100 / 100 displayed by weechat-script-lint

Sorry, something went wrong.

@weechatter
Copy link
Contributor

how about improving colorize_lines.pl?
colorize_lines.pl can do "highlight word(s) in text, matching word(s) in weechat.look.highlight" with option , /fset plugins.var.perl.colorize_lines.highlight_words

@ryoskzypu
Copy link
Contributor Author

how about improving colorize_lines.pl? colorize_lines.pl can do "highlight word(s) in text, matching word(s) in weechat.look.highlight" with option , /fset plugins.var.perl.colorize_lines.highlight_words

Sure, do you mean I should've added the regex colorizing in colorize_lines.pl?
I took inspiration from that feature in your script, thanks. I have thought about improving it, but as you can see my code grew on its own...

@weechatter
Copy link
Contributor

maybe its better to add the regex function to colorize_lines.pl, to have one script with nearly same functionality. what do you think @flashcode ?

@flashcode
Copy link
Member

It depends if it's simple to add into colorize_lines.pl, and it could prevent duplicated code.
But on the other hand, if it brings many other options, a separate script could make sense.

@ryoskzypu
Copy link
Contributor Author

It depends if it's simple to add into colorize_lines.pl, and it could prevent duplicated code. But on the other hand, if it brings many other options, a separate script could make sense.

The scripts are different in many ways, e.g. colorize_regex has a command like /debug unicode, a dedicated buffer that shows commands/debug output, uses hook_line rather than hook_modifier, uses config_new(), etc.

I could add all the features to colorize_lines.pl, but I don't know if it's okay; or only the highlight_regex function.

@flashcode
Copy link
Member

@ryoskzypu: then let's keep the separate script.

@ryoskzypu ryoskzypu force-pushed the colorize_regex branch 3 times, most recently from 0aaee24 to 3543415 Compare April 22, 2025 20:23
@ryoskzypu ryoskzypu closed this Apr 22, 2025
@ryoskzypu ryoskzypu reopened this Apr 22, 2025
@flashcode flashcode added the new script New script label Apr 23, 2025
@flashcode flashcode added the waiting info Waiting for info from author of issue label Apr 23, 2025
@flashcode flashcode self-assigned this Apr 23, 2025

Verified

This commit was signed with the committer’s verified signature. The key has expired.
…t messages
@ryoskzypu
Copy link
Contributor Author

@flashcode: Done, I think it is ok now? Sorry for the force-push noise, I've messed up when rebasing my fork...

@flashcode flashcode removed the waiting info Waiting for info from author of issue label Apr 23, 2025
@flashcode
Copy link
Member

Thanks, script merged (I moved script to perl/ directory).

@flashcode flashcode closed this Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new script New script
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants