]>
Commit | Line | Data |
---|---|---|
8587d00a AM |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.2.366 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.2.366 | |
11 | Problem: CTRL-B doesn't go back to the first line of the buffer. | |
12 | Solution: Avoid an overflow when adding MAXCOL. | |
13 | Files: src/move.c | |
14 | ||
15 | ||
16 | *** ../vim-7.2.365/src/move.c 2010-02-03 17:42:59.000000000 +0100 | |
17 | --- src/move.c 2010-02-17 17:49:34.000000000 +0100 | |
18 | *************** | |
19 | *** 1610,1616 **** | |
20 | * Add one line above "lp->lnum". This can be a filler line, a closed fold or | |
21 | * a (wrapped) text line. Uses and sets "lp->fill". | |
22 | * Returns the height of the added line in "lp->height". | |
23 | ! * Lines above the first one are incredibly high. | |
24 | */ | |
25 | static void | |
26 | topline_back(lp) | |
27 | --- 1610,1616 ---- | |
28 | * Add one line above "lp->lnum". This can be a filler line, a closed fold or | |
29 | * a (wrapped) text line. Uses and sets "lp->fill". | |
30 | * Returns the height of the added line in "lp->height". | |
31 | ! * Lines above the first one are incredibly high: MAXCOL. | |
32 | */ | |
33 | static void | |
34 | topline_back(lp) | |
35 | *************** | |
36 | *** 1942,1948 **** | |
37 | { | |
38 | loff.lnum = curwin->w_topline; | |
39 | topline_back(&loff); | |
40 | ! if (used + loff.height > curwin->w_height) | |
41 | break; | |
42 | used += loff.height; | |
43 | #ifdef FEAT_DIFF | |
44 | --- 1942,1948 ---- | |
45 | { | |
46 | loff.lnum = curwin->w_topline; | |
47 | topline_back(&loff); | |
48 | ! if (loff.height == MAXCOL || used + loff.height > curwin->w_height) | |
49 | break; | |
50 | used += loff.height; | |
51 | #ifdef FEAT_DIFF | |
52 | *************** | |
53 | *** 2021,2027 **** | |
54 | ||
55 | /* Add one line above */ | |
56 | topline_back(&loff); | |
57 | ! used += loff.height; | |
58 | if (used > curwin->w_height) | |
59 | break; | |
60 | if (loff.lnum >= curwin->w_botline | |
61 | --- 2021,2030 ---- | |
62 | ||
63 | /* Add one line above */ | |
64 | topline_back(&loff); | |
65 | ! if (loff.height == MAXCOL) | |
66 | ! used = MAXCOL; | |
67 | ! else | |
68 | ! used += loff.height; | |
69 | if (used > curwin->w_height) | |
70 | break; | |
71 | if (loff.lnum >= curwin->w_botline | |
72 | *************** | |
73 | *** 2175,2181 **** | |
74 | if (below > above) /* add a line above the cursor */ | |
75 | { | |
76 | topline_back(&loff); | |
77 | ! used += loff.height; | |
78 | if (used > curwin->w_height) | |
79 | break; | |
80 | above += loff.height; | |
81 | --- 2178,2187 ---- | |
82 | if (below > above) /* add a line above the cursor */ | |
83 | { | |
84 | topline_back(&loff); | |
85 | ! if (loff.height == MAXCOL) | |
86 | ! used = MAXCOL; | |
87 | ! else | |
88 | ! used += loff.height; | |
89 | if (used > curwin->w_height) | |
90 | break; | |
91 | above += loff.height; | |
92 | *************** | |
93 | *** 2472,2480 **** | |
94 | while (n <= curwin->w_height && loff.lnum >= 1) | |
95 | { | |
96 | topline_back(&loff); | |
97 | ! n += loff.height; | |
98 | } | |
99 | ! if (n <= curwin->w_height) /* at begin of file */ | |
100 | { | |
101 | curwin->w_topline = 1; | |
102 | #ifdef FEAT_DIFF | |
103 | --- 2478,2489 ---- | |
104 | while (n <= curwin->w_height && loff.lnum >= 1) | |
105 | { | |
106 | topline_back(&loff); | |
107 | ! if (loff.height == MAXCOL) | |
108 | ! n = MAXCOL; | |
109 | ! else | |
110 | ! n += loff.height; | |
111 | } | |
112 | ! if (loff.lnum < 1) /* at begin of file */ | |
113 | { | |
114 | curwin->w_topline = 1; | |
115 | #ifdef FEAT_DIFF | |
116 | *** ../vim-7.2.365/src/version.c 2010-02-17 17:34:38.000000000 +0100 | |
117 | --- src/version.c 2010-02-17 18:13:22.000000000 +0100 | |
118 | *************** | |
119 | *** 683,684 **** | |
120 | --- 683,686 ---- | |
121 | { /* Add new patch number below this line */ | |
122 | + /**/ | |
123 | + 366, | |
124 | /**/ | |
125 | ||
126 | -- | |
127 | hundred-and-one symptoms of being an internet addict: | |
128 | 247. You use www.switchboard.com instead of dialing 411 and 555-12-12 | |
129 | for directory assistance. | |
130 | ||
131 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
132 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
133 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
134 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |