* Slower zsh prompt in weird circumstances
@ 2023-07-24 11:03 Nojus Gudinavičius
2023-08-21 12:48 ` Nojus Gudinavičius
0 siblings, 1 reply; 3+ messages in thread
From: Nojus Gudinavičius @ 2023-07-24 11:03 UTC (permalink / raw)
To: zsh-users
Hello,
after exploring wayland I noticed that my zsh prompt is flickery. That
is, terminal emulator would render the cursor at X=0, then the prompt
with updated cursor in new frame. This causes flickering visible to bare
eye.
The weird thing is, this happens with only some configurations:
- zsh
- zsh --no-global-rcs # my .zshrc is completely empty. --sourcetrace
only lists /etc/zshenv and my empty .zshrc
But not with:
- zsh -f # --sourcetrace lists /etc/zshenv
- zsh -l
zsh 5.9 (x86_64-redhat-linux-gnu)
Thanks,
--
Nojus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Slower zsh prompt in weird circumstances
2023-07-24 11:03 Slower zsh prompt in weird circumstances Nojus Gudinavičius
@ 2023-08-21 12:48 ` Nojus Gudinavičius
2023-08-22 13:26 ` Peter Stephenson
0 siblings, 1 reply; 3+ messages in thread
From: Nojus Gudinavičius @ 2023-08-21 12:48 UTC (permalink / raw)
To: Nojus Gudinavičius, zsh-users
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)) {
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Slower zsh prompt in weird circumstances
2023-08-21 12:48 ` Nojus Gudinavičius
@ 2023-08-22 13:26 ` Peter Stephenson
0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2023-08-22 13:26 UTC (permalink / raw)
To: zsh-users
On 21/08/2023 13:48 Nojus Gudinavičius <nojus.gudinavicius@gmail.com> wrote:
> 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.
That looks a perfectly reasonable optimisation as far as it goes. I'll
commit it with the variable type changed to int --- we happen not to
use char's even for flags, not for any particularly good reason, I don't
think.
pws
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-22 13:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-24 11:03 Slower zsh prompt in weird circumstances Nojus Gudinavičius
2023-08-21 12:48 ` Nojus Gudinavičius
2023-08-22 13:26 ` Peter Stephenson
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).