scripts
scripts copied to clipboard
unwanted_msg.py 0.3: remove leading whitespace in every situation
Previously, this script was taking care of removing invalid spaces used before a command. This patch improves the script to remove leading whitespace characters in all cases, not just for a command.
Warnings have been removed with this commit. It merely does not allow you to add leading whitespace into the input buffer, which feels quite self-explanatory as a user (I think?).
Signed-off-by: Kevin Morris [email protected]
Script info
- Script name:
unwanted_msg.py
- Version:
0.3
Description
Previously, unwanted_msg.py
took care of dealing with spaces being entered in before
a command's /
character. This update morphs the script into the same thought process
for all messages typed into the input buffer and includes all whitespace types (previously,
only spaces were dealt with).
Checklist (script update)
- [x] Author has been contacted - NOTE The author has not been active for >= 1000 days.
- [x] Single commit, single file added
- [x] Commit message format:
script_name.py X.Y: …
- [x] Script version and Changelog have been updated
- [x] For Python script: works with Python 3 (Python 2 support is optional)
- [x] Score 100 / 100 displayed by weechat-script-lint
Hi, If I understand correctly, the new version removes all leading spaces in every messages sent. What about if you really want to send a message starting with spaces (for example to align something across many messages), which is legitimate?
Hi, If I understand correctly, the new version removes all leading spaces in every messages sent. What about if you really want to send a message starting with spaces (for example to align something across many messages), which is legitimate?
Correct.
For the latter, I suppose we could add a command like /raw
or so to allow this behavior?
Edit: Updated. Let me know what you think.
In addition, the `/raw` command is now available. The `/raw` command
includes whitespace inside of enclosed delimiters which can be
configured (defaulted to []). See `/help raw` for details on
how it works and configuration.
Why adding a new command and just not an option to choose the behavior: strip from just commands (default, which is safe and was the original behavior of script) or commands and messages?
Merged with update of date in changelog and fix of license URL.
Sorry @flashcode, I ended up just feeling like this was an unwanted script and completely forgot about it. Apologies as well about the typos in there.