Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Slower zsh prompt in weird circumstances



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