Karsten Hopp d0889b
To: vim-dev@vim.org
Karsten Hopp d0889b
Subject: Patch 7.1.149
Karsten Hopp d0889b
Fcc: outbox
Karsten Hopp d0889b
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp d0889b
Mime-Version: 1.0
Karsten Hopp d0889b
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp d0889b
Content-Transfer-Encoding: 8bit
Karsten Hopp d0889b
------------
Karsten Hopp d0889b
Karsten Hopp d0889b
Patch 7.1.149
Karsten Hopp d0889b
Problem:    GTK GUI: When the completion popup menu is used scrolling another
Karsten Hopp d0889b
	    window by the scrollbar is OK, but using the scroll wheel it
Karsten Hopp d0889b
	    behaves line <Enter>.
Karsten Hopp d0889b
Solution:   Ignore K_MOUSEDOWN and K_MOUSEUP.  Fix redrawing the popup menu.
Karsten Hopp d0889b
Files:	    src/edit.c, src/gui.c
Karsten Hopp d0889b
Karsten Hopp d0889b
Karsten Hopp d0889b
*** ../vim-7.1.148/src/edit.c	Fri Oct 19 20:39:56 2007
Karsten Hopp d0889b
--- src/edit.c	Sun Nov  4 16:17:42 2007
Karsten Hopp d0889b
***************
Karsten Hopp d0889b
*** 3385,3392 ****
Karsten Hopp d0889b
      if (c != Ctrl_R && vim_is_ctrl_x_key(c))
Karsten Hopp d0889b
  	edit_submode_extra = NULL;
Karsten Hopp d0889b
  
Karsten Hopp d0889b
!     /* Ignore end of Select mode mapping */
Karsten Hopp d0889b
!     if (c == K_SELECT)
Karsten Hopp d0889b
  	return retval;
Karsten Hopp d0889b
  
Karsten Hopp d0889b
      /* Set "compl_get_longest" when finding the first matches. */
Karsten Hopp d0889b
--- 3385,3392 ----
Karsten Hopp d0889b
      if (c != Ctrl_R && vim_is_ctrl_x_key(c))
Karsten Hopp d0889b
  	edit_submode_extra = NULL;
Karsten Hopp d0889b
  
Karsten Hopp d0889b
!     /* Ignore end of Select mode mapping and mouse scroll buttons. */
Karsten Hopp d0889b
!     if (c == K_SELECT || c == K_MOUSEDOWN || c == K_MOUSEUP)
Karsten Hopp d0889b
  	return retval;
Karsten Hopp d0889b
  
Karsten Hopp d0889b
      /* Set "compl_get_longest" when finding the first matches. */
Karsten Hopp d0889b
***************
Karsten Hopp d0889b
*** 8652,8666 ****
Karsten Hopp d0889b
      int		up;
Karsten Hopp d0889b
  {
Karsten Hopp d0889b
      pos_T	tpos;
Karsten Hopp d0889b
! # if defined(FEAT_GUI) && defined(FEAT_WINDOWS)
Karsten Hopp d0889b
!     win_T	*old_curwin;
Karsten Hopp d0889b
  # endif
Karsten Hopp d0889b
  
Karsten Hopp d0889b
      tpos = curwin->w_cursor;
Karsten Hopp d0889b
  
Karsten Hopp d0889b
  # if defined(FEAT_GUI) && defined(FEAT_WINDOWS)
Karsten Hopp d0889b
-     old_curwin = curwin;
Karsten Hopp d0889b
- 
Karsten Hopp d0889b
      /* Currently the mouse coordinates are only known in the GUI. */
Karsten Hopp d0889b
      if (gui.in_use && mouse_row >= 0 && mouse_col >= 0)
Karsten Hopp d0889b
      {
Karsten Hopp d0889b
--- 8652,8667 ----
Karsten Hopp d0889b
      int		up;
Karsten Hopp d0889b
  {
Karsten Hopp d0889b
      pos_T	tpos;
Karsten Hopp d0889b
! # if defined(FEAT_WINDOWS)
Karsten Hopp d0889b
!     win_T	*old_curwin = curwin;
Karsten Hopp d0889b
! # endif
Karsten Hopp d0889b
! # ifdef FEAT_INS_EXPAND
Karsten Hopp d0889b
!     int		did_scroll = FALSE;
Karsten Hopp d0889b
  # endif
Karsten Hopp d0889b
  
Karsten Hopp d0889b
      tpos = curwin->w_cursor;
Karsten Hopp d0889b
  
Karsten Hopp d0889b
  # if defined(FEAT_GUI) && defined(FEAT_WINDOWS)
Karsten Hopp d0889b
      /* Currently the mouse coordinates are only known in the GUI. */
Karsten Hopp d0889b
      if (gui.in_use && mouse_row >= 0 && mouse_col >= 0)
Karsten Hopp d0889b
      {
Karsten Hopp d0889b
***************
Karsten Hopp d0889b
*** 8677,8692 ****
Karsten Hopp d0889b
  # endif
Karsten Hopp d0889b
  	undisplay_dollar();
Karsten Hopp d0889b
  
Karsten Hopp d0889b
!     if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))
Karsten Hopp d0889b
! 	scroll_redraw(up, (long)(curwin->w_botline - curwin->w_topline));
Karsten Hopp d0889b
!     else
Karsten Hopp d0889b
! 	scroll_redraw(up, 3L);
Karsten Hopp d0889b
  
Karsten Hopp d0889b
  # if defined(FEAT_GUI) && defined(FEAT_WINDOWS)
Karsten Hopp d0889b
      curwin->w_redr_status = TRUE;
Karsten Hopp d0889b
  
Karsten Hopp d0889b
      curwin = old_curwin;
Karsten Hopp d0889b
      curbuf = curwin->w_buffer;
Karsten Hopp d0889b
  # endif
Karsten Hopp d0889b
  
Karsten Hopp d0889b
      if (!equalpos(curwin->w_cursor, tpos))
Karsten Hopp d0889b
--- 8678,8717 ----
Karsten Hopp d0889b
  # endif
Karsten Hopp d0889b
  	undisplay_dollar();
Karsten Hopp d0889b
  
Karsten Hopp d0889b
! # ifdef FEAT_INS_EXPAND
Karsten Hopp d0889b
!     /* Don't scroll the window in which completion is being done. */
Karsten Hopp d0889b
!     if (!pum_visible()
Karsten Hopp d0889b
! #  if defined(FEAT_WINDOWS)
Karsten Hopp d0889b
! 	    || curwin != old_curwin
Karsten Hopp d0889b
! #  endif
Karsten Hopp d0889b
! 	    )
Karsten Hopp d0889b
! # endif
Karsten Hopp d0889b
!     {
Karsten Hopp d0889b
! 	if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))
Karsten Hopp d0889b
! 	    scroll_redraw(up, (long)(curwin->w_botline - curwin->w_topline));
Karsten Hopp d0889b
! 	else
Karsten Hopp d0889b
! 	    scroll_redraw(up, 3L);
Karsten Hopp d0889b
! # ifdef FEAT_INS_EXPAND
Karsten Hopp d0889b
! 	did_scroll = TRUE;
Karsten Hopp d0889b
! # endif
Karsten Hopp d0889b
!     }
Karsten Hopp d0889b
  
Karsten Hopp d0889b
  # if defined(FEAT_GUI) && defined(FEAT_WINDOWS)
Karsten Hopp d0889b
      curwin->w_redr_status = TRUE;
Karsten Hopp d0889b
  
Karsten Hopp d0889b
      curwin = old_curwin;
Karsten Hopp d0889b
      curbuf = curwin->w_buffer;
Karsten Hopp d0889b
+ # endif
Karsten Hopp d0889b
+ 
Karsten Hopp d0889b
+ # ifdef FEAT_INS_EXPAND
Karsten Hopp d0889b
+     /* The popup menu may overlay the window, need to redraw it.
Karsten Hopp d0889b
+      * TODO: Would be more efficient to only redraw the windows that are
Karsten Hopp d0889b
+      * overlapped by the popup menu. */
Karsten Hopp d0889b
+     if (pum_visible() && did_scroll)
Karsten Hopp d0889b
+     {
Karsten Hopp d0889b
+ 	redraw_all_later(NOT_VALID);
Karsten Hopp d0889b
+ 	ins_compl_show_pum();
Karsten Hopp d0889b
+     }
Karsten Hopp d0889b
  # endif
Karsten Hopp d0889b
  
Karsten Hopp d0889b
      if (!equalpos(curwin->w_cursor, tpos))
Karsten Hopp d0889b
*** ../vim-7.1.148/src/gui.c	Wed Sep  5 21:45:54 2007
Karsten Hopp d0889b
--- src/gui.c	Fri Oct 19 16:14:57 2007
Karsten Hopp d0889b
***************
Karsten Hopp d0889b
*** 4214,4220 ****
Karsten Hopp d0889b
  #endif
Karsten Hopp d0889b
  	    )
Karsten Hopp d0889b
      {
Karsten Hopp d0889b
! 	redraw_win_later(wp, VALID);
Karsten Hopp d0889b
  	updateWindow(wp);   /* update window, status line, and cmdline */
Karsten Hopp d0889b
      }
Karsten Hopp d0889b
  
Karsten Hopp d0889b
--- 4214,4232 ----
Karsten Hopp d0889b
  #endif
Karsten Hopp d0889b
  	    )
Karsten Hopp d0889b
      {
Karsten Hopp d0889b
! 	int type = VALID;
Karsten Hopp d0889b
! 
Karsten Hopp d0889b
! #ifdef FEAT_INS_EXPAND
Karsten Hopp d0889b
! 	if (pum_visible())
Karsten Hopp d0889b
! 	{
Karsten Hopp d0889b
! 	    type = NOT_VALID;
Karsten Hopp d0889b
! 	    wp->w_lines_valid = 0;
Karsten Hopp d0889b
! 	}
Karsten Hopp d0889b
! #endif
Karsten Hopp d0889b
! 	/* Don't set must_redraw here, it may cause the popup menu to
Karsten Hopp d0889b
! 	 * disappear when losing focus after a scrollbar drag. */
Karsten Hopp d0889b
! 	if (wp->w_redr_type < type)
Karsten Hopp d0889b
! 	    wp->w_redr_type = type;
Karsten Hopp d0889b
  	updateWindow(wp);   /* update window, status line, and cmdline */
Karsten Hopp d0889b
      }
Karsten Hopp d0889b
  
Karsten Hopp d0889b
*** ../vim-7.1.148/src/version.c	Sun Nov  4 15:35:23 2007
Karsten Hopp d0889b
--- src/version.c	Tue Nov  6 22:21:03 2007
Karsten Hopp d0889b
***************
Karsten Hopp d0889b
*** 668,669 ****
Karsten Hopp d0889b
--- 668,671 ----
Karsten Hopp d0889b
  {   /* Add new patch number below this line */
Karsten Hopp d0889b
+ /**/
Karsten Hopp d0889b
+     149,
Karsten Hopp d0889b
  /**/
Karsten Hopp d0889b
Karsten Hopp d0889b
-- 
Karsten Hopp d0889b
From "know your smileys":
Karsten Hopp d0889b
 ...---...   SOS
Karsten Hopp d0889b
Karsten Hopp d0889b
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp d0889b
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp d0889b
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp d0889b
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///