4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: When resizing a window that shows "~" lines the text sometimes
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
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
23 * Add column offset for 'number', 'foldcolumn', etc.
25 width = W_WIDTH(wp) - win_col_off(wp);
30 ! lines += (col - width) / (width + win_col_off2(wp));
31 ! if (lines <= wp->w_height)
34 ! return (int)(wp->w_height); /* maximum length */
39 * Add column offset for 'number', 'foldcolumn', etc.
41 width = W_WIDTH(wp) - win_col_off(wp);
47 ! lines += (col - width) / (width + win_col_off2(wp)) + 1;
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
62 - int did_below = FALSE;
63 - int old_height = wp->w_height;
64 #define FRACTION_MULT 16384L
66 /* Don't want a negative height. Happens when splitting a tiny window.
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;
76 * Cursor line would go off top of screen if w_wrow was this high.
78 wp->w_wrow = line_size;
86 - /* When using "~" lines stop when at the old topline, don't
88 - if (did_below && height < old_height && lnum <= wp->w_topline)
92 - if (space > 0 && sline <= 0 && !did_below)
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". */
99 - bot = wp->w_cursor.lnum;
102 - if (wp->w_buffer->b_ml.ml_line_count - bot >= space)
106 - #ifdef FEAT_FOLDING
107 - hasFoldingWin(wp, bot, NULL, &bot, TRUE, NULL);
109 - if (bot >= wp->w_buffer->b_ml.ml_line_count)
112 - space -= plines_win(wp, bot, TRUE);
115 - if (bot == wp->w_buffer->b_ml.ml_line_count && space > 0)
122 hasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL);
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;
131 + /* Make sure the whole cursor line is visible, if possible. */
132 + int rows = plines_win(wp, lnum, FALSE);
134 + if (sline > wp->w_height - rows)
136 + sline = wp->w_height - rows;
137 + wp->w_wrow -= rows - line_size;
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;
148 wp->w_wrow = line_size;
149 + if (wp->w_wrow >= wp->w_height
150 + && (W_WIDTH(wp) - win_col_off(wp)) > 0)
152 + wp->w_skipcol += W_WIDTH(wp) - win_col_off(wp);
154 + while (wp->w_wrow >= wp->w_height)
156 + wp->w_skipcol += W_WIDTH(wp) - win_col_off(wp)
157 + + win_col_off2(wp);
164 ! while (sline > 0 && lnum > 1)
167 hasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL);
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
174 { /* Add new patch number below this line */
180 hundred-and-one symptoms of being an internet addict:
181 104. When people ask about the Presidential Election you ask "Which country?"
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 ///