zsh-workers
 help / color / mirror / code / Atom feed
* Oddity with reset-prompt and vared
@ 2010-08-03 20:30 Mikael Magnusson
  2010-08-12 19:56 ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Mikael Magnusson @ 2010-08-03 20:30 UTC (permalink / raw)
  To: zsh workers

This is mostly out of curiosity, I've already worked around the
problem by checking $CONTEXT for vared before running reset-prompt
since it doesn't make sense anyway, but I noticed this happening

% 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>
ち
%

If the cause of this isn't immediately obvious then I won't be sad if
no one investigates further, just thought I'd mention it.

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Oddity with reset-prompt and vared
  2010-08-03 20:30 Oddity with reset-prompt and vared Mikael Magnusson
@ 2010-08-12 19:56 ` Peter Stephenson
  2010-08-12 20:14   ` Mikael Magnusson
  2010-08-13  8:48   ` Peter Stephenson
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Stephenson @ 2010-08-12 19:56 UTC (permalink / raw)
  To: zsh workers

On Tue, 3 Aug 2010 22:30:32 +0200
Mikael Magnusson <mikachu@gmail.com> 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

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Oddity with reset-prompt and vared
  2010-08-12 19:56 ` Peter Stephenson
@ 2010-08-12 20:14   ` Mikael Magnusson
  2010-08-13  8:48   ` Peter Stephenson
  1 sibling, 0 replies; 4+ messages in thread
From: Mikael Magnusson @ 2010-08-12 20:14 UTC (permalink / raw)
  To: zsh workers

On 12 August 2010 21:56, Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> On Tue, 3 Aug 2010 22:30:32 +0200
> Mikael Magnusson <mikachu@gmail.com> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Oddity with reset-prompt and vared
  2010-08-12 19:56 ` Peter Stephenson
  2010-08-12 20:14   ` Mikael Magnusson
@ 2010-08-13  8:48   ` Peter Stephenson
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2010-08-13  8:48 UTC (permalink / raw)
  To: zsh workers

On Thu, 12 Aug 2010 20:56:13 +0100
Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> Second hunk isn't related but looks sensible.

Actually, I think the code was deliberately the way it was, to keep
attributes like inverse video correct for double width characters.  There's
a test further in for WEOF.  I leave it as it was except for a comment.  If
you saw odd blobs in the display with the original patch that would probabl
be the reason.

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-13  8:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-03 20:30 Oddity with reset-prompt and vared Mikael Magnusson
2010-08-12 19:56 ` Peter Stephenson
2010-08-12 20:14   ` Mikael Magnusson
2010-08-13  8:48   ` 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).