zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Editing the history in the shell
Date: Sat, 23 May 2020 02:28:07 +0000	[thread overview]
Message-ID: <20200523022807.08f3ba45@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <CAH+w=7ZFt7jshjv1FCEbmP_PgADvdKwymRutrzwJAvzNpsfOmA@mail.gmail.com>

Bart Schaefer wrote on Fri, 22 May 2020 15:24 -0700:
> 1) Should it be possible to edit empty events into the history?
> Currently empty lines are removed, but changing to IFS=$'\n\n' would
> preserve them (thanks Oliver for the idea)

Hmm.  I guess they might be useful as separators?

> Patch both inlined and attached in case gmail garbles the lines.

It did.

> +++ b/Functions/Misc/zed
> @@ -133,6 +138,17 @@ if ((fun)) then
> +  else
> +    hist=$HISTSIZE; HISTSIZE=0; fc -R /dev/null; HISTSIZE=$hist
> +    for (( hist=1; hist <= $#var; hist++ )) print -s "$var[hist]"

Evaluating «$#var» takes O(N) time, which makes this an O(N²) loop.
Save $#var into an auxiliary variable?

Also, s/print -s/print -s --/.

> +    [[ -n $1 ]] && SAVEHIST=$#var    # Resets on function exit
> +  fi

Cheers,

Daniel

  reply	other threads:[~2020-05-23  2:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22 22:24 Bart Schaefer
2020-05-23  2:28 ` Daniel Shahaf [this message]
2020-05-23 21:30   ` Bart Schaefer
2020-05-24 22:02     ` _arguments optspecs (was Re: Editing the history in the shell) Bart Schaefer
2020-05-25 17:29       ` Oliver Kiddle
2020-05-25 22:32         ` Bart Schaefer
2020-05-26  7:56           ` Oliver Kiddle
2020-05-25 22:42         ` Bart Schaefer
     [not found]     ` <20200525023515.7855610a@tarpaulin.shahaf.local2>
     [not found]       ` <CAH+w=7bTCCC2XBr+_HCAPqXWuOV_YOrDv+36C6jJScKrxZjhLQ@mail.gmail.com>
2020-05-27  3:32         ` Fwd: Editing the history in the shell Bart Schaefer
2021-04-25 21:56           ` [PATCH] " 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=20200523022807.08f3ba45@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=schaefer@brasslantern.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).