]>
Commit | Line | Data |
---|---|---|
0a7814d6 AG |
1 | To: vim-dev@vim.org |
2 | Subject: patch 7.1.073 | |
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.1.073 (after 7.1.062) | |
11 | Problem: Wrong cursor position and crash when 'preserveindent' is set. | |
12 | (Charles Campbell) | |
13 | Solution: Handle the situation that we start without indent. (Chris | |
14 | Lubinski) | |
15 | Files: src/misc1.c | |
16 | ||
17 | ||
18 | *** ../vim-7.1.072/src/misc1.c Sat Aug 11 14:32:10 2007 | |
19 | --- src/misc1.c Tue Aug 14 21:21:49 2007 | |
20 | *************** | |
21 | *** 104,110 **** | |
22 | int ind_done = 0; /* measured in spaces */ | |
23 | int tab_pad; | |
24 | int retval = FALSE; | |
25 | ! int orig_char_len = 0; /* number of initial whitespace chars when | |
26 | 'et' and 'pi' are both set */ | |
27 | ||
28 | /* | |
29 | --- 104,110 ---- | |
30 | int ind_done = 0; /* measured in spaces */ | |
31 | int tab_pad; | |
32 | int retval = FALSE; | |
33 | ! int orig_char_len = -1; /* number of initial whitespace chars when | |
34 | 'et' and 'pi' are both set */ | |
35 | ||
36 | /* | |
37 | *************** | |
38 | *** 159,165 **** | |
39 | ||
40 | /* Fill to next tabstop with a tab, if possible */ | |
41 | tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts); | |
42 | ! if (todo >= tab_pad && orig_char_len == 0) | |
43 | { | |
44 | doit = TRUE; | |
45 | todo -= tab_pad; | |
46 | --- 159,165 ---- | |
47 | ||
48 | /* Fill to next tabstop with a tab, if possible */ | |
49 | tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts); | |
50 | ! if (todo >= tab_pad && orig_char_len == -1) | |
51 | { | |
52 | doit = TRUE; | |
53 | todo -= tab_pad; | |
54 | *************** | |
55 | *** 206,216 **** | |
56 | /* If 'preserveindent' and 'expandtab' are both set keep the original | |
57 | * characters and allocate accordingly. We will fill the rest with spaces | |
58 | * after the if (!curbuf->b_p_et) below. */ | |
59 | ! if (orig_char_len != 0) | |
60 | { | |
61 | newline = alloc(orig_char_len + size - ind_done + line_len); | |
62 | if (newline == NULL) | |
63 | return FALSE; | |
64 | p = oldline; | |
65 | s = newline; | |
66 | while (orig_char_len > 0) | |
67 | --- 206,220 ---- | |
68 | /* If 'preserveindent' and 'expandtab' are both set keep the original | |
69 | * characters and allocate accordingly. We will fill the rest with spaces | |
70 | * after the if (!curbuf->b_p_et) below. */ | |
71 | ! if (orig_char_len != -1) | |
72 | { | |
73 | newline = alloc(orig_char_len + size - ind_done + line_len); | |
74 | if (newline == NULL) | |
75 | return FALSE; | |
76 | + todo = size - ind_done; | |
77 | + ind_len = orig_char_len + todo; /* Set total length of indent in | |
78 | + * characters, which may have been | |
79 | + * undercounted until now */ | |
80 | p = oldline; | |
81 | s = newline; | |
82 | while (orig_char_len > 0) | |
83 | *************** | |
84 | *** 222,230 **** | |
85 | * than old) */ | |
86 | while (vim_iswhite(*p)) | |
87 | (void)*p++; | |
88 | - todo = size - ind_done; | |
89 | - ind_len += todo; /* Set total length of indent in characters, | |
90 | - * which may have been undercounted until now */ | |
91 | ||
92 | } | |
93 | else | |
94 | --- 226,231 ---- | |
95 | *** ../vim-7.1.072/src/version.c Tue Aug 14 17:54:37 2007 | |
96 | --- src/version.c Tue Aug 14 22:14:54 2007 | |
97 | *************** | |
98 | *** 668,669 **** | |
99 | --- 668,671 ---- | |
100 | { /* Add new patch number below this line */ | |
101 | + /**/ | |
102 | + 73, | |
103 | /**/ | |
104 | ||
105 | -- | |
106 | hundred-and-one symptoms of being an internet addict: | |
107 | 157. You fum through a magazine, you first check to see if it has a web | |
108 | address. | |
109 | ||
110 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
111 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
112 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
113 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |