Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.1.149
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.1.149
Problem:    GTK GUI: When the completion popup menu is used scrolling another
	    window by the scrollbar is OK, but using the scroll wheel it
	    behaves line <Enter>.
Solution:   Ignore K_MOUSEDOWN and K_MOUSEUP.  Fix redrawing the popup menu.
Files:	    src/edit.c, src/gui.c


*** ../vim-7.1.148/src/edit.c	Fri Oct 19 20:39:56 2007
--- src/edit.c	Sun Nov  4 16:17:42 2007
***************
*** 3385,3392 ****
      if (c != Ctrl_R && vim_is_ctrl_x_key(c))
  	edit_submode_extra = NULL;
  
!     /* Ignore end of Select mode mapping */
!     if (c == K_SELECT)
  	return retval;
  
      /* Set "compl_get_longest" when finding the first matches. */
--- 3385,3392 ----
      if (c != Ctrl_R && vim_is_ctrl_x_key(c))
  	edit_submode_extra = NULL;
  
!     /* Ignore end of Select mode mapping and mouse scroll buttons. */
!     if (c == K_SELECT || c == K_MOUSEDOWN || c == K_MOUSEUP)
  	return retval;
  
      /* Set "compl_get_longest" when finding the first matches. */
***************
*** 8652,8666 ****
      int		up;
  {
      pos_T	tpos;
! # if defined(FEAT_GUI) && defined(FEAT_WINDOWS)
!     win_T	*old_curwin;
  # endif
  
      tpos = curwin->w_cursor;
  
  # if defined(FEAT_GUI) && defined(FEAT_WINDOWS)
-     old_curwin = curwin;
- 
      /* Currently the mouse coordinates are only known in the GUI. */
      if (gui.in_use && mouse_row >= 0 && mouse_col >= 0)
      {
--- 8652,8667 ----
      int		up;
  {
      pos_T	tpos;
! # if defined(FEAT_WINDOWS)
!     win_T	*old_curwin = curwin;
! # endif
! # ifdef FEAT_INS_EXPAND
!     int		did_scroll = FALSE;
  # endif
  
      tpos = curwin->w_cursor;
  
  # if defined(FEAT_GUI) && defined(FEAT_WINDOWS)
      /* Currently the mouse coordinates are only known in the GUI. */
      if (gui.in_use && mouse_row >= 0 && mouse_col >= 0)
      {
***************
*** 8677,8692 ****
  # endif
  	undisplay_dollar();
  
!     if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))
! 	scroll_redraw(up, (long)(curwin->w_botline - curwin->w_topline));
!     else
! 	scroll_redraw(up, 3L);
  
  # if defined(FEAT_GUI) && defined(FEAT_WINDOWS)
      curwin->w_redr_status = TRUE;
  
      curwin = old_curwin;
      curbuf = curwin->w_buffer;
  # endif
  
      if (!equalpos(curwin->w_cursor, tpos))
--- 8678,8717 ----
  # endif
  	undisplay_dollar();
  
! # ifdef FEAT_INS_EXPAND
!     /* Don't scroll the window in which completion is being done. */
!     if (!pum_visible()
! #  if defined(FEAT_WINDOWS)
! 	    || curwin != old_curwin
! #  endif
! 	    )
! # endif
!     {
! 	if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))
! 	    scroll_redraw(up, (long)(curwin->w_botline - curwin->w_topline));
! 	else
! 	    scroll_redraw(up, 3L);
! # ifdef FEAT_INS_EXPAND
! 	did_scroll = TRUE;
! # endif
!     }
  
  # if defined(FEAT_GUI) && defined(FEAT_WINDOWS)
      curwin->w_redr_status = TRUE;
  
      curwin = old_curwin;
      curbuf = curwin->w_buffer;
+ # endif
+ 
+ # ifdef FEAT_INS_EXPAND
+     /* The popup menu may overlay the window, need to redraw it.
+      * TODO: Would be more efficient to only redraw the windows that are
+      * overlapped by the popup menu. */
+     if (pum_visible() && did_scroll)
+     {
+ 	redraw_all_later(NOT_VALID);
+ 	ins_compl_show_pum();
+     }
  # endif
  
      if (!equalpos(curwin->w_cursor, tpos))
*** ../vim-7.1.148/src/gui.c	Wed Sep  5 21:45:54 2007
--- src/gui.c	Fri Oct 19 16:14:57 2007
***************
*** 4214,4220 ****
  #endif
  	    )
      {
! 	redraw_win_later(wp, VALID);
  	updateWindow(wp);   /* update window, status line, and cmdline */
      }
  
--- 4214,4232 ----
  #endif
  	    )
      {
! 	int type = VALID;
! 
! #ifdef FEAT_INS_EXPAND
! 	if (pum_visible())
! 	{
! 	    type = NOT_VALID;
! 	    wp->w_lines_valid = 0;
! 	}
! #endif
! 	/* Don't set must_redraw here, it may cause the popup menu to
! 	 * disappear when losing focus after a scrollbar drag. */
! 	if (wp->w_redr_type < type)
! 	    wp->w_redr_type = type;
  	updateWindow(wp);   /* update window, status line, and cmdline */
      }
  
*** ../vim-7.1.148/src/version.c	Sun Nov  4 15:35:23 2007
--- src/version.c	Tue Nov  6 22:21:03 2007
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     149,
  /**/

-- 
From "know your smileys":
 ...---...   SOS

 /// Bram Moolenaar -- Bram@Moolenaar.net -- 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://ICCF-Holland.org    ///