forked from aniani/vim
patch 7.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.
This commit is contained in:
59
src/screen.c
59
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;
|
||||
}
|
||||
|
@@ -741,6 +741,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
797,
|
||||
/**/
|
||||
796,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user