zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: zsh-workers@zsh.org
Subject: Repeatable (@M) bug
Date: Fri, 14 Aug 2015 10:53:35 +0200	[thread overview]
Message-ID: <CAKc7PVAKqsRtvELnchwcfO2jh_HSYiKhHkEtEvGy_g7nXjXpXQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1641 bytes --]

Hello

Summary description: searching for "xyza" doesn't match "xyza", only "xyzab"

Illustration by code:
---------
list=( "aisj" )
echo "1 |${(@M)list:#*aisj*}"
list=( "aisj" "aisja" )
echo "2 |${(@M)list:#*aisja*}"
echo "3 |${(@M)list:#*aisj*}"
list=( "aisj" "aisja" "aisjas" )
echo "4 |${(@M)list:#*aisjas*}"
echo "5 |${(@M)list:#*aisja*}"
echo "6 |${(@M)list:#*aisj*}"
---------

This example works. "aisj" returns "aisj", "aisja" returns "aisja", "aisj"
returns "aisja" AND "aisj", etc. However in a script the same steps yield
the erroneous behavior: "aisj" matches only "aisja" and "aisjas", and
"aisja" matches only "aisjas".

The script is:
https://github.com/psprint/zsh-visual-tools/

It is really simple. It allows to grep for a pattern when displaying
history. Calling the script extends history content - like the 'list=(
"aisj" "aisja" )' lines. Equivalent of the code already mentioned is:

v-list aisj
No matching history entries
v-list aisja
No matching history entries
v-list aisj
(matches only aisja)
v-history aisjas
No matching history entries
v-history aisja
(matches only aisjas)
v-history aisj
(matches only aisja and aisjas)

Also, when I wrote a script to repeat v-history calls automatically (no
through command line) it resulted in:
v-history:fc:21: no such event: 1000

This is a very interesting result, as the `history -rn 1000` call just must
work.

I checked this on OSX 5.0.2 and hombrew's 5.0.8-dev-1.

PS. What I mean by the last mentioned script is:

#!/bin/zsh

autoload v-history

v-history aisj
v-history aisja
v-history aisj
v-history aisjas
v-history aisja
v-history aisj

Best Regards,
Sebastian

             reply	other threads:[~2015-08-14  8:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-14  8:53 Sebastian Gniazdowski [this message]
2015-08-14 18:03 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKc7PVAKqsRtvELnchwcfO2jh_HSYiKhHkEtEvGy_g7nXjXpXQ@mail.gmail.com \
    --to=sgniazdowski@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).