]> git.pld-linux.org Git - packages/vim.git/blob - 7.0.149
- new
[packages/vim.git] / 7.0.149
1 To: vim-dev@vim.org
2 Subject: Patch 7.0.149
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.0.149
11 Problem:    When resizing a window that shows "~" lines the text sometimes
12             jumps down.
13 Solution:   Remove code that uses "~" lines in some situations.  Fix the
14             computation of the screen line of the cursor.  Also set w_skipcol
15             to handle very long lines.
16 Files:      src/misc1.c, src/window.c
17
18
19 *** ../vim-7.0.148/src/misc1.c  Tue Oct 17 11:12:28 2006
20 --- src/misc1.c Tue Oct 24 17:33:39 2006
21 ***************
22 *** 1761,1775 ****
23        * Add column offset for 'number', 'foldcolumn', etc.
24        */
25       width = W_WIDTH(wp) - win_col_off(wp);
26 !     if (width > 0)
27 !     {
28 !       lines += 1;
29 !       if (col >= width)
30 !           lines += (col - width) / (width + win_col_off2(wp));
31 !       if (lines <= wp->w_height)
32 !           return lines;
33 !     }
34 !     return (int)(wp->w_height);           /* maximum length */
35   }
36   
37       int
38 --- 1761,1773 ----
39        * Add column offset for 'number', 'foldcolumn', etc.
40        */
41       width = W_WIDTH(wp) - win_col_off(wp);
42 !     if (width <= 0)
43 !       return 9999;
44
45 !     lines += 1;
46 !     if (col > width)
47 !       lines += (col - width) / (width + win_col_off2(wp)) + 1;
48 !     return lines;
49   }
50   
51       int
52 *** ../vim-7.0.148/src/window.c Tue Sep  5 16:29:38 2006
53 --- src/window.c        Tue Oct 24 20:39:56 2006
54 ***************
55 *** 5189,5199 ****
56       int               height;
57   {
58       linenr_T  lnum;
59 -     linenr_T  bot;
60       int               sline, line_size;
61 -     int               space;
62 -     int               did_below = FALSE;
63 -     int               old_height = wp->w_height;
64   #define FRACTION_MULT 16384L
65   
66       /* Don't want a negative height.  Happens when splitting a tiny window.
67 --- 5189,5195 ----
68 ***************
69 *** 5228,5281 ****
70         wp->w_wrow = ((long)wp->w_fraction * (long)height - 1L) / FRACTION_MULT;
71         line_size = plines_win_col(wp, lnum, (long)(wp->w_cursor.col)) - 1;
72         sline = wp->w_wrow - line_size;
73         if (sline < 0)
74         {
75             /*
76              * Cursor line would go off top of screen if w_wrow was this high.
77              */
78             wp->w_wrow = line_size;
79         }
80         else
81         {
82 !           space = height - 1;
83
84 !           while (lnum > 1)
85             {
86 -               /* When using "~" lines stop when at the old topline, don't
87 -                * scroll down. */
88 -               if (did_below && height < old_height && lnum <= wp->w_topline)
89 -                   sline = 0;
90
91 -               space -= line_size;
92 -               if (space > 0 && sline <= 0 && !did_below)
93 -               {
94 -                   /* Try to use "~" lines below the text to avoid that text
95 -                    * is above the window while there are empty lines.
96 -                    * Subtract the rows below the cursor from "space" and
97 -                    * give the rest to "sline". */
98 -                   did_below = TRUE;
99 -                   bot = wp->w_cursor.lnum;
100 -                   while (space > 0)
101 -                   {
102 -                       if (wp->w_buffer->b_ml.ml_line_count - bot >= space)
103 -                           space = 0;
104 -                       else
105 -                       {
106 - #ifdef FEAT_FOLDING
107 -                           hasFoldingWin(wp, bot, NULL, &bot, TRUE, NULL);
108 - #endif
109 -                           if (bot >= wp->w_buffer->b_ml.ml_line_count)
110 -                               break;
111 -                           ++bot;
112 -                           space -= plines_win(wp, bot, TRUE);
113 -                       }
114 -                   }
115 -                   if (bot == wp->w_buffer->b_ml.ml_line_count && space > 0)
116 -                       sline += space;
117 -               }
118 -               if (sline <= 0)
119 -                   break;
120
121   #ifdef FEAT_FOLDING
122                 hasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL);
123                 if (lnum == 1)
124 --- 5224,5267 ----
125         wp->w_wrow = ((long)wp->w_fraction * (long)height - 1L) / FRACTION_MULT;
126         line_size = plines_win_col(wp, lnum, (long)(wp->w_cursor.col)) - 1;
127         sline = wp->w_wrow - line_size;
128
129 +       if (sline >= 0)
130 +       {
131 +           /* Make sure the whole cursor line is visible, if possible. */
132 +           int rows = plines_win(wp, lnum, FALSE);
133
134 +           if (sline > wp->w_height - rows)
135 +           {
136 +               sline = wp->w_height - rows;
137 +               wp->w_wrow -= rows - line_size;
138 +           }
139 +       }
140
141         if (sline < 0)
142         {
143             /*
144              * Cursor line would go off top of screen if w_wrow was this high.
145 +            * Make cursor line the first line in the window.  If not enough
146 +            * room use w_skipcol;
147              */
148             wp->w_wrow = line_size;
149 +           if (wp->w_wrow >= wp->w_height
150 +                                      && (W_WIDTH(wp) - win_col_off(wp)) > 0)
151 +           {
152 +               wp->w_skipcol += W_WIDTH(wp) - win_col_off(wp);
153 +               --wp->w_wrow;
154 +               while (wp->w_wrow >= wp->w_height)
155 +               {
156 +                   wp->w_skipcol += W_WIDTH(wp) - win_col_off(wp)
157 +                                                          + win_col_off2(wp);
158 +                   --wp->w_wrow;
159 +               }
160 +           }
161         }
162         else
163         {
164 !           while (sline > 0 && lnum > 1)
165             {
166   #ifdef FEAT_FOLDING
167                 hasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL);
168                 if (lnum == 1)
169 *** ../vim-7.0.148/src/version.c        Tue Oct 24 13:51:47 2006
170 --- src/version.c       Tue Oct 24 21:13:31 2006
171 ***************
172 *** 668,669 ****
173 --- 668,671 ----
174   {   /* Add new patch number below this line */
175 + /**/
176 +     149,
177   /**/
178
179 -- 
180 hundred-and-one symptoms of being an internet addict:
181 104. When people ask about the Presidential Election you ask "Which country?"
182
183  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
184 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
185 \\\        download, build and distribute -- http://www.A-A-P.org        ///
186  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.137061 seconds and 3 git commands to generate.