Hi Bram,

2016-3-19(Sat) 22:11:43 UTC+9 Bram Moolenaar:
> Patch 7.4.1594
> Problem:    Timers don't work on Unix.
> Solution:   Add missing code.
> Files:      src/os_unix.c
> 
> 
> *** ../vim-7.4.1593/src/os_unix.c     2016-03-11 22:52:00.738438072 +0100
> --- src/os_unix.c     2016-03-19 14:05:21.646727700 +0100
> ***************
> *** 176,181 ****
> --- 176,182 ----
>   static pid_t wait4pid(pid_t, waitstatus *);
>   
>   static int  WaitForChar(long);
> + static int  WaitForCharOrMouse(long);
>   #if defined(__BEOS__) || defined(VMS)
>   int  RealWaitForChar(int, long, int *);
>   #else
> ***************
> *** 5347,5359 ****
>   }
>   
>   /*
> !  * Wait "msec" msec until a character is available from the keyboard or from
> !  * inbuf[]. msec == -1 will block forever.
>    * When a GUI is being used, this will never get called -- webb
>    */
>       static int
>   WaitForChar(long msec)
>   {
>   #ifdef FEAT_MOUSE_GPM
>       int             gpm_process_wanted;
>   #endif
> --- 5348,5397 ----
>   }
>   
>   /*
> !  * Wait "msec" msec until a character is available from the mouse, keyboard,
> !  * from inbuf[].
> !  * "msec" == -1 will block forever.
> !  * Invokes timer callbacks when needed.
>    * When a GUI is being used, this will never get called -- webb
>    */
>       static int
>   WaitForChar(long msec)
>   {
> + #ifdef FEAT_TIMERS
> +     long    due_time;
> +     long    remaining = msec;
> + 
> +     /* When waiting very briefly don't trigger timers. */
> +     if (msec >= 0 && msec < 10L)
> +     return WaitForCharOrMouse(msec);
> + 
> +     while (msec < 0 || remaining > 0)
> +     {
> +     /* Trigger timers and then get the time in msec until the next one is
> +      * due.  Wait up to that time. */
> +     due_time = check_due_timer();
> +     if (due_time <= 0 || (msec > 0 && due_time > remaining))
> +         due_time = remaining;
> +     if (WaitForCharOrMouse(due_time))
> +         return TRUE;
> +     if (msec > 0)
> +         remaining -= due_time;
> +     }
> +     return FALSE;
> + #else
> +     return WaitForCharOrMouse(msec);
> + #endif
> + }
> + 
> + /*
> +  * Wait "msec" msec until a character is available from the mouse or 
> keyboard
> +  * or from inbuf[].
> +  * "msec" == -1 will block forever.
> +  * When a GUI is being used, this will never get called -- webb
> +  */
> +     static int
> + WaitForCharOrMouse(long msec)
> + {
>   #ifdef FEAT_MOUSE_GPM
>       int             gpm_process_wanted;
>   #endif
> *** ../vim-7.4.1593/src/version.c     2016-03-19 13:49:39.460590857 +0100
> --- src/version.c     2016-03-19 14:06:12.342197470 +0100
> ***************
> *** 750,751 ****
> --- 750,753 ----
>   {   /* Add new patch number below this line */
> + /**/
> +     1594,
>   /**/

Yeah, I had been waiting for this patch :-)

I checked this patch.
I found many wrong redraw behavior.

sample.vim
----
let g:tt_cnt = 0
func MyHandler(timer)
        let g:tt_cnt += 1
        echo g:tt_cnt
endfunc
let timer = timer_start(500, 'MyHandler', {'repeat': 200})
----

$ vim -Nu NONE -S ttt.vim -c "set wildmenu"

1. type :
   --> over write by timer callback's echo message.

2. type <Esc>:set <TAB>
   --> wild menu is over write unexpected statusline redraw.

3. type <ESC>:ver<CR>
   --> `-- More --` duplicate.
   and type <Space>
   --> timer callback's echo message displayed more line.

We need a screen drawing in other than the normal mode and the insert mode?

I don't know well, but wrote a patch.
How about this?

--
Best regards,
Hirohito Higashi (a.k.a. h_east)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/screen.c b/src/screen.c
index c1eb1c4..e608aed 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -418,8 +418,13 @@ redraw_asap(int type)
     void
 redraw_after_callback()
 {
-    update_screen(0);
-    setcursor();
+    if (State & CMDLINE)
+	redrawcmdline();
+    else if ((State & NORMAL) || (State & INSERT))
+    {
+	update_screen(0);
+	setcursor();
+    }
     cursor_on();
     out_flush();
 #ifdef FEAT_GUI

Raspunde prin e-mail lui