summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-04-03 17:11:45 +0200
committerBram Moolenaar <Bram@vim.org>2015-04-03 17:11:45 +0200
commitda6365774d658b66f8d337f6342f4077594dd494 (patch)
tree6bb9f64e9ccff40a4c83e27067fb8e8d9a61a207
parentd87c36ea5eae50580f3c733734669250cc969019 (diff)
downloadvim-git-da6365774d658b66f8d337f6342f4077594dd494.tar.gz
patch 7.4.690 for Problem: Memory access errors when changing indent in Ex mode. Also missingv7.4.690
redraw when using CTRL-U. (Knil Ino) Solution: Update pointers after calling ga_grow().
-rw-r--r--src/ex_getln.c24
-rw-r--r--src/version.c2
2 files changed, 16 insertions, 10 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 31e61d094..cd9dffdea 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -2245,6 +2245,9 @@ getexmodeline(promptc, cookie, indent)
got_int = FALSE;
while (!got_int)
{
+ long sw;
+ char_u *s;
+
if (ga_grow(&line_ga, 40) == FAIL)
break;
@@ -2296,13 +2299,12 @@ getexmodeline(promptc, cookie, indent)
msg_col = startcol;
msg_clr_eos();
line_ga.ga_len = 0;
- continue;
+ goto redraw;
}
if (c1 == Ctrl_T)
{
- long sw = get_sw_value(curbuf);
-
+ sw = get_sw_value(curbuf);
p = (char_u *)line_ga.ga_data;
p[line_ga.ga_len] = NUL;
indent = get_indent_str(p, 8, FALSE);
@@ -2310,9 +2312,9 @@ getexmodeline(promptc, cookie, indent)
add_indent:
while (get_indent_str(p, 8, FALSE) < indent)
{
- char_u *s = skipwhite(p);
-
- ga_grow(&line_ga, 1);
+ ga_grow(&line_ga, 2); /* one more for the NUL */
+ p = (char_u *)line_ga.ga_data;
+ s = skipwhite(p);
mch_memmove(s + 1, s, line_ga.ga_len - (s - p) + 1);
*s = ' ';
++line_ga.ga_len;
@@ -2361,13 +2363,15 @@ redraw:
{
p[line_ga.ga_len] = NUL;
indent = get_indent_str(p, 8, FALSE);
- --indent;
- indent -= indent % get_sw_value(curbuf);
+ if (indent > 0)
+ {
+ --indent;
+ indent -= indent % get_sw_value(curbuf);
+ }
}
while (get_indent_str(p, 8, FALSE) > indent)
{
- char_u *s = skipwhite(p);
-
+ s = skipwhite(p);
mch_memmove(s - 1, s, line_ga.ga_len - (s - p) + 1);
--line_ga.ga_len;
}
diff --git a/src/version.c b/src/version.c
index bc2714b45..a847921c0 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 690,
+/**/
689,
/**/
688,