zsh-users
 help / color / mirror / code / Atom feed
From: rahul <rahul2012@gmail.com>
To: zsh-users@zsh.org
Subject: Implementing a menu (list) in a zsh script (as in command line)
Date: Mon, 31 Dec 2012 10:59:59 +0530	[thread overview]
Message-ID: <CACQNQ9P7WJCvuPCzJfxKsf=qZsXiNxsv5hxA-xG8WTJQDugMzw@mail.gmail.com> (raw)

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

I am writing an application in zsh. I typically use read -k or vared for
getting user input. However, I'd like the user to get a menu as he types or
tabs, just as it happens on the zsh command line. I'd like him to be able
to navigate the menu just as on the command line.

Currently, I've implemented this in some cases using read -k and displaying
the data again with each keystroke and the user has to type in the row
number to finally select a row. However, user cannot navigate. I'd like to
use zsh's inbuilt facilities if possible rather than reimplement.

Also in the case of using vared, I am unable to give any options (although
if it happens to be a path, then vared does allow tabbing and completion).

I did see an application that does implement something similar called
"zaw". It seems to use "zle" but I was lost reading the code. "man zle"
hasn't helped much and I could not find any simple tutorial or examples.

Also, using "read -k" can one accept control characters and arrow keys ? It
seems I would have to do multiple reads?

             reply	other threads:[~2012-12-31  5:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-31  5:29 rahul [this message]
2012-12-31 11:00 ` Oliver Kiddle

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='CACQNQ9P7WJCvuPCzJfxKsf=qZsXiNxsv5hxA-xG8WTJQDugMzw@mail.gmail.com' \
    --to=rahul2012@gmail.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).