diff options
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r-- | src/nvim/screen.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index ac726f7988..450ea5e3f1 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -244,6 +244,9 @@ int redraw_asap(int type) u8char_T *screenlineUC = NULL; /* copy from ScreenLinesUC[] */ u8char_T *screenlineC[MAX_MCO]; /* copy from ScreenLinesC[][] */ schar_T *screenline2 = NULL; /* copy from ScreenLines2[] */ + const bool l_enc_utf8 = enc_utf8; + const int l_enc_dbcs = enc_dbcs; + const long l_p_mco = p_mco; redraw_later(type); if (msg_scrolled || (State != NORMAL && State != NORMAL_BUSY)) @@ -254,14 +257,14 @@ int redraw_asap(int type) screenline = xmalloc((size_t)(rows * Columns * sizeof(schar_T))); screenattr = xmalloc((size_t)(rows * Columns * sizeof(sattr_T))); - if (enc_utf8) { + if (l_enc_utf8) { screenlineUC = xmalloc((size_t)(rows * Columns * sizeof(u8char_T))); - for (i = 0; i < p_mco; ++i) { + for (i = 0; i < l_p_mco; ++i) { screenlineC[i] = xmalloc((size_t)(rows * Columns * sizeof(u8char_T))); } } - if (enc_dbcs == DBCS_JPNU) { + if (l_enc_dbcs == DBCS_JPNU) { screenline2 = xmalloc((size_t)(rows * Columns * sizeof(schar_T))); } @@ -273,16 +276,16 @@ int redraw_asap(int type) memmove(screenattr + r * Columns, ScreenAttrs + LineOffset[cmdline_row + r], (size_t)Columns * sizeof(sattr_T)); - if (enc_utf8) { + if (l_enc_utf8) { memmove(screenlineUC + r * Columns, ScreenLinesUC + LineOffset[cmdline_row + r], (size_t)Columns * sizeof(u8char_T)); - for (i = 0; i < p_mco; ++i) + for (i = 0; i < l_p_mco; ++i) memmove(screenlineC[i] + r * Columns, ScreenLinesC[r] + LineOffset[cmdline_row + r], (size_t)Columns * sizeof(u8char_T)); } - if (enc_dbcs == DBCS_JPNU) + if (l_enc_dbcs == DBCS_JPNU) memmove(screenline2 + r * Columns, ScreenLines2 + LineOffset[cmdline_row + r], (size_t)Columns * sizeof(schar_T)); @@ -302,16 +305,16 @@ int redraw_asap(int type) memmove(ScreenAttrs + off, screenattr + r * Columns, (size_t)Columns * sizeof(sattr_T)); - if (enc_utf8) { + if (l_enc_utf8) { memmove(ScreenLinesUC + off, screenlineUC + r * Columns, (size_t)Columns * sizeof(u8char_T)); - for (i = 0; i < p_mco; ++i) + for (i = 0; i < l_p_mco; ++i) memmove(ScreenLinesC[i] + off, screenlineC[i] + r * Columns, (size_t)Columns * sizeof(u8char_T)); } - if (enc_dbcs == DBCS_JPNU) + if (l_enc_dbcs == DBCS_JPNU) memmove(ScreenLines2 + off, screenline2 + r * Columns, (size_t)Columns * sizeof(schar_T)); @@ -322,12 +325,12 @@ int redraw_asap(int type) free(screenline); free(screenattr); - if (enc_utf8) { + if (l_enc_utf8) { free(screenlineUC); - for (i = 0; i < p_mco; ++i) + for (i = 0; i < l_p_mco; ++i) free(screenlineC[i]); } - if (enc_dbcs == DBCS_JPNU) + if (l_enc_dbcs == DBCS_JPNU) free(screenline2); /* Show the intro message when appropriate. */ |