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 / patches / old / 5.5.017 < prev    next >
Encoding:
Internet Message Format  |  1999-10-03  |  4.4 KB

  1. To: vim-dev@vim.org
  2. Subject: patch 5.5.017
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. ------------
  6.  
  7. Patch 5.5.017
  8. Problem:    If an error occurs when closing the current window, Vim could get
  9.         stuck in the error handling.
  10. Solution:   Don't set curwin to NULL when closing the current window.
  11. Files:        src/window.c
  12.  
  13.  
  14. *** ../vim-5.5.16/src/window.c    Wed Sep 22 10:06:19 1999
  15. --- src/window.c    Mon Oct  4 11:29:09 1999
  16. ***************
  17. *** 17,22 ****
  18. --- 17,23 ----
  19.   static void win_exchange __ARGS((long));
  20.   static void win_rotate __ARGS((int, int));
  21.   static void win_goto __ARGS((WIN *wp));
  22. + static void win_enter_ext __ARGS((WIN *wp, int undo_sync, int no_curwin));
  23.   static void win_append __ARGS((WIN *, WIN *));
  24.   static void win_remove __ARGS((WIN *));
  25.   static void win_new_height __ARGS((WIN *, int));
  26. ***************
  27. *** 871,876 ****
  28. --- 872,878 ----
  29.   #ifdef AUTOCMD
  30.       int        other_buffer = FALSE;
  31.   #endif
  32. +     int        close_curwin = FALSE;
  33.   
  34.       if (lastwin == firstwin)
  35.       {
  36. ***************
  37. *** 932,944 ****
  38.   
  39.       win_new_height(wp, wp->w_height + win->w_height + win->w_status_height);
  40.       win_free(win);
  41.       if (win == curwin)
  42. !     curwin = NULL;
  43.       if (p_ea)
  44.       win_equal(wp, FALSE);
  45. !     if (curwin == NULL)
  46.       {
  47. !     win_enter(wp, FALSE);
  48.   #ifdef AUTOCMD
  49.       if (other_buffer)
  50.           /* careful: after this wp and win may be invalid! */
  51. --- 934,952 ----
  52.   
  53.       win_new_height(wp, wp->w_height + win->w_height + win->w_status_height);
  54.       win_free(win);
  55. +     /* Make sure curwin isn't invalid.  It can cause severe trouble when
  56. +      * printing an error message. */
  57.       if (win == curwin)
  58. !     {
  59. !     curwin = wp;
  60. !     close_curwin = TRUE;
  61. !     }
  62.       if (p_ea)
  63.       win_equal(wp, FALSE);
  64. !     if (close_curwin)
  65.       {
  66. !     win_enter_ext(wp, FALSE, TRUE);
  67.   #ifdef AUTOCMD
  68.       if (other_buffer)
  69.           /* careful: after this wp and win may be invalid! */
  70. ***************
  71. *** 1106,1127 ****
  72.   
  73.   /*
  74.    * Make window wp the current window.
  75. -  * Can be called when curwin == NULL, if curwin already has been closed.
  76.    */
  77.       void
  78.   win_enter(wp, undo_sync)
  79. !     WIN        *wp;
  80. !     int        undo_sync;
  81.   {
  82.   #ifdef AUTOCMD
  83.       int        other_buffer = FALSE;
  84.   #endif
  85.   
  86. !     if (wp == curwin)        /* nothing to do */
  87.       return;
  88.   
  89.   #ifdef AUTOCMD
  90. !     if (curwin != NULL)
  91.       {
  92.       /*
  93.        * Be careful: If autocommands delete the window, return now.
  94. --- 1114,1148 ----
  95.   
  96.   /*
  97.    * Make window wp the current window.
  98.    */
  99.       void
  100.   win_enter(wp, undo_sync)
  101. !     WIN        *wp;
  102. !     int        undo_sync;
  103. ! {
  104. !     win_enter_ext(wp, undo_sync, FALSE);
  105. ! }
  106. ! /*
  107. !  * Make window wp the current window.
  108. !  * Can be called with "curwin_invalid" TRUE, which means that curwin has just
  109. !  * been closed and isn't valid.
  110. !  */
  111. !     static void
  112. ! win_enter_ext(wp, undo_sync, curwin_invalid)
  113. !     WIN        *wp;
  114. !     int        undo_sync;
  115. !     int        curwin_invalid;
  116.   {
  117.   #ifdef AUTOCMD
  118.       int        other_buffer = FALSE;
  119.   #endif
  120.   
  121. !     if (wp == curwin && !curwin_invalid)    /* nothing to do */
  122.       return;
  123.   
  124.   #ifdef AUTOCMD
  125. !     if (!curwin_invalid)
  126.       {
  127.       /*
  128.        * Be careful: If autocommands delete the window, return now.
  129. ***************
  130. *** 1145,1151 ****
  131.       /* may have to copy the buffer options when 'cpo' contains 'S' */
  132.       if (wp->w_buffer != curbuf)
  133.       buf_copy_options(curbuf, wp->w_buffer, BCO_ENTER | BCO_NOHELP);
  134. !     if (curwin != NULL)
  135.       {
  136.       prevwin = curwin;    /* remember for CTRL-W p */
  137.       curwin->w_redr_status = TRUE;
  138. --- 1166,1172 ----
  139.       /* may have to copy the buffer options when 'cpo' contains 'S' */
  140.       if (wp->w_buffer != curbuf)
  141.       buf_copy_options(curbuf, wp->w_buffer, BCO_ENTER | BCO_NOHELP);
  142. !     if (!curwin_invalid)
  143.       {
  144.       prevwin = curwin;    /* remember for CTRL-W p */
  145.       curwin->w_redr_status = TRUE;
  146. *** ../vim-5.5.16/src/version.c    Mon Oct  4 11:25:03 1999
  147. --- src/version.c    Mon Oct  4 11:24:44 1999
  148. ***************
  149. *** 420,420 ****
  150. --- 420,421 ----
  151.   {   /* Add new patch number below this line */
  152. +     17,
  153.  
  154. --
  155. ARTHUR: (as the MAN next to him is squashed by a sheep) Knights!  Run away!
  156.    Midst echoing shouts of "run away" the KNIGHTS retreat to cover with the odd
  157.    cow or goose hitting them still.  The KNIGHTS crouch down under cover.
  158.                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
  159.  
  160. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\--
  161.   \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /
  162.