home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / unreleased / patches / old / 5.4p.11 < prev    next >
Encoding:
Internet Message Format  |  1999-07-21  |  3.5 KB

  1. To: vim-dev@vim.org
  2. Subject: patch 5.4p.11
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. ------------
  6.  
  7. This replaces the patch that was previously sent out for testing.  I
  8. discovered that the code in gui_w32.c was already doing the same thing.  I
  9. merged the MS-Windows and the X11 code.
  10.  
  11.  
  12. Patch 5.4p.11
  13. Problem:    Motif, Athena and GTK: When closing the GUI window when there is a
  14.             changed buffer, there was only an error message and Vim would not
  15.             exit.
  16. Solution:   Put up a dialog, like for ":confirm qa".  Uses the code that was
  17.             already used for MS-Windows.
  18. Files:      src/gui.c, src/gui_w32.c
  19.  
  20.  
  21. *** ../vim-5.4p/src/gui.c    Mon Jul 19 11:10:55 1999
  22. --- src/gui.c    Thu Jul 22 13:47:04 1999
  23. ***************
  24. *** 502,507 ****
  25. --- 502,508 ----
  26.       gui_mch_exit(rc);
  27.   }
  28.   
  29. + #if defined(USE_GUI_GTK) || defined(USE_GUI_X11) || defined(USE_GUI_MSWIN)
  30.   /*
  31.    * Called when the GUI window is closed by the user.  If there are no changed
  32.    * files Vim exits, otherwise there will be a dialog to ask the user what to
  33. ***************
  34. *** 511,525 ****
  35.       void
  36.   gui_window_closed()
  37.   {
  38.       /* Only exit when there are no changed files */
  39.       exiting = TRUE;
  40. !     if (!check_changed_any(FALSE)) /* will give warning for changed buffer */
  41.       getout(0);
  42.   
  43.       exiting = FALSE;
  44.       setcursor();        /* position cursor */
  45.       out_flush();
  46.   }
  47.   
  48.   /*
  49.    * Set the font. Uses the 'font' option. The first font name that works is
  50. --- 512,548 ----
  51.       void
  52.   gui_window_closed()
  53.   {
  54. + # ifdef USE_BROWSE
  55. +     int save_browse = browse;
  56. + # endif
  57. + # if defined(GUI_DIALOG) || defined(CON_DIALOG)
  58. +     int    save_confirm = confirm;
  59. + # endif
  60.       /* Only exit when there are no changed files */
  61.       exiting = TRUE;
  62. ! # ifdef USE_BROWSE
  63. !     browse = TRUE;
  64. ! # endif
  65. ! # if defined(GUI_DIALOG) || defined(CON_DIALOG)
  66. !     confirm = TRUE;
  67. ! # endif
  68. !     /* If there are changed buffers, present the user with a dialog if
  69. !      * possible, otherwise give an error message. */
  70. !     if (!check_changed_any(FALSE))
  71.       getout(0);
  72.   
  73.       exiting = FALSE;
  74. + # ifdef USE_BROWSE
  75. +     browse = save_browse;
  76. + # endif
  77. + # if defined(GUI_DIALOG) || defined(CON_DIALOG)
  78. +     confirm = save_confirm;
  79. + # endif
  80.       setcursor();        /* position cursor */
  81.       out_flush();
  82.   }
  83. + #endif
  84.   
  85.   /*
  86.    * Set the font. Uses the 'font' option. The first font name that works is
  87. *** ../vim-5.4p/src/gui_w32.c    Mon Jul 19 11:09:06 1999
  88. --- src/gui_w32.c    Thu Jul 22 13:44:15 1999
  89. ***************
  90. *** 604,636 ****
  91.   _OnClose(
  92.       HWND hwnd)
  93.   {
  94. ! #ifdef USE_BROWSE
  95. !     int save_browse = browse;
  96. ! #endif
  97. ! #if defined(GUI_DIALOG) || defined(CON_DIALOG)
  98. !     int save_confirm = confirm;
  99. ! #endif
  100. !     /* Only exit when there are no changed files */
  101. !     exiting = TRUE;
  102. ! #ifdef USE_BROWSE
  103. !     browse = TRUE;
  104. ! #endif
  105. ! #if defined(GUI_DIALOG) || defined(CON_DIALOG)
  106. !     confirm = TRUE;
  107. ! #endif
  108. !     if (!check_changed_any(FALSE))    /* will give warning for changed buffer */
  109. !     getout(0);
  110. !     exiting = FALSE;
  111. ! #ifdef USE_BROWSE
  112. !     browse = save_browse;
  113. ! #endif
  114. ! #if defined(GUI_DIALOG) || defined(CON_DIALOG)
  115. !     confirm = save_confirm;
  116. ! #endif
  117. !     setcursor();            /* position cursor */
  118. !     out_flush();
  119.   }
  120.   
  121.   /*
  122. --- 598,604 ----
  123.   _OnClose(
  124.       HWND hwnd)
  125.   {
  126. !     gui_window_closed();
  127.   }
  128.   
  129.   /*
  130.  
  131. --
  132. hundred-and-one symptoms of being an internet addict:
  133. 221. Your wife melts your keyboard in the oven.
  134.  
  135. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\--
  136.   \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /
  137.