summaryrefslogtreecommitdiff
path: root/src/screen.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-07-03 12:45:31 +0200
committerBram Moolenaar <Bram@vim.org>2013-07-03 12:45:31 +0200
commit2951b77e5039bd4af215982422fe8c9b214c2de8 (patch)
tree83d65257422e079cfe13134d8cd34eef4e831d76 /src/screen.c
parent41009374747d68a12d043bcca0ae649d0c18daf4 (diff)
downloadvim-2951b77e5039bd4af215982422fe8c9b214c2de8.zip
updated for version 7.3.1288
Problem: The first ":echo 'hello'" command output doesn't show. Mapping for <S-F3> gets triggered during startup. Solution: Add debugging code for the termresponse. When receiving the "Co" entry and when setting 'ambiwidth' redraw right away if possible. Add redraw_asap(). Don't set 'ambiwidth' if it already had the right value. Do the 'ambiwidth' check in the second row to avoid confusion with <S-F3>.
Diffstat (limited to 'src/screen.c')
-rw-r--r--src/screen.c141
1 files changed, 141 insertions, 0 deletions
diff --git a/src/screen.c b/src/screen.c
index 661da039c..9d0d63a5b 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -268,6 +268,147 @@ redraw_buf_later(buf, type)
}
/*
+ * Redraw as soon as possible. When the command line is not scrolled redraw
+ * right away and restore what was on the command line.
+ * Return a code indicating what happened.
+ */
+ int
+redraw_asap(type)
+ int type;
+{
+ int rows;
+ int r;
+ int ret = 0;
+ schar_T *screenline; /* copy from ScreenLines[] */
+ sattr_T *screenattr; /* copy from ScreenAttrs[] */
+#ifdef FEAT_MBYTE
+ int i;
+ u8char_T *screenlineUC; /* copy from ScreenLinesUC[] */
+ u8char_T *screenlineC[MAX_MCO]; /* copy from ScreenLinesC[][] */
+ schar_T *screenline2; /* copy from ScreenLines2[] */
+#endif
+
+ redraw_later(type);
+ if (msg_scrolled || (State != NORMAL && State != NORMAL_BUSY))
+ return ret;
+
+ /* Allocate space to save the text displayed in the command line area. */
+ rows = Rows - cmdline_row;
+ screenline = (schar_T *)lalloc(
+ (long_u)(rows * Columns * sizeof(schar_T)), FALSE);
+ screenattr = (sattr_T *)lalloc(
+ (long_u)(rows * Columns * 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);
+ 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);
+ if (screenlineC[i] == NULL)
+ ret = 2;
+ }
+ }
+ if (enc_dbcs == DBCS_JPNU)
+ {
+ screenline2 = (schar_T *)lalloc(
+ (long_u)(rows * Columns * sizeof(schar_T)), FALSE);
+ if (screenline2 == NULL)
+ ret = 2;
+ }
+#endif
+
+ if (ret != 2)
+ {
+ /* Save the text displayed in the command line area. */
+ for (r = 0; r < rows; ++r)
+ {
+ mch_memmove(screenline + r * Columns,
+ ScreenLines + LineOffset[cmdline_row + r],
+ (size_t)Columns * sizeof(schar_T));
+ mch_memmove(screenattr + r * Columns,
+ ScreenAttrs + LineOffset[cmdline_row + r],
+ (size_t)Columns * sizeof(sattr_T));
+#ifdef FEAT_MBYTE
+ if (enc_utf8)
+ {
+ mch_memmove(screenlineUC + r * Columns,
+ ScreenLinesUC + LineOffset[cmdline_row + r],
+ (size_t)Columns * 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));
+ }
+ if (enc_dbcs == DBCS_JPNU)
+ mch_memmove(screenline2 + r * Columns,
+ ScreenLines2 + LineOffset[cmdline_row + r],
+ (size_t)Columns * sizeof(schar_T));
+#endif
+ }
+
+ update_screen(0);
+ ret = 3;
+
+ if (must_redraw == 0)
+ {
+ int off = (int)(current_ScreenLine - ScreenLines);
+
+ /* Restore the text displayed in the command line area. */
+ for (r = 0; r < rows; ++r)
+ {
+ mch_memmove(current_ScreenLine,
+ screenline + r * Columns,
+ (size_t)Columns * sizeof(schar_T));
+ mch_memmove(ScreenAttrs + off,
+ screenattr + r * Columns,
+ (size_t)Columns * sizeof(sattr_T));
+#ifdef FEAT_MBYTE
+ if (enc_utf8)
+ {
+ mch_memmove(ScreenLinesUC + off,
+ screenlineUC + r * Columns,
+ (size_t)Columns * 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));
+ }
+ if (enc_dbcs == DBCS_JPNU)
+ mch_memmove(ScreenLines2 + off,
+ screenline2 + r * Columns,
+ (size_t)Columns * sizeof(schar_T));
+#endif
+ SCREEN_LINE(cmdline_row + r, 0, Columns, Columns, FALSE);
+ }
+ ret = 4;
+ }
+ setcursor();
+ }
+
+ vim_free(screenline);
+ vim_free(screenattr);
+#ifdef FEAT_MBYTE
+ if (enc_utf8)
+ {
+ vim_free(screenlineUC);
+ for (i = 0; i < p_mco; ++i)
+ vim_free(screenlineC[i]);
+ }
+ if (enc_dbcs == DBCS_JPNU)
+ vim_free(screenline2);
+#endif
+
+ return ret;
+}
+
+/*
* Changed something in the current window, at buffer line "lnum", that
* requires that line and possibly other lines to be redrawn.
* Used when entering/leaving Insert mode with the cursor on a folded line.