zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Three questions about a completer
Date: Wed, 14 Sep 2016 21:49:24 -0700	[thread overview]
Message-ID: <160914214924.ZM493@torch.brasslantern.com> (raw)
In-Reply-To: <CABZhJg9RR-8kJpfoiBn=0GpjK2fVWNk-Zuz09=CBkbB=AdEnaQ@mail.gmail.com>

On Sep 14, 10:32pm, Jesper Nygards wrote:
}
} Hmm, this was much harder than I thought. I see no difference with the
} addition of the compstate[insert] line.

Hm.  I don't have any problem making what you posted in users/21901
switch forward to backward or backward to forward, even without the
compstate[insert] assignment (as borne out by you finding it already
set to "menu" on entry).

I don't see where you've ever told us what version number of zsh you
have ... oh.

Date:   Mon Mar 7 13:15:40 2016 +0100

    38043: allow any completion widget to cycle matches for menu completion
    to fix reverse menu completion

So it works for me because I'm running the most recent dev build.

That means you'll have to do a bit of the work of preserving the menu:

    typeset -Hga __lsmatches

    _list-result () {
      if [[ $WIDGET != $LASTWIDGET ]]
      then
        if [[ $LASTWIDGET = *list-comp ]]
        then
          # Rotate stored completions to start in the right place
          # Replace (b) with (q) here if zsh complains about (b)
          integer here=$__lsmatches[(I)${(b)words[CURRENT]}]
          if ((here)); then
            __lsmatches=( $__lsmatches[here,-1] $__lsmatches[1,here-1] )
          fi
        else
          # Store the matching completions in case needed again
          compadd -O __lsmatches \
              -M 'l:|=* m:{[:lower:]}={[:upper:]}' -f ${__lsdir:-HOME}/*
        fi
        # Now add, preserving the order previously calculated
        compadd -V $WIDGET -U -f -a __lsmatches
      fi
      compstate[list]='' 
    }


  reply	other threads:[~2016-09-15  6:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12 11:38 Jesper Nygårds
2016-09-12 20:53 ` Oliver Kiddle
2016-09-13 16:16   ` Jesper Nygårds
2016-09-13 19:18     ` Jesper Nygårds
2016-09-14  2:59       ` Bart Schaefer
2016-09-14  7:22         ` Jesper Nygårds
2016-09-14 16:39           ` Bart Schaefer
2016-09-14 20:32             ` Jesper Nygårds
2016-09-15  4:49               ` Bart Schaefer [this message]
2016-09-15  6:01               ` Jesper Nygårds

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=160914214924.ZM493@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@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).