screen: Remove another portion of has_mbyte/friends-checking stuff

This commit is contained in:
ZyX
2017-04-16 21:26:07 +03:00
parent e131194db7
commit c0cbc50720

View File

@@ -5330,25 +5330,21 @@ void screen_puts_len(char_u *text, int textlen, int row, int col, int attr)
c = *ptr; c = *ptr;
/* check if this is the first byte of a multibyte */ /* check if this is the first byte of a multibyte */
if (l_has_mbyte) { if (l_has_mbyte) {
if (l_enc_utf8 && len > 0) if (len > 0) {
mbyte_blen = utfc_ptr2len_len(ptr, (int)((text + len) - ptr)); mbyte_blen = utfc_ptr2len_len(ptr, (int)((text + len) - ptr));
else } else {
mbyte_blen = (*mb_ptr2len)(ptr); mbyte_blen = utfc_ptr2len(ptr);
if (l_enc_dbcs == DBCS_JPNU && c == 0x8e) }
mbyte_cells = 1; if (len >= 0) {
else if (l_enc_dbcs != 0) u8c = utfc_ptr2char_len(ptr, u8cc, (int)((text + len) - ptr));
mbyte_cells = mbyte_blen; } else {
else { /* enc_utf8 */
if (len >= 0)
u8c = utfc_ptr2char_len(ptr, u8cc,
(int)((text + len) - ptr));
else
u8c = utfc_ptr2char(ptr, u8cc); u8c = utfc_ptr2char(ptr, u8cc);
}
mbyte_cells = utf_char2cells(u8c); mbyte_cells = utf_char2cells(u8c);
if (p_arshape && !p_tbidi && arabic_char(u8c)) { if (p_arshape && !p_tbidi && arabic_char(u8c)) {
/* Do Arabic shaping. */ // Do Arabic shaping.
if (len >= 0 && (int)(ptr - text) + mbyte_blen >= len) { if (len >= 0 && (int)(ptr - text) + mbyte_blen >= len) {
/* Past end of string to be displayed. */ // Past end of string to be displayed.
nc = NUL; nc = NUL;
nc1 = NUL; nc1 = NUL;
} else { } else {
@@ -5359,31 +5355,26 @@ void screen_puts_len(char_u *text, int textlen, int row, int col, int attr)
pc = prev_c; pc = prev_c;
prev_c = u8c; prev_c = u8c;
u8c = arabic_shape(u8c, &c, &u8cc[0], nc, nc1, pc); u8c = arabic_shape(u8c, &c, &u8cc[0], nc, nc1, pc);
} else } else {
prev_c = u8c; prev_c = u8c;
}
if (col + mbyte_cells > screen_Columns) { if (col + mbyte_cells > screen_Columns) {
/* Only 1 cell left, but character requires 2 cells: // Only 1 cell left, but character requires 2 cells:
* display a '>' in the last column to avoid wrapping. */ // display a '>' in the last column to avoid wrapping. */
c = '>'; c = '>';
mbyte_cells = 1; mbyte_cells = 1;
} }
} }
}
force_redraw_this = force_redraw_next; force_redraw_this = force_redraw_next;
force_redraw_next = FALSE; force_redraw_next = FALSE;
need_redraw = ScreenLines[off] != c need_redraw = ScreenLines[off] != c
|| (mbyte_cells == 2 || (mbyte_cells == 2 && ScreenLines[off + 1] != 0)
&& ScreenLines[off + 1] != (l_enc_dbcs ? ptr[1] : 0)) || (ScreenLinesUC[off] !=
|| (l_enc_dbcs == DBCS_JPNU
&& c == 0x8e
&& ScreenLines2[off] != ptr[1])
|| (l_enc_utf8
&& (ScreenLinesUC[off] !=
(u8char_T)(c < 0x80 && u8cc[0] == 0 ? 0 : u8c) (u8char_T)(c < 0x80 && u8cc[0] == 0 ? 0 : u8c)
|| (ScreenLinesUC[off] != 0 || (ScreenLinesUC[off] != 0
&& screen_comp_differs(off, u8cc)))) && screen_comp_differs(off, u8cc)))
|| ScreenAttrs[off] != attr || ScreenAttrs[off] != attr
|| exmode_active; || exmode_active;
@@ -6103,8 +6094,7 @@ retry:
if (new_ScreenLinesC[i] == NULL) if (new_ScreenLinesC[i] == NULL)
break; break;
if (new_ScreenLines == NULL if (new_ScreenLines == NULL
|| (l_enc_utf8 && (new_ScreenLinesUC == NULL || i != p_mco)) || (new_ScreenLinesUC == NULL || i != p_mco)
|| (l_enc_dbcs == DBCS_JPNU && new_ScreenLines2 == NULL)
|| new_ScreenAttrs == NULL || new_ScreenAttrs == NULL
|| new_LineOffset == NULL || new_LineOffset == NULL
|| new_LineWraps == NULL || new_LineWraps == NULL
@@ -6189,10 +6179,11 @@ retry:
ScreenLinesC[i] + LineOffset[old_row], ScreenLinesC[i] + LineOffset[old_row],
(size_t)len * sizeof(u8char_T)); (size_t)len * sizeof(u8char_T));
} }
if (l_enc_dbcs == DBCS_JPNU && ScreenLines2 != NULL) if (ScreenLines2 != NULL) {
memmove(new_ScreenLines2 + new_LineOffset[new_row], memmove(new_ScreenLines2 + new_LineOffset[new_row],
ScreenLines2 + LineOffset[old_row], ScreenLines2 + LineOffset[old_row],
(size_t)len * sizeof(schar_T)); (size_t)len * sizeof(schar_T));
}
memmove(new_ScreenAttrs + new_LineOffset[new_row], memmove(new_ScreenAttrs + new_LineOffset[new_row],
ScreenAttrs + LineOffset[old_row], ScreenAttrs + LineOffset[old_row],
(size_t)len * sizeof(sattr_T)); (size_t)len * sizeof(sattr_T));