Karsten Hopp f72909
To: vim-dev@vim.org
Karsten Hopp f72909
Subject: patch 7.1.069
Karsten Hopp f72909
Fcc: outbox
Karsten Hopp f72909
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp f72909
Mime-Version: 1.0
Karsten Hopp f72909
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp f72909
Content-Transfer-Encoding: 8bit
Karsten Hopp f72909
------------
Karsten Hopp f72909
Karsten Hopp f72909
Patch 7.1.069
Karsten Hopp f72909
Problem:    GTK GUI: When using confirm() without a default button there still
Karsten Hopp f72909
	    is a default choice.
Karsten Hopp f72909
Solution:   Ignore Enter and Space when there is no default button. (Chris
Karsten Hopp f72909
	    Lubinski)
Karsten Hopp f72909
Files:	    src/gui_gtk.c
Karsten Hopp f72909
Karsten Hopp f72909
Karsten Hopp f72909
*** ../vim-7.1.068/src/gui_gtk.c	Mon May 14 19:35:51 2007
Karsten Hopp f72909
--- src/gui_gtk.c	Sat Aug 11 17:38:03 2007
Karsten Hopp f72909
***************
Karsten Hopp f72909
*** 1630,1640 ****
Karsten Hopp f72909
   */
Karsten Hopp f72909
  /*ARGSUSED*/
Karsten Hopp f72909
      static int
Karsten Hopp f72909
! dlg_key_press_event(GtkWidget * widget, GdkEventKey * event, CancelData *data)
Karsten Hopp f72909
  {
Karsten Hopp f72909
!     /* Ignore hitting Enter when there is no default button. */
Karsten Hopp f72909
!     if (data->ignore_enter && event->keyval == GDK_Return)
Karsten Hopp f72909
  	return TRUE;
Karsten Hopp f72909
  
Karsten Hopp f72909
      if (event->keyval != GDK_Escape && event->keyval != GDK_Return)
Karsten Hopp f72909
  	return FALSE;
Karsten Hopp f72909
--- 1630,1643 ----
Karsten Hopp f72909
   */
Karsten Hopp f72909
  /*ARGSUSED*/
Karsten Hopp f72909
      static int
Karsten Hopp f72909
! dlg_key_press_event(GtkWidget *widget, GdkEventKey *event, CancelData *data)
Karsten Hopp f72909
  {
Karsten Hopp f72909
!     /* Ignore hitting Enter (or Space) when there is no default button. */
Karsten Hopp f72909
!     if (data->ignore_enter && (event->keyval == GDK_Return
Karsten Hopp f72909
! 						     || event->keyval == ' '))
Karsten Hopp f72909
  	return TRUE;
Karsten Hopp f72909
+     else    /* A different key was pressed, return to normal behavior */
Karsten Hopp f72909
+ 	data->ignore_enter = FALSE;
Karsten Hopp f72909
  
Karsten Hopp f72909
      if (event->keyval != GDK_Escape && event->keyval != GDK_Return)
Karsten Hopp f72909
  	return FALSE;
Karsten Hopp f72909
***************
Karsten Hopp f72909
*** 2223,2228 ****
Karsten Hopp f72909
--- 2226,2238 ----
Karsten Hopp f72909
  dialog_key_press_event_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
Karsten Hopp f72909
  {
Karsten Hopp f72909
      DialogInfo *di = (DialogInfo *)data;
Karsten Hopp f72909
+ 
Karsten Hopp f72909
+     /* Ignore hitting Enter (or Space) when there is no default button. */
Karsten Hopp f72909
+     if (di->ignore_enter && (event->keyval == GDK_Return
Karsten Hopp f72909
+ 						     || event->keyval == ' '))
Karsten Hopp f72909
+ 	return TRUE;
Karsten Hopp f72909
+     else    /* A different key was pressed, return to normal behavior */
Karsten Hopp f72909
+ 	di->ignore_enter = FALSE;
Karsten Hopp f72909
  
Karsten Hopp f72909
      /* Close the dialog when hitting "Esc". */
Karsten Hopp f72909
      if (event->keyval == GDK_Escape)
Karsten Hopp f72909
*** ../vim-7.1.068/src/version.c	Sun Aug 12 16:55:01 2007
Karsten Hopp f72909
--- src/version.c	Tue Aug 14 14:58:36 2007
Karsten Hopp f72909
***************
Karsten Hopp f72909
*** 668,669 ****
Karsten Hopp f72909
--- 668,671 ----
Karsten Hopp f72909
  {   /* Add new patch number below this line */
Karsten Hopp f72909
+ /**/
Karsten Hopp f72909
+     69,
Karsten Hopp f72909
  /**/
Karsten Hopp f72909
Karsten Hopp f72909
-- 
Karsten Hopp f72909
hundred-and-one symptoms of being an internet addict:
Karsten Hopp f72909
148. You find it easier to dial-up the National Weather Service
Karsten Hopp f72909
     Weather/your_town/now.html than to simply look out the window.
Karsten Hopp f72909
Karsten Hopp f72909
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp f72909
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp f72909
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp f72909
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///