]> granicus.if.org Git - vim/commitdiff
updated for version 7.2-042 v7.2.042
authorBram Moolenaar <Bram@vim.org>
Sat, 15 Nov 2008 15:06:17 +0000 (15:06 +0000)
committerBram Moolenaar <Bram@vim.org>
Sat, 15 Nov 2008 15:06:17 +0000 (15:06 +0000)
src/buffer.c
src/move.c
src/structs.h
src/version.c

index 4104977d67b8167df0953d97b09ccb335bb67c16..741de4887aed6771fd81c436a0cd4aa2ebeb913a 100644 (file)
@@ -1401,6 +1401,9 @@ enter_buffer(buf)
     curwin->w_cursor.coladd = 0;
 #endif
     curwin->w_set_curswant = TRUE;
+#ifdef FEAT_AUTOCMD
+    curwin->w_topline_was_set = FALSE;
+#endif
 
     /* Make sure the buffer is loaded. */
     if (curbuf->b_ml.ml_mfp == NULL)   /* need to load the file */
@@ -1440,7 +1443,8 @@ enter_buffer(buf)
     maketitle();
 #endif
 #ifdef FEAT_AUTOCMD
-    if (curwin->w_topline == 1)                /* when autocmds didn't change it */
+       /* when autocmds didn't change it */
+    if (curwin->w_topline == 1 && !curwin->w_topline_was_set)
 #endif
        scroll_cursor_halfway(FALSE);   /* redisplay at correct position */
 
index c547d9b0e98daca5095f1c5e426903a4f5455d06..17b16a1e89fd2b651e0e260df1c3596d5eb361c6 100644 (file)
@@ -280,18 +280,20 @@ update_topline()
 
        if (curwin->w_botline <= curbuf->b_ml.ml_line_count)
        {
-           if (curwin->w_cursor.lnum < curwin->w_botline
-                   && ((long)curwin->w_cursor.lnum
+           if (curwin->w_cursor.lnum < curwin->w_botline)
+           {
+             if (((long)curwin->w_cursor.lnum
                                             >= (long)curwin->w_botline - p_so
 #ifdef FEAT_FOLDING
                        || hasAnyFolding(curwin)
 #endif
                        ))
-           {
+             {
                lineoff_T       loff;
 
-               /* Cursor is above botline, check if there are 'scrolloff'
-                * window lines below the cursor.  If not, need to scroll. */
+               /* Cursor is (a few lines) above botline, check if there are
+                * 'scrolloff' window lines below the cursor.  If not, need to
+                * scroll. */
                n = curwin->w_empty_rows;
                loff.lnum = curwin->w_cursor.lnum;
 #ifdef FEAT_FOLDING
@@ -317,6 +319,10 @@ update_topline()
                if (n >= p_so)
                    /* sufficient context, no need to scroll */
                    check_botline = FALSE;
+             }
+             else
+                 /* sufficient context, no need to scroll */
+                 check_botline = FALSE;
            }
            if (check_botline)
            {
@@ -509,6 +515,9 @@ set_topline(wp, lnum)
     /* Approximate the value of w_botline */
     wp->w_botline += lnum - wp->w_topline;
     wp->w_topline = lnum;
+#ifdef FEAT_AUTOCMD
+    wp->w_topline_was_set = TRUE;
+#endif
 #ifdef FEAT_DIFF
     wp->w_topfill = 0;
 #endif
index 1ecdddbc1551c9a84b424a8c240ced73d589ced5..329676e594a0ba6899f4946d8391c3e6cb48490c 100644 (file)
@@ -1784,10 +1784,15 @@ struct window_S
 #endif
 
     /*
-     * The next three specify the offsets for displaying the buffer:
+     * "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for
+     * displaying the buffer.
      */
     linenr_T   w_topline;          /* buffer line number of the line at the
                                       top of the window */
+#ifdef FEAT_AUTOCMD
+    char       w_topline_was_set;  /* flag set to TRUE when topline is set,
+                                      e.g. by winrestview() */
+#endif
 #ifdef FEAT_DIFF
     int                w_topfill;          /* number of filler lines above w_topline */
     int                w_old_topfill;      /* w_topfill at last redraw */
index d3ce62ae590fbbb363d04a7f80cd39bc817c09d7..6c59034366a2fb84f41ae4a8bafccfe390c757cf 100644 (file)
@@ -676,6 +676,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    42,
 /**/
     41,
 /**/