From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31165 invoked from network); 23 May 2020 02:28:53 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 23 May 2020 02:28:53 -0000 Received: (qmail 4864 invoked by alias); 23 May 2020 02:28:46 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45899 Received: (qmail 1904 invoked by uid 1010); 23 May 2020 02:28:46 -0000 X-Qmail-Scanner-Diagnostics: from out2-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25814. spamassassin: 3.4.4. Clear:RC:0(66.111.4.26):SA:0(-2.6/5.0):. Processed in 1.266988 secs); 23 May 2020 02:28:46 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddugedgheeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfgjfhfogggtgfesthhqtddtredtjeenucfhrhhomhepffgrnhhi vghlucfuhhgrhhgrfhcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvgeqne cuggftrfgrthhtvghrnhephfdtteefheevuedthedutdeifeegteettdejtdffheduieei jeelteetkeduteehnecukfhppeejledrudejjedrudefgedrfeenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdrshhh rghhrghfrdhnrghmvg X-ME-Proxy: Date: Sat, 23 May 2020 02:28:07 +0000 From: Daniel Shahaf To: Bart Schaefer Cc: Zsh hackers list Subject: Re: Editing the history in the shell Message-ID: <20200523022807.08f3ba45@tarpaulin.shahaf.local2> In-Reply-To: References: X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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=3D$'\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=3D$HISTSIZE; HISTSIZE=3D0; fc -R /dev/null; HISTSIZE=3D$hist > + for (( hist=3D1; hist <=3D $#var; hist++ )) print -s "$var[hist]" Evaluating =C2=AB$#var=C2=BB takes O(N) time, which makes this an O(N=C2=B2= ) loop. Save $#var into an auxiliary variable? Also, s/print -s/print -s --/. > + [[ -n $1 ]] && SAVEHIST=3D$#var # Resets on function exit > + fi Cheers, Daniel