From: "Nojus Gudinavičius" <nojus.gudinavicius@gmail.com>
To: "Nojus Gudinavičius" <nojus.gudinavicius@gmail.com>, zsh-users@zsh.org
Subject: Re: Slower zsh prompt in weird circumstances
Date: Mon, 21 Aug 2023 15:48:06 +0300 [thread overview]
Message-ID: <CUY8GBSP1NF1.3M0I20HLD7JRK@fw> (raw)
In-Reply-To: <CUACHC1PLRXV.G2W45UQ3ZB0P@fw>
I think I found the problem - large enough history file.
Turns out, after every executed command zle goes through full history
erasing line edits. Most of the time this is not necessary.
I made a hacky patch that at least skips the erasing if no edits were
made.
---
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index cfaa70dae..1cd38601a 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -68,6 +68,7 @@ Keymap isearch_keymap;
*/
#define GETZLETEXT(ent) ((ent)->zle_text ? (ent)->zle_text : (ent)->node.nam)
+char have_edits = 0;
/**/
void
remember_edits(void)
@@ -81,6 +82,7 @@ remember_edits(void)
if (ent->zle_text)
free(ent->zle_text);
ent->zle_text = zlemetaline ? ztrdup(line) : line;
+ have_edits = 1;
} else if (!zlemetaline)
free(line);
}
@@ -90,6 +92,10 @@ remember_edits(void)
void
forget_edits(void)
{
+ if (!have_edits) {
+ return;
+ }
+ have_edits = 0;
Histent he;
for (he = hist_ring; he; he = up_histent(he)) {
next prev parent reply other threads:[~2023-08-21 12:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-24 11:03 Nojus Gudinavičius
2023-08-21 12:48 ` Nojus Gudinavičius [this message]
2023-08-22 13:26 ` Peter Stephenson
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=CUY8GBSP1NF1.3M0I20HLD7JRK@fw \
--to=nojus.gudinavicius@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).