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

Re: Oddity with reset-prompt and vared



On 12 August 2010 21:56, Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> On Tue, 3 Aug 2010 22:30:32 +0200
> Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>> % zsh -f
>> % function a() { zle reset-prompt; zle .accept-line }
>> % zle -N accept-line a
>> % a=
>> % vared a
>> aoeua
>> % vared a
>> ããããã<press enter>
>> <the end of the string is replaced with spaces>
>
> This is a quite general (if rather boring) problem, I'm not sure why it
> hasn't shown up before.
>
> Second hunk isn't related but looks sensible.
>
> Index: Src/Zle/zle_refresh.c
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_refresh.c,v
> retrieving revision 1.79
> diff -p -u -r1.79 zle_refresh.c
> --- Src/Zle/zle_refresh.c       2 Aug 2010 09:02:30 -0000       1.79
> +++ Src/Zle/zle_refresh.c       12 Aug 2010 19:54:48 -0000
> @@ -1789,7 +1789,7 @@ refreshline(int ln)
>  /* 0: setup */
>     nl = nbuf[ln];
>     rnllen = nllen = nl ? ZR_strlen(nl) : 0;
> -    if (obuf[ln]) {
> +    if (ln < olnct && obuf[ln]) {
>        ol = obuf[ln];
>        ollen = ZR_strlen(ol);
>     }
> @@ -2083,7 +2083,12 @@ refreshline(int ln)
>            if (now_off)
>                settextattributes(TXT_ATTR_OFF_FROM_ON(now_off));
>
> +#ifdef MULTIBYTE_SUPPORT
> +           if (nl->chr != WEOF)
> +               zputc(nl);
> +#else
>            zputc(nl);
> +#endif
>            nl++, ol++;
>            ccs++, vcs++;
>  #ifdef MULTIBYTE_SUPPORT

Hm, maybe this is also the source of my mysterious problem of text
sometimes disappearing from the command line very rarely. I'll keep an
eye out for if that still happens. (I may not have reported it as I
was never able to reproduce it).

-- 
Mikael Magnusson



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