zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: Re: vared -h question
Date: Wed, 29 Dec 1999 20:40:05 +0000	[thread overview]
Message-ID: <E123Pre-0007Kc-00.1999-12-29-20-38-34@cmailg3.svr.pol.co.uk> (raw)
In-Reply-To: "Peter Stephenson"'s message of "Fri, 24 Dec 1999 22:07:03 GMT." <E121cqJ-0002yP-00.1999-12-24-22-05-47@cmailg5.svr.pol.co.uk>

(Accessing previous lines entered with vared in a loop):

Peter Stephenson wrote:
> The answer should be to stick `print -s $cmd' as the first command inside
> the loop, as well as adding the -h flag to vared.  Embarassingly (at least
> in the latest 3.1.6++), that doesn't work properly because you don't get
> the most recent command in the history, though you do get the second most
> recent --- i.e. the third time round the while-loop you'll be able to
> re-edit what you entered on the first.

This doesn't look very nice to fix (heard that before?).  The basic problem
is that history isn't active, so the `current' history line is the one
before, which isn't usually used for history.  The choices I've thought of
so far include:

- Some hack-up in zleread() to add a bogus `current' history line, then
delete it at the end.  Yuck.
- Turn on the history mechanism if it isn't already.  That would in
principal get the line automatically entered into the history list, which
is logically consistent.  However, I tentatively tried inserting an
hbegin()/hend() into zleread() under these circumstances and it crashed
in remember_edits() because the entry had nulls in it, so this would need
more work.  How much more work isn't clear because the history code and the
editing code have never been well integrated and have gathered separate
encrustations.
- Let someone else fix it.

I'm still inclining to the third possibility, but I'll keep thinking about
it, too.

-- 
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>


       reply	other threads:[~1999-12-30 18:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E121cqJ-0002yP-00.1999-12-24-22-05-47@cmailg5.svr.pol.co.uk>
1999-12-29 20:40 ` Peter Stephenson [this message]
1999-12-24 17:56 Greg Klanderman

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=E123Pre-0007Kc-00.1999-12-29-20-38-34@cmailg3.svr.pol.co.uk \
    --to=pws@pwstephenson.fsnet.co.uk \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).