summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <bram@vim.org>2015-07-25 22:53:00 +0200
committerBram Moolenaar <bram@vim.org>2015-07-25 22:53:00 +0200
commitc2e06148c5e6b0b3e8c3c313103f9874c2948a2a (patch)
tree1d9424e3c8265d6e4e3d9096f22e51601e68cbc9 /src
parentcba5d9b9aa395845f8fea29b0836c1dddba61161 (diff)
downloadvim-c2e06148c5e6b0b3e8c3c313103f9874c2948a2a.tar.gz
patch 7.4.797v7.4.797v7-4-797
Problem: Crash when using more lines for the command line than 'maxcombine'. Solution: Use the correct array index. Also, do not try redrawing when exiting. And use screen_Columns instead of Columns.
Diffstat (limited to 'src')
-rw-r--r--src/screen.c59
-rw-r--r--src/version.c2
2 files changed, 32 insertions, 29 deletions
diff --git a/src/screen.c b/src/screen.c
index e1547624..ba964b49 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -279,6 +279,7 @@ redraw_asap(type)
int type;
{
int rows;
+ int cols = screen_Columns;
int r;
int ret = 0;
schar_T *screenline; /* copy from ScreenLines[] */
@@ -291,28 +292,28 @@ redraw_asap(type)
#endif
redraw_later(type);
- if (msg_scrolled || (State != NORMAL && State != NORMAL_BUSY))
+ if (msg_scrolled || (State != NORMAL && State != NORMAL_BUSY) || exiting)
return ret;
/* Allocate space to save the text displayed in the command line area. */
- rows = Rows - cmdline_row;
+ rows = screen_Rows - cmdline_row;
screenline = (schar_T *)lalloc(
- (long_u)(rows * Columns * sizeof(schar_T)), FALSE);
+ (long_u)(rows * cols * sizeof(schar_T)), FALSE);
screenattr = (sattr_T *)lalloc(
- (long_u)(rows * Columns * sizeof(sattr_T)), FALSE);
+ (long_u)(rows * cols * sizeof(sattr_T)), FALSE);
if (screenline == NULL || screenattr == NULL)
ret = 2;
#ifdef FEAT_MBYTE
if (enc_utf8)
{
screenlineUC = (u8char_T *)lalloc(
- (long_u)(rows * Columns * sizeof(u8char_T)), FALSE);
+ (long_u)(rows * cols * sizeof(u8char_T)), FALSE);
if (screenlineUC == NULL)
ret = 2;
for (i = 0; i < p_mco; ++i)
{
screenlineC[i] = (u8char_T *)lalloc(
- (long_u)(rows * Columns * sizeof(u8char_T)), FALSE);
+ (long_u)(rows * cols * sizeof(u8char_T)), FALSE);
if (screenlineC[i] == NULL)
ret = 2;
}
@@ -320,7 +321,7 @@ redraw_asap(type)
if (enc_dbcs == DBCS_JPNU)
{
screenline2 = (schar_T *)lalloc(
- (long_u)(rows * Columns * sizeof(schar_T)), FALSE);
+ (long_u)(rows * cols * sizeof(schar_T)), FALSE);
if (screenline2 == NULL)
ret = 2;
}
@@ -331,27 +332,27 @@ redraw_asap(type)
/* Save the text displayed in the command line area. */
for (r = 0; r < rows; ++r)
{
- mch_memmove(screenline + r * Columns,
+ mch_memmove(screenline + r * cols,
ScreenLines + LineOffset[cmdline_row + r],
- (size_t)Columns * sizeof(schar_T));
- mch_memmove(screenattr + r * Columns,
+ (size_t)cols * sizeof(schar_T));
+ mch_memmove(screenattr + r * cols,
ScreenAttrs + LineOffset[cmdline_row + r],
- (size_t)Columns * sizeof(sattr_T));
+ (size_t)cols * sizeof(sattr_T));
#ifdef FEAT_MBYTE
if (enc_utf8)
{
- mch_memmove(screenlineUC + r * Columns,
+ mch_memmove(screenlineUC + r * cols,
ScreenLinesUC + LineOffset[cmdline_row + r],
- (size_t)Columns * sizeof(u8char_T));
+ (size_t)cols * sizeof(u8char_T));
for (i = 0; i < p_mco; ++i)
- mch_memmove(screenlineC[i] + r * Columns,
- ScreenLinesC[r] + LineOffset[cmdline_row + r],
- (size_t)Columns * sizeof(u8char_T));
+ mch_memmove(screenlineC[i] + r * cols,
+ ScreenLinesC[i] + LineOffset[cmdline_row + r],
+ (size_t)cols * sizeof(u8char_T));
}
if (enc_dbcs == DBCS_JPNU)
- mch_memmove(screenline2 + r * Columns,
+ mch_memmove(screenline2 + r * cols,
ScreenLines2 + LineOffset[cmdline_row + r],
- (size_t)Columns * sizeof(schar_T));
+ (size_t)cols * sizeof(schar_T));
#endif
}
@@ -366,28 +367,28 @@ redraw_asap(type)
for (r = 0; r < rows; ++r)
{
mch_memmove(current_ScreenLine,
- screenline + r * Columns,
- (size_t)Columns * sizeof(schar_T));
+ screenline + r * cols,
+ (size_t)cols * sizeof(schar_T));
mch_memmove(ScreenAttrs + off,
- screenattr + r * Columns,
- (size_t)Columns * sizeof(sattr_T));
+ screenattr + r * cols,
+ (size_t)cols * sizeof(sattr_T));
#ifdef FEAT_MBYTE
if (enc_utf8)
{
mch_memmove(ScreenLinesUC + off,
- screenlineUC + r * Columns,
- (size_t)Columns * sizeof(u8char_T));
+ screenlineUC + r * cols,
+ (size_t)cols * sizeof(u8char_T));
for (i = 0; i < p_mco; ++i)
mch_memmove(ScreenLinesC[i] + off,
- screenlineC[i] + r * Columns,
- (size_t)Columns * sizeof(u8char_T));
+ screenlineC[i] + r * cols,
+ (size_t)cols * sizeof(u8char_T));
}
if (enc_dbcs == DBCS_JPNU)
mch_memmove(ScreenLines2 + off,
- screenline2 + r * Columns,
- (size_t)Columns * sizeof(schar_T));
+ screenline2 + r * cols,
+ (size_t)cols * sizeof(schar_T));
#endif
- SCREEN_LINE(cmdline_row + r, 0, Columns, Columns, FALSE);
+ SCREEN_LINE(cmdline_row + r, 0, cols, cols, FALSE);
}
ret = 4;
}
diff --git a/src/version.c b/src/version.c
index 0bab900a..f6f30b05 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 */
/**/
+ 797,
+/**/
796,
/**/
795,