Pierre Habouzit wrote:

> in certain conditions, vim was freezing on swap file prompt. One of our
> users tracked that bug down, and a patch is attached.
> 
>     look http://bugs.debian.org/292397
> 
> for more explanations !

[...]

> Subject: Bug#292397: vim freezes on swap file prompt
> Date: Jeu 13 Avril 2006 13:55
> From: Bas Zoetekouw <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]

[...]

> If I set a breakpoint on line 3026 of misc1.c (just after the
> ui_inchar() call), I can verify that indeed a special key code is
> returned (i.e. the cursor I pressed).  Specifically, the key code
> returned is 0x80 0x8a 0x95 ("\eku", which I guess means the uparrow).
> However, this key is not handled at all:  in the FEAT_MBYTE ifdef on
> line 3084, the "continue" is called, and the loop progresses to the
>  next iteration, after which the key is never returned anymore by
> get_keystroke().
> 
> So, the problem seems to be that the special sequences that are
> generated by the cursor keys are mistaken for an incomplete multibyte
> sequence; the check for such a special sequence is only done in
> do_diaglog(), after get_keystroke() has returned.
> 
> The following patch solves this, and works fine here.  Please include
>  it in the debian packages and also send it upstream.
> 
> --- vim/src/misc1.eerst       2006-04-13 13:45:37.000000000 +0200
> +++ vim/src/misc1.c   2006-04-13 13:48:10.000000000 +0200
> @@ -3082,7 +3082,9 @@
>           }
>       }
>  #ifdef FEAT_MBYTE
> -     if (has_mbyte)
> +     /* if n<0, this is a special key (eg cursor) which should
> +      * not be mistaken for an incomplete multibyte sequence */
> +     if (has_mbyte && n>=0)
>       {
>           if (MB_BYTE2LEN(n) > len)
>               continue;       /* more bytes to get */

I think a simpler solution is to add a "break" in the situation that
K_SPECIAL is seen and the special key is not ignored:

*** misc1.c~    Thu Apr 13 15:42:20 2006
--- misc1.c     Thu Apr 13 16:56:51 2006
***************
*** 3085,3090 ****
--- 3085,3091 ----
                    mch_memmove(buf, buf + 3, (size_t)len);
                continue;
            }
+           break;
        }
  #ifdef FEAT_MBYTE
        if (has_mbyte)

-- 
hundred-and-one symptoms of being an internet addict:
75. You start wondering whether you could actually upgrade your brain
    with a Pentium Pro microprocessor 80.  The upgrade works just fine.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://www.ICCF.nl         ///

Reply via email to