4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
10 Patch 7.1.073 (after 7.1.062)
11 Problem: Wrong cursor position and crash when 'preserveindent' is set.
13 Solution: Handle the situation that we start without indent. (Chris
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
22 int ind_done = 0; /* measured in spaces */
25 ! int orig_char_len = 0; /* number of initial whitespace chars when
26 'et' and 'pi' are both set */
30 int ind_done = 0; /* measured in spaces */
33 ! int orig_char_len = -1; /* number of initial whitespace chars when
34 'et' and 'pi' are both set */
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)
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)
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)
61 newline = alloc(orig_char_len + size - ind_done + line_len);
66 while (orig_char_len > 0)
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)
73 newline = alloc(orig_char_len + size - ind_done + line_len);
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 */
82 while (orig_char_len > 0)
86 while (vim_iswhite(*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 */
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
100 { /* Add new patch number below this line */
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
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 ///