Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Slower zsh prompt in weird circumstances
- X-seq: zsh-users 29175
- From: Nojus Gudinavičius <nojus.gudinavicius@xxxxxxxxx>
- To: Nojus Gudinavičius <nojus.gudinavicius@xxxxxxxxx>, <zsh-users@xxxxxxx>
- Subject: Re: Slower zsh prompt in weird circumstances
- Date: Mon, 21 Aug 2023 15:48:06 +0300
- Archived-at: <https://zsh.org/users/29175>
- In-reply-to: <CUACHC1PLRXV.G2W45UQ3ZB0P@fw>
- List-id: <zsh-users.zsh.org>
- References: <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)) {
Messages sorted by:
Reverse Date,
Date,
Thread,
Author