Hi Bram,

2018-8-21(Tue) 22:57:39 UTC+9 Bram Moolenaar:
> Hirohito Higash wrote:
> 
> > Hi Bram and Good developers,
> > 
> > 2018-7-23(Mon) 0:00:23 UTC+9 h_east:
> > > Hi Dominique and developers,
> > > 
> > > 2018-7-22(Sun) 19:49:19 UTC+9 Dominique Pellé:
> > > > :help inputlist() says:
> > > > inputlist({textlist})                                   *inputlist()*
> > > > ...snip...
> > > >                 The user can also select an item by clicking on it with 
> > > > the
> > > >                 mouse.  For the first string 0 is returned.  When 
> > > > clicking
> > > >                 above the first item a negative number is returned.  
> > > > When
> > > >                 clicking on the prompt one more than the length of 
> > > > {textlist}
> > > >                 is returned.
> > > > ...snip...
> > > >                 Example: >
> > > >                         let color = inputlist(['Select color:', '1. 
> > > > red',
> > > >                                 \ '2. green', '3. blue'])
> > > > 
> > > > 
> > > > Yet, the mouse is taken into account.
> > > > 
> > > > I tried this:
> > > > $ vim --clean -c 'set mouse=a' -c "let color = inputlist(['Select 
> > > > color:', '1. red', '2. green', '3. blue'])"
> > > > 
> > > > 
> > > > I can only select an item with the keyboard but not with the mouse.
> > > > 
> > > > It's broken at least in the latest vim-8.1.203 in terminal and the gtk3 
> > > > GUI.
> > > > 
> > > > I see that it works fine in the older /usr/bin/vim (8.0.1453) which 
> > > > comes with xubuntu-18.04.
> > > > 
> > > > Doing a git bissection, I found that:
> > > > 
> > > > vim-8.0.1755 works fine
> > > > vim-8.0.1756 does not work
> > > > 
> > > > 
> > > > So this patch broke mouse selection in inputlist():
> > > > commit 73658317bacd9a0264dfaa32288de6ea1f236fe5
> > > > Author: Bram Moolenaar <[email protected]>
> > > > Date:   Tue Apr 24 17:41:57 2018 +0200
> > > > 
> > > >     patch 8.0.1756: GUI: after prompting for a number the mouse shape 
> > > > is wrong
> > > >     
> > > >     Problem:    GUI: after prompting for a number the mouse shape is 
> > > > sometimes
> > > >                 wrong.
> > > >     Solution:   Call setmouse() after setting "State". (Hirohito 
> > > > Higashi,
> > > >                 closes #2709)
> > > 
> > > Thank you for reporting this.
> > > 
> > > I investigated a little.
> > > Certainly the behavior on the terminal is broken at 8.0.1756.
> > > However, the behavior is not working properly before 8.0.1756 on gvim.
> > > I did `git bisect`. gvim broken at 8.0.0722
> > > 
> > > commit c9041079a199d753e73d3b242f21cc8db620179a (tag: v8.0.0722)
> > > Author: Bram Moolenaar <[email protected]>
> > > Date:   Sun Jul 16 15:48:46 2017 +0200
> > > 
> > >     patch 8.0.0722: screen is messed by timer up at inputlist() prompt
> > > 
> > >     Problem:    Screen is messed by timer up at inputlist() prompt.
> > >     Solution:   Set state to ASKMORE. (closes #1843)
> > 
> > I had more investigation.
> > 
> > I figured out why the cursor position moves to a wrong position when timer 
> > expired.
> > 
> > ---- Simple function call stack ----
> > // On calling inputlist()
> > f_inputlist();
> >   prompt_for_number();
> >     cmdline_row = 0;    // (A)
> >     State = CMDLINE;
> >     get_number();
> >       windgoto(msg_row, msg_col);
> >       c = safe_vgetc();    // <----- waiting key typed
> > 
> > 
> > // On timer expired
> > check_due_timer();
> >   redraw_after_callback();
> >     redrawcmd():
> >       if (ccline.cmdbuff == NULL)
> >       {
> >           // cmdline_row is Zero by (A).  So cursor position set to wrong.
> >           windgoto(cmdline_row, 0);
> >           msg_clr_eos();
> >           return;
> >       }
> > --------
> > 
> > I wrote and attached a patch.
> > - Revert 8.0.0722 and 8.0.1756
> > - when cmdline_row greater than zero, call redrawcmd() in 
> > redraw_after_callback().
> > 
> > I confirmed Vim 8.1.0304 on fedora 28 via PuTTY(TERM=xterm-256color) from 
> > Win10
> > and GVim on fedora 28.  Also good Ubuntu 18.04.
> > 
> > Please check out this.
> 
> Why remove the calls to setmouse()?  We do want the mouse pointer shape
> to be adjusted.

Before 8.0.0722 worked fine.  So that I reverted this.
But implement again.

> 
> redraw_after_callback() also calls update_screen(), depending on some
> conditions.  Perhaps the check for cmdline_row to be non-zero should be
> added there as well?

Probably I think so.
Patch updated.

Note:
I have not confirmed yet on GUI version.
I will be able to confirm by going to work. (After about 8 hours)

Thanks.

--
Best regards,
Hirohito Higashi (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/misc1.c b/src/misc1.c
index 1647aa952..a06d7f4f4 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -3752,13 +3752,12 @@ prompt_for_number(int *mouse_used)
     save_cmdline_row = cmdline_row;
     cmdline_row = 0;
     save_State = State;
-    State = ASKMORE;	/* prevents a screen update when using a timer */
+    State = CMDLINE;
 #ifdef FEAT_MOUSE
     /* May show different mouse shape. */
     setmouse();
 #endif
 
-
     i = get_number(TRUE, mouse_used);
     if (KeyTyped)
     {
diff --git a/src/screen.c b/src/screen.c
index a4eef3205..5ce415201 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -447,32 +447,36 @@ redraw_after_callback(int call_update_screen)
     ++redrawing_for_callback;
 
     if (State == HITRETURN || State == ASKMORE)
-	; /* do nothing */
+	; // do nothing
     else if (State & CMDLINE)
     {
-	/* Redrawing only works when the screen didn't scroll. Don't clear
-	 * wildmenu entries. */
-	if (msg_scrolled == 0
+	if (cmdline_row > 0)
+	{
+	    // Redrawing only works when the screen didn't scroll. Don't clear
+	    // wildmenu entries.
+	    if (msg_scrolled == 0
 #ifdef FEAT_WILDMENU
-		&& wild_menu_showing == 0
+		    && wild_menu_showing == 0
 #endif
-		&& call_update_screen)
-	    update_screen(0);
-	/* Redraw in the same position, so that the user can continue
-	 * editing the command. */
-	redrawcmdline_ex(FALSE);
+		    && call_update_screen)
+		update_screen(0);
+
+	    // Redraw in the same position, so that the user can continue
+	    // editing the command.
+	    redrawcmdline_ex(FALSE);
+	}
     }
     else if (State & (NORMAL | INSERT | TERMINAL))
     {
-	/* keep the command line if possible */
+	// keep the command line if possible
 	update_screen(VALID_NO_UPDATE);
 	setcursor();
     }
     cursor_on();
 #ifdef FEAT_GUI
     if (gui.in_use && !gui_mch_is_blink_off())
-	/* Don't update the cursor when it is blinking and off to avoid
-	 * flicker. */
+	// Don't update the cursor when it is blinking and off to avoid
+	// flicker.
 	out_flush_cursor(FALSE, FALSE);
     else
 #endif

Raspunde prin e-mail lui