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

Re: clear-screen widget and prompt expansion



On Feb 16, 11:01am, Vincent Lefevre wrote:
}
} I meant that prompt is already re-expanded when the terminal is
} resized. What I'm saying is that clear-screen is not consistent
} with that.

Ah.  Well, clear-screen is a widget and existed in primordial form
long before the shell even knew about SIGWINCH, so it's not very
surprising that it hasn't been overhauled with more recent changes
to prompt handling.

This raises the question of whether redisplay (^R) should also imply
a reset-prompt.  However, it explicitly says "the edit buffer" whereas
clear-screen mentions "redraw the prompt".

}   zle -A clear-screen real-clear-screen
}   cls-rp() { zle real-clear-screen; zle reset-prompt }
}   zle -N clear-screen cls-rp
} 
} [...] doesn't work in incremental search mode

That's because incremental-search has its own input loop and does not
recognize user-defined widgets.  An entirely different problem.

Does the following break anything?


diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 3d2471e..7e4f328 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -2424,6 +2424,7 @@ clearscreen(UNUSED(char **args))
     tcoutclear(TCCLEARSCREEN);
     resetneeded = 1;
     clearflag = 0;
+    reexpandprompt();
     return 0;
 }
 



Messages sorted by: Reverse Date, Date, Thread, Author