Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] [[:blank:]] only matches on SPC and TAB

On 14 May 2018 at 08:36, Stephane Chazelas <stephane.chazelas@xxxxxxxxx> wrote:
> [[:blank:]], [[:space:]]... are POSIX character classes,
> supported by most utilities that do wildcard or regexp matching.
> I know of no other utility than zsh whose [[:space:]] includes
> all the characters classified as "space" in the locale and where
> [[:blank:]] doesn't include all the "blank" ones.

Do you think some middle-way is possible? I mean, enabling :blank: to
that much new characters and observing ML for user reports (who knows,
maybe there wouldn't be many or any, but yeah, "who knows") is like
compiling 32 bit product on 64 bit compiler and continue selling it
without break. Well, to be honest, I was hired in one work when this
happened and it worked. By middle-way I mean: to look at the possible
characters, recognize ones that are crucial for lowering the oddity of
Zshell's :blank:, and include just a few in :blank:, doing some
thinking if some of chosen characters doesn't have a potential to
break something. It's a difficult situation because from one point of
view, nothing should break, exotic spaces don't occur often and even
if they did, they shouldn't break anything, the code should behave as
more robust. But from other point of view, any character added to
:blank: has its twin-code assigned that will break.

> It seems to me that if you wanted to match on only SPC and TAB
> and not the other horizontal spacing characters classified as
> such in the locale, you should use [ $'\t']. See also [[:IFS:]]
> and [[:IFSSPACE:]] though they depend on the value of $IFS and
> include \n by default (and \0 for [[:IFS:]]).

I've greped some projects to check if they used :blank::

- https://github.com/zsh-users/zsh-syntax-highlighting/blob/5b539663c0d740a0c00169d5ecbd58e47ff16252/highlighters/main/main-highlighter.zsh#L959

- https://github.com/zsh-users/zaw/blob/91c5e1a179ba543458e341a4d8e95c75f762f5c6/sources/ssh-hosts.zsh#L13

- Zshells distributed functions: _complete, _expand_alias,
_description, _main_complete, _bsd_pkg, compinstall, zcalc, etc. quite

- my 3 past projects, most notably Zshelldoc, which parses scripts to
extract functions.

These uses aren't drastic, and I think all those projects would work
after replacing :blank: with :space:. But there's no way to be sure.
Who knows maybe some DevOp wanted to uplift some system at work and
proposed use of Zsh, and has :blank: in his scripts.

Best regards,
Sebastian Gniazdowski

Messages sorted by: Reverse Date, Date, Thread, Author