]> git.pld-linux.org Git - packages/vim.git/blob - 7.2.042
- new
[packages/vim.git] / 7.2.042
1 To: vim-dev@vim.org
2 Subject: Patch 7.2.042
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.2.042
11 Problem:    When using winrestview() in a BufWinEnter autocommand the window
12             is scrolled anyway. (Matt Zyzik)
13 Solution:   Don't recompute topline when above 'scrolloff' from the bottom.
14             Don't always put the cursor halfway when entering a buffer.  Add
15             "w_topline_was_set".
16 Files:      src/buffer.c, src/move.c, src/structs.h
17
18
19 *** ../vim-7.2.041/src/buffer.c Sat Nov 15 14:10:23 2008
20 --- src/buffer.c        Sat Nov 15 14:58:52 2008
21 ***************
22 *** 1401,1406 ****
23 --- 1401,1409 ----
24       curwin->w_cursor.coladd = 0;
25   #endif
26       curwin->w_set_curswant = TRUE;
27 + #ifdef FEAT_AUTOCMD
28 +     curwin->w_topline_was_set = FALSE;
29 + #endif
30   
31       /* Make sure the buffer is loaded. */
32       if (curbuf->b_ml.ml_mfp == NULL)  /* need to load the file */
33 ***************
34 *** 1440,1446 ****
35       maketitle();
36   #endif
37   #ifdef FEAT_AUTOCMD
38 !     if (curwin->w_topline == 1)               /* when autocmds didn't change it */
39   #endif
40         scroll_cursor_halfway(FALSE);   /* redisplay at correct position */
41   
42 --- 1443,1450 ----
43       maketitle();
44   #endif
45   #ifdef FEAT_AUTOCMD
46 !       /* when autocmds didn't change it */
47 !     if (curwin->w_topline == 1 && !curwin->w_topline_was_set)
48   #endif
49         scroll_cursor_halfway(FALSE);   /* redisplay at correct position */
50   
51 *** ../vim-7.2.041/src/move.c   Sun Jul 13 19:25:23 2008
52 --- src/move.c  Sat Nov 15 14:56:47 2008
53 ***************
54 *** 280,297 ****
55   
56         if (curwin->w_botline <= curbuf->b_ml.ml_line_count)
57         {
58 !           if (curwin->w_cursor.lnum < curwin->w_botline
59 !                   && ((long)curwin->w_cursor.lnum
60                                              >= (long)curwin->w_botline - p_so
61   #ifdef FEAT_FOLDING
62                         || hasAnyFolding(curwin)
63   #endif
64                         ))
65 !           {
66                 lineoff_T       loff;
67   
68 !               /* Cursor is above botline, check if there are 'scrolloff'
69 !                * window lines below the cursor.  If not, need to scroll. */
70                 n = curwin->w_empty_rows;
71                 loff.lnum = curwin->w_cursor.lnum;
72   #ifdef FEAT_FOLDING
73 --- 280,299 ----
74   
75         if (curwin->w_botline <= curbuf->b_ml.ml_line_count)
76         {
77 !           if (curwin->w_cursor.lnum < curwin->w_botline)
78 !           {
79 !             if (((long)curwin->w_cursor.lnum
80                                              >= (long)curwin->w_botline - p_so
81   #ifdef FEAT_FOLDING
82                         || hasAnyFolding(curwin)
83   #endif
84                         ))
85 !             {
86                 lineoff_T       loff;
87   
88 !               /* Cursor is (a few lines) above botline, check if there are
89 !                * 'scrolloff' window lines below the cursor.  If not, need to
90 !                * scroll. */
91                 n = curwin->w_empty_rows;
92                 loff.lnum = curwin->w_cursor.lnum;
93   #ifdef FEAT_FOLDING
94 ***************
95 *** 317,322 ****
96 --- 319,328 ----
97                 if (n >= p_so)
98                     /* sufficient context, no need to scroll */
99                     check_botline = FALSE;
100 +             }
101 +             else
102 +                 /* sufficient context, no need to scroll */
103 +                 check_botline = FALSE;
104             }
105             if (check_botline)
106             {
107 ***************
108 *** 509,514 ****
109 --- 515,523 ----
110       /* Approximate the value of w_botline */
111       wp->w_botline += lnum - wp->w_topline;
112       wp->w_topline = lnum;
113 + #ifdef FEAT_AUTOCMD
114 +     wp->w_topline_was_set = TRUE;
115 + #endif
116   #ifdef FEAT_DIFF
117       wp->w_topfill = 0;
118   #endif
119 *** ../vim-7.2.041/src/structs.h        Sun Nov  9 13:43:25 2008
120 --- src/structs.h       Sat Nov 15 14:56:42 2008
121 ***************
122 *** 1784,1793 ****
123   #endif
124   
125       /*
126 !      * The next three specify the offsets for displaying the buffer:
127        */
128       linenr_T  w_topline;          /* buffer line number of the line at the
129                                        top of the window */
130   #ifdef FEAT_DIFF
131       int               w_topfill;          /* number of filler lines above w_topline */
132       int               w_old_topfill;      /* w_topfill at last redraw */
133 --- 1784,1798 ----
134   #endif
135   
136       /*
137 !      * "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for
138 !      * displaying the buffer.
139        */
140       linenr_T  w_topline;          /* buffer line number of the line at the
141                                        top of the window */
142 + #ifdef FEAT_AUTOCMD
143 +     char      w_topline_was_set;  /* flag set to TRUE when topline is set,
144 +                                      e.g. by winrestview() */
145 + #endif
146   #ifdef FEAT_DIFF
147       int               w_topfill;          /* number of filler lines above w_topline */
148       int               w_old_topfill;      /* w_topfill at last redraw */
149 *** ../vim-7.2.041/src/version.c        Sat Nov 15 14:10:23 2008
150 --- src/version.c       Sat Nov 15 16:01:29 2008
151 ***************
152 *** 678,679 ****
153 --- 678,681 ----
154   {   /* Add new patch number below this line */
155 + /**/
156 +     42,
157   /**/
158
159 -- 
160 hundred-and-one symptoms of being an internet addict:
161 261. You find diskettes in your pockets when doing laundry.
162
163  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
164 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
165 \\\        download, build and distribute -- http://www.A-A-P.org        ///
166  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.043779 seconds and 3 git commands to generate.