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