|
Karsten Hopp |
30e7ff |
To: vim-dev@vim.org
|
|
Karsten Hopp |
30e7ff |
Subject: Patch 7.2.042
|
|
Karsten Hopp |
30e7ff |
Fcc: outbox
|
|
Karsten Hopp |
30e7ff |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
30e7ff |
Mime-Version: 1.0
|
|
Karsten Hopp |
30e7ff |
Content-Type: text/plain; charset=ISO-8859-1
|
|
Karsten Hopp |
30e7ff |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
30e7ff |
------------
|
|
Karsten Hopp |
30e7ff |
|
|
Karsten Hopp |
30e7ff |
Patch 7.2.042
|
|
Karsten Hopp |
30e7ff |
Problem: When using winrestview() in a BufWinEnter autocommand the window
|
|
Karsten Hopp |
30e7ff |
is scrolled anyway. (Matt Zyzik)
|
|
Karsten Hopp |
30e7ff |
Solution: Don't recompute topline when above 'scrolloff' from the bottom.
|
|
Karsten Hopp |
30e7ff |
Don't always put the cursor halfway when entering a buffer. Add
|
|
Karsten Hopp |
30e7ff |
"w_topline_was_set".
|
|
Karsten Hopp |
30e7ff |
Files: src/buffer.c, src/move.c, src/structs.h
|
|
Karsten Hopp |
30e7ff |
|
|
Karsten Hopp |
30e7ff |
|
|
Karsten Hopp |
30e7ff |
*** ../vim-7.2.041/src/buffer.c Sat Nov 15 14:10:23 2008
|
|
Karsten Hopp |
30e7ff |
--- src/buffer.c Sat Nov 15 14:58:52 2008
|
|
Karsten Hopp |
30e7ff |
***************
|
|
Karsten Hopp |
30e7ff |
*** 1401,1406 ****
|
|
Karsten Hopp |
30e7ff |
--- 1401,1409 ----
|
|
Karsten Hopp |
30e7ff |
curwin->w_cursor.coladd = 0;
|
|
Karsten Hopp |
30e7ff |
#endif
|
|
Karsten Hopp |
30e7ff |
curwin->w_set_curswant = TRUE;
|
|
Karsten Hopp |
30e7ff |
+ #ifdef FEAT_AUTOCMD
|
|
Karsten Hopp |
30e7ff |
+ curwin->w_topline_was_set = FALSE;
|
|
Karsten Hopp |
30e7ff |
+ #endif
|
|
Karsten Hopp |
30e7ff |
|
|
Karsten Hopp |
30e7ff |
/* Make sure the buffer is loaded. */
|
|
Karsten Hopp |
30e7ff |
if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */
|
|
Karsten Hopp |
30e7ff |
***************
|
|
Karsten Hopp |
30e7ff |
*** 1440,1446 ****
|
|
Karsten Hopp |
30e7ff |
maketitle();
|
|
Karsten Hopp |
30e7ff |
#endif
|
|
Karsten Hopp |
30e7ff |
#ifdef FEAT_AUTOCMD
|
|
Karsten Hopp |
30e7ff |
! if (curwin->w_topline == 1) /* when autocmds didn't change it */
|
|
Karsten Hopp |
30e7ff |
#endif
|
|
Karsten Hopp |
30e7ff |
scroll_cursor_halfway(FALSE); /* redisplay at correct position */
|
|
Karsten Hopp |
30e7ff |
|
|
Karsten Hopp |
30e7ff |
--- 1443,1450 ----
|
|
Karsten Hopp |
30e7ff |
maketitle();
|
|
Karsten Hopp |
30e7ff |
#endif
|
|
Karsten Hopp |
30e7ff |
#ifdef FEAT_AUTOCMD
|
|
Karsten Hopp |
30e7ff |
! /* when autocmds didn't change it */
|
|
Karsten Hopp |
30e7ff |
! if (curwin->w_topline == 1 && !curwin->w_topline_was_set)
|
|
Karsten Hopp |
30e7ff |
#endif
|
|
Karsten Hopp |
30e7ff |
scroll_cursor_halfway(FALSE); /* redisplay at correct position */
|
|
Karsten Hopp |
30e7ff |
|
|
Karsten Hopp |
30e7ff |
*** ../vim-7.2.041/src/move.c Sun Jul 13 19:25:23 2008
|
|
Karsten Hopp |
30e7ff |
--- src/move.c Sat Nov 15 14:56:47 2008
|
|
Karsten Hopp |
30e7ff |
***************
|
|
Karsten Hopp |
30e7ff |
*** 280,297 ****
|
|
Karsten Hopp |
30e7ff |
|
|
Karsten Hopp |
30e7ff |
if (curwin->w_botline <= curbuf->b_ml.ml_line_count)
|
|
Karsten Hopp |
30e7ff |
{
|
|
Karsten Hopp |
30e7ff |
! if (curwin->w_cursor.lnum < curwin->w_botline
|
|
Karsten Hopp |
30e7ff |
! && ((long)curwin->w_cursor.lnum
|
|
Karsten Hopp |
30e7ff |
>= (long)curwin->w_botline - p_so
|
|
Karsten Hopp |
30e7ff |
#ifdef FEAT_FOLDING
|
|
Karsten Hopp |
30e7ff |
|| hasAnyFolding(curwin)
|
|
Karsten Hopp |
30e7ff |
#endif
|
|
Karsten Hopp |
30e7ff |
))
|
|
Karsten Hopp |
30e7ff |
! {
|
|
Karsten Hopp |
30e7ff |
lineoff_T loff;
|
|
Karsten Hopp |
30e7ff |
|
|
Karsten Hopp |
30e7ff |
! /* Cursor is above botline, check if there are 'scrolloff'
|
|
Karsten Hopp |
30e7ff |
! * window lines below the cursor. If not, need to scroll. */
|
|
Karsten Hopp |
30e7ff |
n = curwin->w_empty_rows;
|
|
Karsten Hopp |
30e7ff |
loff.lnum = curwin->w_cursor.lnum;
|
|
Karsten Hopp |
30e7ff |
#ifdef FEAT_FOLDING
|
|
Karsten Hopp |
30e7ff |
--- 280,299 ----
|
|
Karsten Hopp |
30e7ff |
|
|
Karsten Hopp |
30e7ff |
if (curwin->w_botline <= curbuf->b_ml.ml_line_count)
|
|
Karsten Hopp |
30e7ff |
{
|
|
Karsten Hopp |
30e7ff |
! if (curwin->w_cursor.lnum < curwin->w_botline)
|
|
Karsten Hopp |
30e7ff |
! {
|
|
Karsten Hopp |
30e7ff |
! if (((long)curwin->w_cursor.lnum
|
|
Karsten Hopp |
30e7ff |
>= (long)curwin->w_botline - p_so
|
|
Karsten Hopp |
30e7ff |
#ifdef FEAT_FOLDING
|
|
Karsten Hopp |
30e7ff |
|| hasAnyFolding(curwin)
|
|
Karsten Hopp |
30e7ff |
#endif
|
|
Karsten Hopp |
30e7ff |
))
|
|
Karsten Hopp |
30e7ff |
! {
|
|
Karsten Hopp |
30e7ff |
lineoff_T loff;
|
|
Karsten Hopp |
30e7ff |
|
|
Karsten Hopp |
30e7ff |
! /* Cursor is (a few lines) above botline, check if there are
|
|
Karsten Hopp |
30e7ff |
! * 'scrolloff' window lines below the cursor. If not, need to
|
|
Karsten Hopp |
30e7ff |
! * scroll. */
|
|
Karsten Hopp |
30e7ff |
n = curwin->w_empty_rows;
|
|
Karsten Hopp |
30e7ff |
loff.lnum = curwin->w_cursor.lnum;
|
|
Karsten Hopp |
30e7ff |
#ifdef FEAT_FOLDING
|
|
Karsten Hopp |
30e7ff |
***************
|
|
Karsten Hopp |
30e7ff |
*** 317,322 ****
|
|
Karsten Hopp |
30e7ff |
--- 319,328 ----
|
|
Karsten Hopp |
30e7ff |
if (n >= p_so)
|
|
Karsten Hopp |
30e7ff |
/* sufficient context, no need to scroll */
|
|
Karsten Hopp |
30e7ff |
check_botline = FALSE;
|
|
Karsten Hopp |
30e7ff |
+ }
|
|
Karsten Hopp |
30e7ff |
+ else
|
|
Karsten Hopp |
30e7ff |
+ /* sufficient context, no need to scroll */
|
|
Karsten Hopp |
30e7ff |
+ check_botline = FALSE;
|
|
Karsten Hopp |
30e7ff |
}
|
|
Karsten Hopp |
30e7ff |
if (check_botline)
|
|
Karsten Hopp |
30e7ff |
{
|
|
Karsten Hopp |
30e7ff |
***************
|
|
Karsten Hopp |
30e7ff |
*** 509,514 ****
|
|
Karsten Hopp |
30e7ff |
--- 515,523 ----
|
|
Karsten Hopp |
30e7ff |
/* Approximate the value of w_botline */
|
|
Karsten Hopp |
30e7ff |
wp->w_botline += lnum - wp->w_topline;
|
|
Karsten Hopp |
30e7ff |
wp->w_topline = lnum;
|
|
Karsten Hopp |
30e7ff |
+ #ifdef FEAT_AUTOCMD
|
|
Karsten Hopp |
30e7ff |
+ wp->w_topline_was_set = TRUE;
|
|
Karsten Hopp |
30e7ff |
+ #endif
|
|
Karsten Hopp |
30e7ff |
#ifdef FEAT_DIFF
|
|
Karsten Hopp |
30e7ff |
wp->w_topfill = 0;
|
|
Karsten Hopp |
30e7ff |
#endif
|
|
Karsten Hopp |
30e7ff |
*** ../vim-7.2.041/src/structs.h Sun Nov 9 13:43:25 2008
|
|
Karsten Hopp |
30e7ff |
--- src/structs.h Sat Nov 15 14:56:42 2008
|
|
Karsten Hopp |
30e7ff |
***************
|
|
Karsten Hopp |
30e7ff |
*** 1784,1793 ****
|
|
Karsten Hopp |
30e7ff |
#endif
|
|
Karsten Hopp |
30e7ff |
|
|
Karsten Hopp |
30e7ff |
/*
|
|
Karsten Hopp |
30e7ff |
! * The next three specify the offsets for displaying the buffer:
|
|
Karsten Hopp |
30e7ff |
*/
|
|
Karsten Hopp |
30e7ff |
linenr_T w_topline; /* buffer line number of the line at the
|
|
Karsten Hopp |
30e7ff |
top of the window */
|
|
Karsten Hopp |
30e7ff |
#ifdef FEAT_DIFF
|
|
Karsten Hopp |
30e7ff |
int w_topfill; /* number of filler lines above w_topline */
|
|
Karsten Hopp |
30e7ff |
int w_old_topfill; /* w_topfill at last redraw */
|
|
Karsten Hopp |
30e7ff |
--- 1784,1798 ----
|
|
Karsten Hopp |
30e7ff |
#endif
|
|
Karsten Hopp |
30e7ff |
|
|
Karsten Hopp |
30e7ff |
/*
|
|
Karsten Hopp |
30e7ff |
! * "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for
|
|
Karsten Hopp |
30e7ff |
! * displaying the buffer.
|
|
Karsten Hopp |
30e7ff |
*/
|
|
Karsten Hopp |
30e7ff |
linenr_T w_topline; /* buffer line number of the line at the
|
|
Karsten Hopp |
30e7ff |
top of the window */
|
|
Karsten Hopp |
30e7ff |
+ #ifdef FEAT_AUTOCMD
|
|
Karsten Hopp |
30e7ff |
+ char w_topline_was_set; /* flag set to TRUE when topline is set,
|
|
Karsten Hopp |
30e7ff |
+ e.g. by winrestview() */
|
|
Karsten Hopp |
30e7ff |
+ #endif
|
|
Karsten Hopp |
30e7ff |
#ifdef FEAT_DIFF
|
|
Karsten Hopp |
30e7ff |
int w_topfill; /* number of filler lines above w_topline */
|
|
Karsten Hopp |
30e7ff |
int w_old_topfill; /* w_topfill at last redraw */
|
|
Karsten Hopp |
30e7ff |
*** ../vim-7.2.041/src/version.c Sat Nov 15 14:10:23 2008
|
|
Karsten Hopp |
30e7ff |
--- src/version.c Sat Nov 15 16:01:29 2008
|
|
Karsten Hopp |
30e7ff |
***************
|
|
Karsten Hopp |
30e7ff |
*** 678,679 ****
|
|
Karsten Hopp |
30e7ff |
--- 678,681 ----
|
|
Karsten Hopp |
30e7ff |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
30e7ff |
+ /**/
|
|
Karsten Hopp |
30e7ff |
+ 42,
|
|
Karsten Hopp |
30e7ff |
/**/
|
|
Karsten Hopp |
30e7ff |
|
|
Karsten Hopp |
30e7ff |
--
|
|
Karsten Hopp |
30e7ff |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
30e7ff |
261. You find diskettes in your pockets when doing laundry.
|
|
Karsten Hopp |
30e7ff |
|
|
Karsten Hopp |
30e7ff |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
30e7ff |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
30e7ff |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
30e7ff |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|