astepano / rpms / vim

Forked from rpms/vim 6 years ago
Clone
2102f06
To: vim-dev@vim.org
2102f06
Subject: Patch 7.2.215
2102f06
Fcc: outbox
2102f06
From: Bram Moolenaar <Bram@moolenaar.net>
2102f06
Mime-Version: 1.0
2102f06
Content-Type: text/plain; charset=UTF-8
2102f06
Content-Transfer-Encoding: 8bit
2102f06
------------
2102f06
2102f06
Patch 7.2.215
2102f06
Problem:    ml_get error when using ":vimgrep".
2102f06
Solution:   Load the memfile for the hidden buffer before putting it in a
2102f06
	    window.  Correct the order of splitting the window and filling
2102f06
	    the window and buffer with data.
2102f06
Files:	    src/fileio.c, src/proto/window.pro, src/quickfix.c, src/window.c
2102f06
2102f06
2102f06
*** ../vim-7.2.214/src/fileio.c	2009-06-24 11:57:53.000000000 +0200
2102f06
--- src/fileio.c	2009-06-24 12:53:19.000000000 +0200
2102f06
***************
2102f06
*** 710,716 ****
2102f06
  #endif
2102f06
  #ifdef UNIX
2102f06
  	/* Set swap file protection bits after creating it. */
2102f06
! 	if (swap_mode > 0 && curbuf->b_ml.ml_mfp->mf_fname != NULL)
2102f06
  	    (void)mch_setperm(curbuf->b_ml.ml_mfp->mf_fname, (long)swap_mode);
2102f06
  #endif
2102f06
      }
2102f06
--- 710,717 ----
2102f06
  #endif
2102f06
  #ifdef UNIX
2102f06
  	/* Set swap file protection bits after creating it. */
2102f06
! 	if (swap_mode > 0 && curbuf->b_ml.ml_mfp != NULL
2102f06
! 			  && curbuf->b_ml.ml_mfp->mf_fname != NULL)
2102f06
  	    (void)mch_setperm(curbuf->b_ml.ml_mfp->mf_fname, (long)swap_mode);
2102f06
  #endif
2102f06
      }
2102f06
***************
2102f06
*** 8435,8443 ****
2102f06
  	 * effects, insert it in a the current tab page.
2102f06
  	 * Anything related to a window (e.g., setting folds) may have
2102f06
  	 * unexpected results. */
2102f06
! 	curwin = aucmd_win;
2102f06
! 	curwin->w_buffer = buf;
2102f06
  	++buf->b_nwindows;
2102f06
  
2102f06
  #ifdef FEAT_WINDOWS
2102f06
  	/* Split the current window, put the aucmd_win in the upper half. */
2102f06
--- 8436,8444 ----
2102f06
  	 * effects, insert it in a the current tab page.
2102f06
  	 * Anything related to a window (e.g., setting folds) may have
2102f06
  	 * unexpected results. */
2102f06
! 	aucmd_win->w_buffer = buf;
2102f06
  	++buf->b_nwindows;
2102f06
+ 	win_init_empty(aucmd_win); /* set cursor and topline to safe values */
2102f06
  
2102f06
  #ifdef FEAT_WINDOWS
2102f06
  	/* Split the current window, put the aucmd_win in the upper half. */
2102f06
***************
2102f06
*** 8448,8459 ****
2102f06
  	(void)win_comp_pos();   /* recompute window positions */
2102f06
  	p_ea = save_ea;
2102f06
  #endif
2102f06
! 	/* set cursor and topline to safe values */
2102f06
! 	curwin_init();
2102f06
! #ifdef FEAT_VERTSPLIT
2102f06
! 	curwin->w_wincol = 0;
2102f06
! 	curwin->w_width = Columns;
2102f06
! #endif
2102f06
      }
2102f06
      curbuf = buf;
2102f06
      aco->new_curwin = curwin;
2102f06
--- 8449,8455 ----
2102f06
  	(void)win_comp_pos();   /* recompute window positions */
2102f06
  	p_ea = save_ea;
2102f06
  #endif
2102f06
! 	curwin = aucmd_win;
2102f06
      }
2102f06
      curbuf = buf;
2102f06
      aco->new_curwin = curwin;
2102f06
*** ../vim-7.2.214/src/proto/window.pro	2009-06-16 16:01:34.000000000 +0200
2102f06
--- src/proto/window.pro	2009-06-24 12:53:13.000000000 +0200
2102f06
***************
2102f06
*** 14,19 ****
2102f06
--- 14,20 ----
2102f06
  win_T *winframe_remove __ARGS((win_T *win, int *dirp, tabpage_T *tp));
2102f06
  void close_others __ARGS((int message, int forceit));
2102f06
  void curwin_init __ARGS((void));
2102f06
+ void win_init_empty __ARGS((win_T *wp));
2102f06
  int win_alloc_first __ARGS((void));
2102f06
  void win_alloc_aucmd_win __ARGS((void));
2102f06
  void win_init_size __ARGS((void));
2102f06
*** ../vim-7.2.214/src/quickfix.c	2009-05-17 13:30:58.000000000 +0200
2102f06
--- src/quickfix.c	2009-06-24 15:30:06.000000000 +0200
2102f06
***************
2102f06
*** 3411,3424 ****
2102f06
      /* Init the options. */
2102f06
      buf_copy_options(newbuf, BCO_ENTER | BCO_NOHELP);
2102f06
  
2102f06
!     /* set curwin/curbuf to buf and save a few things */
2102f06
!     aucmd_prepbuf(&aco, newbuf);
2102f06
  
2102f06
!     /* Need to set the filename for autocommands. */
2102f06
!     (void)setfname(curbuf, fname, NULL, FALSE);
2102f06
  
2102f06
-     if (ml_open(curbuf) == OK)
2102f06
-     {
2102f06
  	/* Create swap file now to avoid the ATTENTION message. */
2102f06
  	check_need_swap(TRUE);
2102f06
  
2102f06
--- 3411,3425 ----
2102f06
      /* Init the options. */
2102f06
      buf_copy_options(newbuf, BCO_ENTER | BCO_NOHELP);
2102f06
  
2102f06
!     /* need to open the memfile before putting the buffer in a window */
2102f06
!     if (ml_open(newbuf) == OK)
2102f06
!     {
2102f06
! 	/* set curwin/curbuf to buf and save a few things */
2102f06
! 	aucmd_prepbuf(&aco, newbuf);
2102f06
  
2102f06
! 	/* Need to set the filename for autocommands. */
2102f06
! 	(void)setfname(curbuf, fname, NULL, FALSE);
2102f06
  
2102f06
  	/* Create swap file now to avoid the ATTENTION message. */
2102f06
  	check_need_swap(TRUE);
2102f06
  
2102f06
***************
2102f06
*** 3441,3450 ****
2102f06
  		newbuf = curbuf;
2102f06
  	    }
2102f06
  	}
2102f06
-     }
2102f06
  
2102f06
!     /* restore curwin/curbuf and a few other things */
2102f06
!     aucmd_restbuf(&aco;;
2102f06
  
2102f06
      if (!buf_valid(newbuf))
2102f06
  	return NULL;
2102f06
--- 3442,3451 ----
2102f06
  		newbuf = curbuf;
2102f06
  	    }
2102f06
  	}
2102f06
  
2102f06
! 	/* restore curwin/curbuf and a few other things */
2102f06
! 	aucmd_restbuf(&aco;;
2102f06
!     }
2102f06
  
2102f06
      if (!buf_valid(newbuf))
2102f06
  	return NULL;
2102f06
*** ../vim-7.2.214/src/window.c	2009-06-16 16:01:34.000000000 +0200
2102f06
--- src/window.c	2009-06-24 14:35:16.000000000 +0200
2102f06
***************
2102f06
*** 2354,2366 ****
2102f06
      frame_T	*frp;
2102f06
      win_T	*wp;
2102f06
  
2102f06
- #ifdef FEAT_FOLDING
2102f06
-     clearFolding(win);
2102f06
- #endif
2102f06
- 
2102f06
-     /* reduce the reference count to the argument list. */
2102f06
-     alist_unlink(win->w_alist);
2102f06
- 
2102f06
      /* Remove the window and its frame from the tree of frames. */
2102f06
      frp = win->w_frame;
2102f06
      wp = winframe_remove(win, dirp, tp);
2102f06
--- 2354,2359 ----
2102f06
***************
2102f06
*** 2386,2394 ****
2102f06
  	tabpage_close(TRUE);
2102f06
  # endif
2102f06
  
2102f06
-     while (firstwin != NULL)
2102f06
- 	(void)win_free_mem(firstwin, &dummy, NULL);
2102f06
- 
2102f06
  # ifdef FEAT_AUTOCMD
2102f06
      if (aucmd_win != NULL)
2102f06
      {
2102f06
--- 2379,2384 ----
2102f06
***************
2102f06
*** 2396,2401 ****
2102f06
--- 2386,2394 ----
2102f06
  	aucmd_win = NULL;
2102f06
      }
2102f06
  # endif
2102f06
+ 
2102f06
+     while (firstwin != NULL)
2102f06
+ 	(void)win_free_mem(firstwin, &dummy, NULL);
2102f06
  }
2102f06
  #endif
2102f06
  
2102f06
***************
2102f06
*** 3204,3230 ****
2102f06
      void
2102f06
  curwin_init()
2102f06
  {
2102f06
!     redraw_win_later(curwin, NOT_VALID);
2102f06
!     curwin->w_lines_valid = 0;
2102f06
!     curwin->w_cursor.lnum = 1;
2102f06
!     curwin->w_curswant = curwin->w_cursor.col = 0;
2102f06
  #ifdef FEAT_VIRTUALEDIT
2102f06
!     curwin->w_cursor.coladd = 0;
2102f06
  #endif
2102f06
!     curwin->w_pcmark.lnum = 1;	/* pcmark not cleared but set to line 1 */
2102f06
!     curwin->w_pcmark.col = 0;
2102f06
!     curwin->w_prev_pcmark.lnum = 0;
2102f06
!     curwin->w_prev_pcmark.col = 0;
2102f06
!     curwin->w_topline = 1;
2102f06
  #ifdef FEAT_DIFF
2102f06
!     curwin->w_topfill = 0;
2102f06
  #endif
2102f06
!     curwin->w_botline = 2;
2102f06
  #ifdef FEAT_FKMAP
2102f06
!     if (curwin->w_p_rl)
2102f06
! 	curwin->w_farsi = W_CONV + W_R_L;
2102f06
      else
2102f06
! 	curwin->w_farsi = W_CONV;
2102f06
  #endif
2102f06
  }
2102f06
  
2102f06
--- 3197,3230 ----
2102f06
      void
2102f06
  curwin_init()
2102f06
  {
2102f06
!     win_init_empty(curwin);
2102f06
! }
2102f06
! 
2102f06
!     void
2102f06
! win_init_empty(wp)
2102f06
!     win_T *wp;
2102f06
! {
2102f06
!     redraw_win_later(wp, NOT_VALID);
2102f06
!     wp->w_lines_valid = 0;
2102f06
!     wp->w_cursor.lnum = 1;
2102f06
!     wp->w_curswant = wp->w_cursor.col = 0;
2102f06
  #ifdef FEAT_VIRTUALEDIT
2102f06
!     wp->w_cursor.coladd = 0;
2102f06
  #endif
2102f06
!     wp->w_pcmark.lnum = 1;	/* pcmark not cleared but set to line 1 */
2102f06
!     wp->w_pcmark.col = 0;
2102f06
!     wp->w_prev_pcmark.lnum = 0;
2102f06
!     wp->w_prev_pcmark.col = 0;
2102f06
!     wp->w_topline = 1;
2102f06
  #ifdef FEAT_DIFF
2102f06
!     wp->w_topfill = 0;
2102f06
  #endif
2102f06
!     wp->w_botline = 2;
2102f06
  #ifdef FEAT_FKMAP
2102f06
!     if (wp->w_p_rl)
2102f06
! 	wp->w_farsi = W_CONV + W_R_L;
2102f06
      else
2102f06
! 	wp->w_farsi = W_CONV;
2102f06
  #endif
2102f06
  }
2102f06
  
2102f06
***************
2102f06
*** 4325,4330 ****
2102f06
--- 4325,4337 ----
2102f06
  {
2102f06
      int		i;
2102f06
  
2102f06
+ #ifdef FEAT_FOLDING
2102f06
+     clearFolding(wp);
2102f06
+ #endif
2102f06
+ 
2102f06
+     /* reduce the reference count to the argument list. */
2102f06
+     alist_unlink(wp->w_alist);
2102f06
+ 
2102f06
  #ifdef FEAT_AUTOCMD
2102f06
      /* Don't execute autocommands while the window is halfway being deleted.
2102f06
       * gui_mch_destroy_scrollbar() may trigger a FocusGained event. */
2102f06
***************
2102f06
*** 4387,4393 ****
2102f06
      }
2102f06
  #endif /* FEAT_GUI */
2102f06
  
2102f06
!     win_remove(wp, tp);
2102f06
      vim_free(wp);
2102f06
  
2102f06
  #ifdef FEAT_AUTOCMD
2102f06
--- 4394,4403 ----
2102f06
      }
2102f06
  #endif /* FEAT_GUI */
2102f06
  
2102f06
! #ifdef FEAT_AUTOCMD
2102f06
!     if (wp != aucmd_win)
2102f06
! #endif
2102f06
! 	win_remove(wp, tp);
2102f06
      vim_free(wp);
2102f06
  
2102f06
  #ifdef FEAT_AUTOCMD
2102f06
*** ../vim-7.2.214/src/version.c	2009-06-24 17:04:40.000000000 +0200
2102f06
--- src/version.c	2009-06-24 17:27:38.000000000 +0200
2102f06
***************
2102f06
*** 678,679 ****
2102f06
--- 678,681 ----
2102f06
  {   /* Add new patch number below this line */
2102f06
+ /**/
2102f06
+     215,
2102f06
  /**/
2102f06
2102f06
-- 
2102f06
Micro$oft: where do you want to go today?
2102f06
    Linux: where do you want to go tomorrow?
2102f06
  FreeBSD: are you guys coming, or what?
2102f06
2102f06
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
2102f06
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
2102f06
\\\        download, build and distribute -- http://www.A-A-P.org        ///
2102f06
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///