summaryrefslogtreecommitdiff
path: root/src/screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/screen.c')
-rw-r--r--src/screen.c371
1 files changed, 56 insertions, 315 deletions
diff --git a/src/screen.c b/src/screen.c
index 62f9bd103..95a739af0 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -144,9 +144,7 @@ static void next_search_hl(win_T *win, match_T *shl, linenr_T lnum, colnr_T minc
static int next_search_hl_pos(match_T *shl, linenr_T lnum, posmatch_T *pos, colnr_T mincol);
#endif
static void screen_char(unsigned off, int row, int col);
-#ifdef FEAT_MBYTE
static void screen_char_2(unsigned off, int row, int col);
-#endif
static void screenclear2(void);
static void lineclear(unsigned off, int width, int attr);
static void lineinvalid(unsigned off, int width);
@@ -314,12 +312,10 @@ redraw_asap(int type)
int ret = 0;
schar_T *screenline; /* copy from ScreenLines[] */
sattr_T *screenattr; /* copy from ScreenAttrs[] */
-#ifdef FEAT_MBYTE
int i;
u8char_T *screenlineUC = NULL; /* copy from ScreenLinesUC[] */
u8char_T *screenlineC[MAX_MCO]; /* copy from ScreenLinesC[][] */
schar_T *screenline2 = NULL; /* copy from ScreenLines2[] */
-#endif
redraw_later(type);
if (msg_scrolled || (State != NORMAL && State != NORMAL_BUSY) || exiting)
@@ -333,7 +329,6 @@ redraw_asap(int type)
(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(
@@ -355,7 +350,6 @@ redraw_asap(int type)
if (screenline2 == NULL)
ret = 2;
}
-#endif
if (ret != 2)
{
@@ -368,7 +362,6 @@ redraw_asap(int type)
mch_memmove(screenattr + r * cols,
ScreenAttrs + LineOffset[cmdline_row + r],
(size_t)cols * sizeof(sattr_T));
-#ifdef FEAT_MBYTE
if (enc_utf8)
{
mch_memmove(screenlineUC + r * cols,
@@ -383,7 +376,6 @@ redraw_asap(int type)
mch_memmove(screenline2 + r * cols,
ScreenLines2 + LineOffset[cmdline_row + r],
(size_t)cols * sizeof(schar_T));
-#endif
}
update_screen(0);
@@ -402,7 +394,6 @@ redraw_asap(int type)
mch_memmove(ScreenAttrs + off,
screenattr + r * cols,
(size_t)cols * sizeof(sattr_T));
-#ifdef FEAT_MBYTE
if (enc_utf8)
{
mch_memmove(ScreenLinesUC + off,
@@ -417,7 +408,6 @@ redraw_asap(int type)
mch_memmove(ScreenLines2 + off,
screenline2 + r * cols,
(size_t)cols * sizeof(schar_T));
-#endif
screen_line(cmdline_row + r, 0, cols, cols, FALSE);
}
ret = 4;
@@ -426,7 +416,6 @@ redraw_asap(int type)
vim_free(screenline);
vim_free(screenattr);
-#ifdef FEAT_MBYTE
if (enc_utf8)
{
vim_free(screenlineUC);
@@ -435,7 +424,6 @@ redraw_asap(int type)
}
if (enc_dbcs == DBCS_JPNU)
vim_free(screenline2);
-#endif
/* Show the intro message when appropriate. */
maybe_intro_message();
@@ -830,9 +818,7 @@ update_screen(int type_arg)
* uses that. */
gui.col = gui_cursor_col;
gui.row = gui_cursor_row;
-# ifdef FEAT_MBYTE
gui.col = mb_fix_col(gui.col, gui.row);
-# endif
gui_update_cursor(FALSE, FALSE);
gui_may_flush();
screen_cur_col = gui.col;
@@ -2154,7 +2140,6 @@ win_update(win_T *wp)
int i;
for (i = 0; i < Rows; ++i)
-# ifdef FEAT_MBYTE
if (enc_utf8)
if ((*mb_off2cells)(LineOffset[i] + Columns - 2,
LineOffset[i] + screen_Columns) > 1)
@@ -2162,7 +2147,6 @@ win_update(win_T *wp)
else
screen_draw_rectangle(i, Columns - 1, 1, 1, FALSE);
else
-# endif
screen_char(LineOffset[i] + Columns - 1, i, Columns - 1);
}
#endif
@@ -2454,7 +2438,6 @@ text_to_screenline(win_T *wp, char_u *text, int col)
{
int off = (int)(current_ScreenLine - ScreenLines);
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
int cells;
@@ -2560,7 +2543,6 @@ text_to_screenline(win_T *wp, char_u *text, int col)
}
}
else
-#endif
{
int len = (int)STRLEN(text);
@@ -2639,10 +2621,8 @@ fold_line(
{
ScreenLines[off] = cmdwin_type;
ScreenAttrs[off] = HL_ATTR(HLF_AT);
-#ifdef FEAT_MBYTE
if (enc_utf8)
ScreenLinesUC[off] = 0;
-#endif
++col;
}
#endif
@@ -2785,7 +2765,6 @@ fold_line(
#endif
)
{
-#ifdef FEAT_MBYTE
if (enc_utf8)
{
if (fill_fold >= 0x80)
@@ -2802,7 +2781,6 @@ fold_line(
col++;
}
else
-#endif
ScreenLines[off + col++] = fill_fold;
}
@@ -2929,10 +2907,8 @@ copy_text_attr(
int i;
mch_memmove(ScreenLines + off, buf, (size_t)len);
-# ifdef FEAT_MBYTE
if (enc_utf8)
vim_memset(ScreenLinesUC + off, 0, sizeof(u8char_T) * (size_t)len);
-# endif
for (i = 0; i < len; ++i)
ScreenAttrs[off + i] = attr;
}
@@ -3126,13 +3102,11 @@ win_line(
int cur_checked_col = 0; /* checked column for current line */
#endif
int extra_check = 0; // has extra highlighting
-#ifdef FEAT_MBYTE
int multi_attr = 0; /* attributes desired by multibyte */
int mb_l = 1; /* multi-byte byte length */
int mb_c = 0; /* decoded multi-byte character */
int mb_utf8 = FALSE; /* screen char is UTF-8 char */
int u8cc[MAX_MCO]; /* composing UTF-8 chars */
-#endif
#ifdef FEAT_DIFF
int filler_lines; /* nr of filler lines to be drawn */
int filler_todo; /* nr of filler lines still to do + 1 */
@@ -3555,16 +3529,13 @@ win_line(
v = wp->w_leftcol;
if (v > 0 && !number_only)
{
-#ifdef FEAT_MBYTE
char_u *prev_ptr = ptr;
-#endif
+
while (vcol < v && *ptr != NUL)
{
c = win_lbr_chartabsize(wp, line, ptr, (colnr_T)vcol, NULL);
vcol += c;
-#ifdef FEAT_MBYTE
prev_ptr = ptr;
-#endif
MB_PTR_ADV(ptr);
}
@@ -3592,18 +3563,10 @@ win_line(
if (vcol > v)
{
vcol -= c;
-#ifdef FEAT_MBYTE
ptr = prev_ptr;
-#else
- --ptr;
-#endif
/* If the character fits on the screen, don't need to skip it.
* Except for a TAB. */
- if ((
-#ifdef FEAT_MBYTE
- (*mb_ptr2cells)(ptr) >= c ||
-#endif
- *ptr == TAB) && col == 0)
+ if (( (*mb_ptr2cells)(ptr) >= c || *ptr == TAB) && col == 0)
n_skip = v - vcol;
}
@@ -3734,11 +3697,9 @@ win_line(
/* Highlight one character for an empty match. */
if (shl->startcol == shl->endcol)
{
-#ifdef FEAT_MBYTE
if (has_mbyte && line[shl->endcol] != NUL)
shl->endcol += (*mb_ptr2len)(line + shl->endcol);
else
-#endif
++shl->endcol;
}
if ((long)shl->startcol < v) /* match at leftcol */
@@ -4133,10 +4094,8 @@ win_line(
{
/* handle Visual or match highlighting in this line */
if (vcol == fromcol
-#ifdef FEAT_MBYTE
|| (has_mbyte && vcol + 1 == fromcol && n_extra == 0
&& (*mb_ptr2cells)(ptr) > 1)
-#endif
|| ((int)vcol_prev == fromcol_prev
&& vcol_prev < vcol /* not at margin */
&& vcol < tocol))
@@ -4182,12 +4141,10 @@ win_line(
&& v >= (long)shl->startcol
&& v < (long)shl->endcol)
{
-#ifdef FEAT_MBYTE
int tmp_col = v + MB_PTR2LEN(ptr);
if (shl->endcol < tmp_col)
shl->endcol = tmp_col;
-#endif
shl->attr_cur = shl->attr;
#ifdef FEAT_CONCEAL
if (cur != NULL && syn_name2id((char_u *)"Conceal")
@@ -4226,12 +4183,10 @@ win_line(
{
/* highlight empty match, try again after
* it */
-#ifdef FEAT_MBYTE
if (has_mbyte)
shl->endcol += (*mb_ptr2len)(line
+ shl->endcol);
else
-#endif
++shl->endcol;
}
@@ -4402,7 +4357,6 @@ win_line(
if (c_extra != NUL || (n_extra == 1 && c_final != NUL))
{
c = (n_extra == 1 && c_final != NUL) ? c_final : c_extra;
-#ifdef FEAT_MBYTE
mb_c = c; /* doesn't handle non-utf-8 multi-byte! */
if (enc_utf8 && utf_char2len(c) > 1)
{
@@ -4412,12 +4366,10 @@ win_line(
}
else
mb_utf8 = FALSE;
-#endif
}
else
{
c = *p_extra;
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
mb_c = c;
@@ -4473,7 +4425,6 @@ win_line(
p_extra += mb_l - 1;
}
}
-#endif
++p_extra;
}
--n_extra;
@@ -4493,7 +4444,6 @@ win_line(
#ifdef FEAT_LINEBREAK
c0 = *ptr;
#endif
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
mb_c = c;
@@ -4511,9 +4461,9 @@ win_line(
if (mb_c < 0x80)
{
c = mb_c;
-# ifdef FEAT_LINEBREAK
+#ifdef FEAT_LINEBREAK
c0 = mb_c;
-# endif
+#endif
}
mb_utf8 = TRUE;
@@ -4690,7 +4640,6 @@ win_line(
}
}
-#endif
++ptr;
if (extra_check)
@@ -4783,14 +4732,12 @@ win_line(
char_u *prev_ptr, *p;
int len;
hlf_T spell_hlf = HLF_COUNT;
-# ifdef FEAT_MBYTE
if (has_mbyte)
{
prev_ptr = ptr - mb_l;
v -= mb_l - 1;
}
else
-# endif
prev_ptr = ptr - 1;
/* Use nextline[] if possible, it has the start of the
@@ -4862,14 +4809,8 @@ win_line(
if (wp->w_p_lbr && c0 == c
&& VIM_ISBREAK(c) && !VIM_ISBREAK((int)*ptr))
{
-# ifdef FEAT_MBYTE
int mb_off = has_mbyte ? (*mb_head_off)(line, ptr - 1) : 0;
-# endif
- char_u *p = ptr - (
-# ifdef FEAT_MBYTE
- mb_off +
-# endif
- 1);
+ char_u *p = ptr - (mb_off + 1);
/* TODO: is passing p for start of the line OK? */
n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol,
@@ -4883,11 +4824,7 @@ win_line(
- vcol % (int)wp->w_buffer->b_p_ts - 1;
# endif
-# ifdef FEAT_MBYTE
c_extra = mb_off > 0 ? MB_FILLER_CHAR : ' ';
-# else
- c_extra = ' ';
-# endif
c_final = NUL;
if (VIM_ISWHITE(c))
{
@@ -4906,10 +4843,8 @@ win_line(
*/
if (wp->w_p_list
&& (((c == 160
-#ifdef FEAT_MBYTE
- || (mb_utf8 && (mb_c == 160 || mb_c == 0x202f))
-#endif
- ) && lcs_nbsp)
+ || (mb_utf8 && (mb_c == 160 || mb_c == 0x202f)))
+ && lcs_nbsp)
|| (c == ' ' && lcs_space && ptr - line <= trailcol)))
{
c = (c == ' ') ? lcs_space : lcs_nbsp;
@@ -4919,7 +4854,6 @@ win_line(
extra_attr = HL_ATTR(HLF_8);
saved_attr2 = char_attr; /* save current attr */
}
-#ifdef FEAT_MBYTE
mb_c = c;
if (enc_utf8 && utf_char2len(c) > 1)
{
@@ -4929,7 +4863,6 @@ win_line(
}
else
mb_utf8 = FALSE;
-#endif
}
if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ')
@@ -4941,7 +4874,6 @@ win_line(
extra_attr = HL_ATTR(HLF_8);
saved_attr2 = char_attr; /* save current attr */
}
-#ifdef FEAT_MBYTE
mb_c = c;
if (enc_utf8 && utf_char2len(c) > 1)
{
@@ -4951,7 +4883,6 @@ win_line(
}
else
mb_utf8 = FALSE;
-#endif
}
}
@@ -5012,11 +4943,9 @@ win_line(
/* if n_extra > 0, it gives the number of chars, to
* use for a tab, else we need to calculate the width
* for a tab */
-#ifdef FEAT_MBYTE
len = (tab_len * mb_char2len(lcs_tab2));
if (n_extra > 0)
len += n_extra - tab_len;
-#endif
c = lcs_tab1;
p = alloc((unsigned)(len + 1));
vim_memset(p, ' ', len);
@@ -5030,14 +4959,10 @@ win_line(
tab_len = i;
break;
}
-#ifdef FEAT_MBYTE
mb_char2bytes(lcs_tab2, p);
p += mb_char2len(lcs_tab2);
n_extra += mb_char2len(lcs_tab2)
- (saved_nextra > 0 ? 1 : 0);
-#else
- p[i] = lcs_tab2;
-#endif
}
p_extra = p_extra_free;
#ifdef FEAT_CONCEAL
@@ -5068,9 +4993,7 @@ win_line(
tab_len += vc_saved;
}
#endif
-#ifdef FEAT_MBYTE
mb_utf8 = FALSE; /* don't draw as UTF-8 */
-#endif
if (wp->w_p_list)
{
c = (n_extra == 0 && lcs_tab3) ? lcs_tab3 : lcs_tab1;
@@ -5084,7 +5007,6 @@ win_line(
n_attr = tab_len + 1;
extra_attr = HL_ATTR(HLF_8);
saved_attr2 = char_attr; /* save current attr */
-#ifdef FEAT_MBYTE
mb_c = c;
if (enc_utf8 && utf_char2len(c) > 1)
{
@@ -5092,7 +5014,6 @@ win_line(
u8cc[0] = 0;
c = 0xc0;
}
-#endif
}
else
{
@@ -5160,7 +5081,6 @@ win_line(
extra_attr = HL_ATTR(HLF_AT);
n_attr = 1;
}
-#ifdef FEAT_MBYTE
mb_c = c;
if (enc_utf8 && utf_char2len(c) > 1)
{
@@ -5170,7 +5090,6 @@ win_line(
}
else
mb_utf8 = FALSE; /* don't draw as UTF-8 */
-#endif
}
else if (c != NUL)
{
@@ -5208,9 +5127,7 @@ win_line(
extra_attr = HL_ATTR(HLF_8);
saved_attr2 = char_attr; /* save current attr */
}
-#ifdef FEAT_MBYTE
mb_utf8 = FALSE; /* don't draw as UTF-8 */
-#endif
}
#ifdef FEAT_VIRTUALEDIT
else if (VIsual_active
@@ -5339,7 +5256,6 @@ win_line(
is_concealing = TRUE;
n_skip = 1;
}
-# ifdef FEAT_MBYTE
mb_c = c;
if (enc_utf8 && utf_char2len(c) > 1)
{
@@ -5349,7 +5265,6 @@ win_line(
}
else
mb_utf8 = FALSE; /* don't draw as UTF-8 */
-# endif
}
else
{
@@ -5438,7 +5353,6 @@ win_line(
{
c = lcs_prec;
lcs_prec_todo = NUL;
-#ifdef FEAT_MBYTE
if (has_mbyte && (*mb_char2cells)(mb_c) > 1)
{
/* Double-width character being overwritten by the "precedes"
@@ -5458,7 +5372,6 @@ win_line(
}
else
mb_utf8 = FALSE; /* don't draw as UTF-8 */
-#endif
if (!attr_pri)
{
saved_attr3 = char_attr; /* save current attr */
@@ -5554,10 +5467,8 @@ win_line(
{
/* Add a blank character to highlight. */
ScreenLines[off] = ' ';
-#ifdef FEAT_MBYTE
if (enc_utf8)
ScreenLinesUC[off] = 0;
-#endif
}
#ifdef FEAT_SEARCH_EXTRA
if (area_attr == 0)
@@ -5657,10 +5568,8 @@ win_line(
while (col < wp->w_width)
{
ScreenLines[off] = ' ';
-#ifdef FEAT_MBYTE
if (enc_utf8)
ScreenLinesUC[off] = 0;
-#endif
++col;
if (draw_color_col)
draw_color_col = advance_color_col(VCOL_HLC,
@@ -5719,7 +5628,6 @@ win_line(
{
c = lcs_ext;
char_attr = HL_ATTR(HLF_AT);
-#ifdef FEAT_MBYTE
mb_c = c;
if (enc_utf8 && utf_char2len(c) > 1)
{
@@ -5729,7 +5637,6 @@ win_line(
}
else
mb_utf8 = FALSE;
-#endif
}
#ifdef FEAT_SYN_HL
@@ -5769,7 +5676,7 @@ win_line(
/*
* Store the character.
*/
-#if defined(FEAT_RIGHTLEFT) && defined(FEAT_MBYTE)
+#if defined(FEAT_RIGHTLEFT)
if (has_mbyte && wp->w_p_rl && (*mb_char2cells)(mb_c) > 1)
{
/* A double-wide character is: put first halve in left cell. */
@@ -5778,7 +5685,6 @@ win_line(
}
#endif
ScreenLines[off] = c;
-#ifdef FEAT_MBYTE
if (enc_dbcs == DBCS_JPNU)
{
if ((mb_c & 0xff00) == 0x8e00)
@@ -5810,10 +5716,8 @@ win_line(
multi_attr = 0;
}
else
-#endif
ScreenAttrs[off] = char_attr;
-#ifdef FEAT_MBYTE
if (has_mbyte && (*mb_char2cells)(mb_c) > 1)
{
/* Need to fill two screen columns. */
@@ -5844,7 +5748,6 @@ win_line(
}
#endif
}
-#endif
#ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
{
@@ -5900,24 +5803,22 @@ win_line(
}
-# ifdef FEAT_MBYTE
if (has_mbyte && (*mb_char2cells)(mb_c) > 1)
{
/* Need to fill two screen columns. */
-# ifdef FEAT_RIGHTLEFT
+# ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
{
--boguscols;
--col;
}
else
-# endif
+# endif
{
++boguscols;
++col;
}
}
-# endif
# ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
@@ -6050,7 +5951,6 @@ win_line(
#ifdef FEAT_GUI
&& !gui.in_use
#endif
-#ifdef FEAT_MBYTE
&& !(has_mbyte
&& ((*mb_off2cells)(LineOffset[screen_row],
LineOffset[screen_row] + screen_Columns)
@@ -6058,9 +5958,7 @@ win_line(
|| (*mb_off2cells)(LineOffset[screen_row - 1]
+ (int)Columns - 2,
LineOffset[screen_row] + screen_Columns)
- == 2))
-#endif
- )
+ == 2)))
{
/* First make sure we are at the end of the screen line,
* then output the same character again to let the
@@ -6071,14 +5969,12 @@ win_line(
+ (unsigned)Columns - 1,
screen_row - 1, (int)(Columns - 1));
-#ifdef FEAT_MBYTE
/* When there is a multi-byte character, just output a
* space to keep it simple. */
if (has_mbyte && MB_BYTE2LEN(ScreenLines[LineOffset[
screen_row - 1] + (Columns - 1)]) > 1)
out_char(' ');
else
-#endif
out_char(ScreenLines[LineOffset[screen_row - 1]
+ (Columns - 1)]);
/* force a redraw of the first char on the next line */
@@ -6140,7 +6036,6 @@ win_line(
return row;
}
-#ifdef FEAT_MBYTE
/*
* Return if the composing characters at "off_from" and "off_to" differ.
* Only to be used when ScreenLinesUC[off_from] != 0.
@@ -6159,7 +6054,6 @@ comp_char_differs(int off_from, int off_to)
}
return FALSE;
}
-#endif
/*
* Check whether the given character needs redrawing:
@@ -6174,8 +6068,6 @@ char_needs_redraw(int off_from, int off_to, int cols)
if (cols > 0
&& ((ScreenLines[off_from] != ScreenLines[off_to]
|| ScreenAttrs[off_from] != ScreenAttrs[off_to])
-
-#ifdef FEAT_MBYTE
|| (enc_dbcs != 0
&& MB_BYTE2LEN(ScreenLines[off_from]) > 1
&& (enc_dbcs == DBCS_JPNU && ScreenLines[off_from] == 0x8e
@@ -6188,9 +6080,7 @@ char_needs_redraw(int off_from, int off_to, int cols)
&& comp_char_differs(off_from, off_to))
|| ((*mb_off2cells)(off_from, off_from + cols) > 1
&& ScreenLines[off_from + 1]
- != ScreenLines[off_to + 1])))
-#endif
- ))
+ != ScreenLines[off_to + 1])))))
return TRUE;
return FALSE;
}
@@ -6227,10 +6117,8 @@ screen_line(
{
unsigned off_from;
unsigned off_to;
-#ifdef FEAT_MBYTE
unsigned max_off_from;
unsigned max_off_to;
-#endif
int col = 0;
int hl;
int force = FALSE; /* force update rest of the line */
@@ -6240,14 +6128,10 @@ screen_line(
#endif
;
int redraw_next; /* redraw_this for next character */
-#ifdef FEAT_MBYTE
int clear_next = FALSE;
int char_cells; /* 1: normal char */
/* 2: occupies two display cells */
# define CHAR_CELLS char_cells
-#else
-# define CHAR_CELLS 1
-#endif
/* Check for illegal row and col, just in case. */
if (row >= Rows)
@@ -6261,10 +6145,8 @@ screen_line(
off_from = (unsigned)(current_ScreenLine - ScreenLines);
off_to = LineOffset[row] + coloff;
-#ifdef FEAT_MBYTE
max_off_from = off_from + screen_Columns;
max_off_to = LineOffset[row] + screen_Columns;
-#endif
#ifdef FEAT_RIGHTLEFT
if (rlflag)
@@ -6274,10 +6156,7 @@ screen_line(
{
while (col <= endcol && ScreenLines[off_to] == ' '
&& ScreenAttrs[off_to] == 0
-# ifdef FEAT_MBYTE
- && (!enc_utf8 || ScreenLinesUC[off_to] == 0)
-# endif
- )
+ && (!enc_utf8 || ScreenLinesUC[off_to] == 0))
{
++off_to;
++col;
@@ -6297,12 +6176,10 @@ screen_line(
while (col < endcol)
{
-#ifdef FEAT_MBYTE
if (has_mbyte && (col + 1 < endcol))
char_cells = (*mb_off2cells)(off_from, max_off_from);
else
char_cells = 1;
-#endif
redraw_this = redraw_next;
redraw_next = force || char_needs_redraw(off_from + CHAR_CELLS,
@@ -6367,7 +6244,6 @@ screen_line(
else
screen_attr = 0; /* highlighting has stopped */
}
-#ifdef FEAT_MBYTE
if (enc_dbcs != 0)
{
/* Check if overwriting a double-byte with a single-byte or
@@ -6410,10 +6286,8 @@ screen_line(
&& (*mb_off2cells)(off_to, max_off_to) == 1
&& (*mb_off2cells)(off_to + 1, max_off_to) > 1)))
clear_next = TRUE;
-#endif
ScreenLines[off_to] = ScreenLines[off_from];
-#ifdef FEAT_MBYTE
if (enc_utf8)
{
ScreenLinesUC[off_to] = ScreenLinesUC[off_from];
@@ -6427,7 +6301,6 @@ screen_line(
}
if (char_cells == 2)
ScreenLines[off_to + 1] = ScreenLines[off_from + 1];
-#endif
#if defined(FEAT_GUI) || defined(UNIX)
/* The bold trick makes a single column of pixels appear in the
@@ -6454,7 +6327,7 @@ screen_line(
}
#endif
ScreenAttrs[off_to] = ScreenAttrs[off_from];
-#ifdef FEAT_MBYTE
+
/* For simplicity set the attributes of second half of a
* double-wide character equal to the first half. */
if (char_cells == 2)
@@ -6463,7 +6336,6 @@ screen_line(
if (enc_dbcs != 0 && char_cells == 2)
screen_char_2(off_to, row, col + coloff);
else
-#endif
screen_char(off_to, row, col + coloff);
}
else if ( p_wiv
@@ -6489,7 +6361,6 @@ screen_line(
col += CHAR_CELLS;
}
-#ifdef FEAT_MBYTE
if (clear_next)
{
/* Clear the second half of a double-wide character of which the left
@@ -6499,7 +6370,6 @@ screen_line(
ScreenLinesUC[off_to] = 0;
screen_char(off_to, row, col + coloff);
}
-#endif
if (clear_width > 0
#ifdef FEAT_RIGHTLEFT
@@ -6514,10 +6384,7 @@ screen_line(
/* blank out the rest of the line */
while (col < clear_width && ScreenLines[off_to] == ' '
&& ScreenAttrs[off_to] == 0
-#ifdef FEAT_MBYTE
- && (!enc_utf8 || ScreenLinesUC[off_to] == 0)
-#endif
- )
+ && (!enc_utf8 || ScreenLinesUC[off_to] == 0))
{
++off_to;
++col;
@@ -6538,7 +6405,7 @@ screen_line(
if (hl > HL_ALL || (hl & HL_BOLD))
{
int prev_cells = 1;
-# ifdef FEAT_MBYTE
+
if (enc_utf8)
/* for utf-8, ScreenLines[char_offset + 1] == 0 means
* that its width is 2. */
@@ -6561,7 +6428,6 @@ screen_line(
screen_char_2(off_to - prev_cells, row,
col + coloff - prev_cells);
else
-# endif
screen_char(off_to - prev_cells, row,
col + coloff - prev_cells);
}
@@ -6583,15 +6449,12 @@ screen_line(
c = fillchar_vsep(&hl);
if (ScreenLines[off_to] != (schar_T)c
-#ifdef FEAT_MBYTE
|| (enc_utf8 && (int)ScreenLinesUC[off_to]
!= (c >= 0x80 ? c : 0))
-#endif
|| ScreenAttrs[off_to] != hl)
{
ScreenLines[off_to] = c;
ScreenAttrs[off_to] = hl;
-#ifdef FEAT_MBYTE
if (enc_utf8)
{
if (c >= 0x80)
@@ -6602,7 +6465,6 @@ screen_line(
else
ScreenLinesUC[off_to] = 0;
}
-#endif
screen_char(off_to, row, col + coloff);
}
}
@@ -6808,18 +6670,14 @@ win_redr_status_matches(
#ifdef FEAT_MENU
int emenu;
#endif
-#if defined(FEAT_MBYTE) || defined(FEAT_MENU)
int l;
-#endif
if (matches == NULL) /* interrupted completion? */
return;
-#ifdef FEAT_MBYTE
if (has_mbyte)
buf = alloc((unsigned)Columns * MB_MAXBYTES + 1);
else
-#endif
buf = alloc((unsigned)Columns + 1);
if (buf == NULL)
return;
@@ -6912,7 +6770,6 @@ win_redr_status_matches(
{
s += skip_status_match_char(xp, s);
clen += ptr2cells(s);
-#ifdef FEAT_MBYTE
if (has_mbyte && (l = (*mb_ptr2len)(s)) > 1)
{
STRNCPY(buf + len, s, l);
@@ -6920,7 +6777,6 @@ win_redr_status_matches(
len += l;
}
else
-#endif
{
STRCPY(buf + len, transchar_byte(*s));
len += (int)STRLEN(buf + len);
@@ -7095,38 +6951,34 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED)
p = (char_u *)"<"; /* No room for file name! */
len = 1;
}
- else
-#ifdef FEAT_MBYTE
- if (has_mbyte)
- {
- int clen = 0, i;
-
- /* Count total number of display cells. */
- clen = mb_string2cells(p, -1);
+ else if (has_mbyte)
+ {
+ int clen = 0, i;
- /* Find first character that will fit.
- * Going from start to end is much faster for DBCS. */
- for (i = 0; p[i] != NUL && clen >= this_ru_col - 1;
- i += (*mb_ptr2len)(p + i))
- clen -= (*mb_ptr2cells)(p + i);
- len = clen;
- if (i > 0)
- {
- p = p + i - 1;
- *p = '<';
- ++len;
- }
+ /* Count total number of display cells. */
+ clen = mb_string2cells(p, -1);
- }
- else
-#endif
- if (len > this_ru_col - 1)
+ /* Find first character that will fit.
+ * Going from start to end is much faster for DBCS. */
+ for (i = 0; p[i] != NUL && clen >= this_ru_col - 1;
+ i += (*mb_ptr2len)(p + i))
+ clen -= (*mb_ptr2cells)(p + i);
+ len = clen;
+ if (i > 0)
{
- p += len - (this_ru_col - 1);
+ p = p + i - 1;
*p = '<';
- len = this_ru_col - 1;
+ ++len;
}
+ }
+ else if (len > this_ru_col - 1)
+ {
+ p += len - (this_ru_col - 1);
+ *p = '<';
+ len = this_ru_col - 1;
+ }
+
row = W_WINROW(wp) + wp->w_height;
screen_puts(p, row, wp->w_wincol, attr);
screen_fill(row, row + 1, len + wp->w_wincol,
@@ -7397,11 +7249,7 @@ win_redr_custom(
len = (int)STRLEN(buf);
while (width < maxwidth && len < (int)sizeof(buf) - 1)
{
-#ifdef FEAT_MBYTE
len += (*mb_char2bytes)(fillchar, buf + len);
-#else
- buf[len++] = fillchar;
-#endif
++width;
}
buf[len] = NUL;
@@ -7470,11 +7318,9 @@ screen_putchar(int c, int row, int col, int attr)
{
char_u buf[MB_MAXBYTES + 1];
-#ifdef FEAT_MBYTE
if (has_mbyte)
buf[(*mb_char2bytes)(c, buf)] = NUL;
else
-#endif
{
buf[0] = c;
buf[1] = NUL;
@@ -7499,7 +7345,6 @@ screen_getbytes(int row, int col, char_u *bytes, int *attrp)
bytes[0] = ScreenLines[off];
bytes[1] = NUL;
-#ifdef FEAT_MBYTE
if (enc_utf8 && ScreenLinesUC[off] != 0)
bytes[utfc_char2bytes(off, bytes)] = NUL;
else if (enc_dbcs == DBCS_JPNU && ScreenLines[off] == 0x8e)
@@ -7513,11 +7358,9 @@ screen_getbytes(int row, int col, char_u *bytes, int *attrp)
bytes[1] = ScreenLines[off + 1];
bytes[2] = NUL;
}
-#endif
}
}
-#ifdef FEAT_MBYTE
/*
* Return TRUE if composing characters for screen posn "off" differs from
* composing characters in "u8cc".
@@ -7537,7 +7380,6 @@ screen_comp_differs(int off, int *u8cc)
}
return FALSE;
}
-#endif
/*
* Put string '*text' on the screen at position 'row' and 'col', with
@@ -7571,36 +7413,31 @@ screen_puts_len(
char_u *ptr = text;
int len = textlen;
int c;
-#ifdef FEAT_MBYTE
unsigned max_off;
int mbyte_blen = 1;
int mbyte_cells = 1;
int u8c = 0;
int u8cc[MAX_MCO];
int clear_next_cell = FALSE;
-# ifdef FEAT_ARABIC
+#ifdef FEAT_ARABIC
int prev_c = 0; /* previous Arabic character */
int pc, nc, nc1;
int pcc[MAX_MCO];
-# endif
#endif
-#if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
int force_redraw_this;
int force_redraw_next = FALSE;
-#endif
int need_redraw;
if (ScreenLines == NULL || row >= screen_Rows) /* safety check */
return;
off = LineOffset[row] + col;
-#ifdef FEAT_MBYTE
/* When drawing over the right halve of a double-wide char clear out the
* left halve. Only needed in a terminal. */
if (has_mbyte && col > 0 && col < screen_Columns
-# ifdef FEAT_GUI
+#ifdef FEAT_GUI
&& !gui.in_use
-# endif
+#endif
&& mb_fix_col(col, row) != col)
{
ScreenLines[off - 1] = ' ';
@@ -7615,17 +7452,13 @@ screen_puts_len(
/* force the cell at "col" to be redrawn */
force_redraw_next = TRUE;
}
-#endif
-#ifdef FEAT_MBYTE
max_off = LineOffset[row] + screen_Columns;
-#endif
while (col < screen_Columns
&& (len < 0 || (int)(ptr - text) < len)
&& *ptr != NUL)
{
c = *ptr;
-#ifdef FEAT_MBYTE
/* check if this is the first byte of a multibyte */
if (has_mbyte)
{
@@ -7645,7 +7478,7 @@ screen_puts_len(
else
u8c = utfc_ptr2char(ptr, u8cc);
mbyte_cells = utf_char2cells(u8c);
-# ifdef UNICODE16
+#ifdef UNICODE16
/* Non-BMP character: display as ? or fullwidth ?. */
if (u8c >= 0x10000)
{
@@ -7653,8 +7486,8 @@ screen_puts_len(
if (attr == 0)
attr = HL_ATTR(HLF_8);
}
-# endif
-# ifdef FEAT_ARABIC
+#endif
+#ifdef FEAT_ARABIC
if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c))
{
/* Do Arabic shaping. */
@@ -7676,7 +7509,7 @@ screen_puts_len(
}
else
prev_c = u8c;
-# endif
+#endif
if (col + mbyte_cells > screen_Columns)
{
/* Only 1 cell left, but character requires 2 cells:
@@ -7686,15 +7519,11 @@ screen_puts_len(
}
}
}
-#endif
-#if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
force_redraw_this = force_redraw_next;
force_redraw_next = FALSE;
-#endif
need_redraw = ScreenLines[off] != c
-#ifdef FEAT_MBYTE
|| (mbyte_cells == 2
&& ScreenLines[off + 1] != (enc_dbcs ? ptr[1] : 0))
|| (enc_dbcs == DBCS_JPNU
@@ -7705,15 +7534,10 @@ screen_puts_len(
(u8char_T)(c < 0x80 && u8cc[0] == 0 ? 0 : u8c)
|| (ScreenLinesUC[off] != 0
&& screen_comp_differs(off, u8cc))))
-#endif
|| ScreenAttrs[off] != attr
|| exmode_active;
- if (need_redraw
-#if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
- || force_redraw_this
-#endif
- )
+ if (need_redraw || force_redraw_this)
{
#if defined(FEAT_GUI) || defined(UNIX)
/* The bold trick makes a single row of pixels appear in the next
@@ -7740,7 +7564,6 @@ screen_puts_len(
force_redraw_next = TRUE;
}
#endif
-#ifdef FEAT_MBYTE
/* When at the end of the text and overwriting a two-cell
* character with a one-cell character, need to clear the next
* cell. Also when overwriting the left halve of a two-cell char
@@ -7765,10 +7588,8 @@ screen_puts_len(
&& (*mb_off2cells)(off, max_off) == 1
&& (*mb_off2cells)(off + 1, max_off) > 1)))
ScreenLines[off + mbyte_blen] = 0;
-#endif
ScreenLines[off] = c;
ScreenAttrs[off] = attr;
-#ifdef FEAT_MBYTE
if (enc_utf8)
{
if (c < 0x80 && u8cc[0] == 0)
@@ -7804,10 +7625,8 @@ screen_puts_len(
screen_char(off, row, col);
}
else
-#endif
screen_char(off, row, col);
}
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
off += mbyte_cells;
@@ -7821,7 +7640,6 @@ screen_puts_len(
}
}
else
-#endif
{
++off;
++col;
@@ -7829,19 +7647,15 @@ screen_puts_len(
}
}
-#if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
/* If we detected the next character needs to be redrawn, but the text
* doesn't extend up to there, update the character here. */
if (force_redraw_next && col < screen_Columns)
{
-# ifdef FEAT_MBYTE
if (enc_dbcs != 0 && dbcs_off2cells(off, max_off) > 1)
screen_char_2(off, row, col);
else
-# endif
screen_char(off, row, col);
}
-#endif
}
#ifdef FEAT_SEARCH_EXTRA
@@ -8063,11 +7877,9 @@ next_search_hl(
shl->lnum = 0;
break;
}
-#ifdef FEAT_MBYTE
if (has_mbyte)
matchcol += mb_ptr2len(ml);
else
-#endif
++matchcol;
}
else
@@ -8515,7 +8327,6 @@ screen_char(unsigned off, int row, int col)
if (screen_attr != attr)
screen_start_highlight(attr);
-#ifdef FEAT_MBYTE
if (enc_utf8 && ScreenLinesUC[off] != 0)
{
char_u buf[MB_MAXBYTES + 1];
@@ -8523,9 +8334,9 @@ screen_char(unsigned off, int row, int col)
if (utf_ambiguous_width(ScreenLinesUC[off]))
{
if (*p_ambw == 'd'
-# ifdef FEAT_GUI
+#ifdef FEAT_GUI
&& !gui.in_use
-# endif
+#endif
)
{
/* Clear the two screen cells. If the character is actually
@@ -8545,24 +8356,17 @@ screen_char(unsigned off, int row, int col)
out_str(buf);
}
else
-#endif
{
-#ifdef FEAT_MBYTE
out_flush_check();
-#endif
out_char(ScreenLines[off]);
-#ifdef FEAT_MBYTE
/* double-byte character in single-width cell */
if (enc_dbcs == DBCS_JPNU && ScreenLines[off] == 0x8e)
out_char(ScreenLines2[off]);
-#endif
}
screen_cur_col++;
}
-#ifdef FEAT_MBYTE
-
/*
* Used for enc_dbcs only: Put one double-wide character at ScreenLines["off"]
* on the screen at position 'row' and 'col'.
@@ -8590,7 +8394,6 @@ screen_char_2(unsigned off, int row, int col)
out_char(ScreenLines[off + 1]);
++screen_cur_col;
}
-#endif
/*
* Draw a rectangle of the screen, inverted when "invert" is TRUE.
@@ -8606,9 +8409,7 @@ screen_draw_rectangle(
{
int r, c;
int off;
-#ifdef FEAT_MBYTE
int max_off;
-#endif
/* Can't use ScreenLines unless initialized */
if (ScreenLines == NULL)
@@ -8619,25 +8420,19 @@ screen_draw_rectangle(
for (r = row; r < row + height; ++r)
{
off = LineOffset[r];
-#ifdef FEAT_MBYTE
max_off = off + screen_Columns;
-#endif
for (c = col; c < col + width; ++c)
{
-#ifdef FEAT_MBYTE
if (enc_dbcs != 0 && dbcs_off2cells(off + c, max_off) > 1)
{
screen_char_2(off + c, r, c);
++c;
}
else
-#endif
{
screen_char(off + c, r, c);
-#ifdef FEAT_MBYTE
if (utf_off2cells(off + c, max_off) > 1)
++c;
-#endif
}
}
}
@@ -8675,10 +8470,8 @@ space_to_screenline(int off, int attr)
{
ScreenLines[off] = ' ';
ScreenAttrs[off] = attr;
-# ifdef FEAT_MBYTE
if (enc_utf8)
ScreenLinesUC[off] = 0;
-# endif
}
/*
@@ -8724,11 +8517,10 @@ screen_fill(
!IS_CTERM);
for (row = start_row; row < end_row; ++row)
{
-#ifdef FEAT_MBYTE
if (has_mbyte
-# ifdef FEAT_GUI
+#ifdef FEAT_GUI
&& !gui.in_use
-# endif
+#endif
)
{
/* When drawing over the right halve of a double-wide char clear
@@ -8740,7 +8532,6 @@ screen_fill(
if (end_col < screen_Columns && mb_fix_col(end_col, row) != end_col)
screen_puts_len((char_u *)" ", 1, row, end_col, 0);
}
-#endif
/*
* Try to use delete-line termcap code, when no attributes or in a
* "normal" terminal, where a bold/italic space is just a
@@ -8766,13 +8557,11 @@ screen_fill(
end_off = LineOffset[row] + end_col;
/* skip blanks (used often, keep it fast!) */
-#ifdef FEAT_MBYTE
if (enc_utf8)
while (off < end_off && ScreenLines[off] == ' '
&& ScreenAttrs[off] == 0 && ScreenLinesUC[off] == 0)
++off;
else
-#endif
while (off < end_off && ScreenLines[off] == ' '
&& ScreenAttrs[off] == 0)
++off;
@@ -8798,10 +8587,8 @@ screen_fill(
for (col = start_col; col < end_col; ++col)
{
if (ScreenLines[off] != c
-#ifdef FEAT_MBYTE
|| (enc_utf8 && (int)ScreenLinesUC[off]
!= (c >= 0x80 ? c : 0))
-#endif
|| ScreenAttrs[off] != attr
#if defined(FEAT_GUI) || defined(UNIX)
|| force_next
@@ -8834,7 +8621,6 @@ screen_fill(
}
#endif
ScreenLines[off] = c;
-#ifdef FEAT_MBYTE
if (enc_utf8)
{
if (c >= 0x80)
@@ -8845,7 +8631,6 @@ screen_fill(
else
ScreenLinesUC[off] = 0;
}
-#endif
ScreenAttrs[off] = attr;
if (!did_delete || c != ' ')
screen_char(off, row, col);
@@ -8925,12 +8710,10 @@ screenalloc(int doclear)
int outofmem = FALSE;
int len;
schar_T *new_ScreenLines;
-#ifdef FEAT_MBYTE
u8char_T *new_ScreenLinesUC = NULL;
u8char_T *new_ScreenLinesC[MAX_MCO];
schar_T *new_ScreenLines2 = NULL;
int i;
-#endif
sattr_T *new_ScreenAttrs;
unsigned *new_LineOffset;
char_u *new_LineWraps;
@@ -8949,12 +8732,9 @@ retry:
if ((ScreenLines != NULL
&& Rows == screen_Rows
&& Columns == screen_Columns
-#ifdef FEAT_MBYTE
&& enc_utf8 == (ScreenLinesUC != NULL)
&& (enc_dbcs == DBCS_JPNU) == (ScreenLines2 != NULL)
- && p_mco == Screen_mco
-#endif
- )
+ && p_mco == Screen_mco)
|| Rows == 0
|| Columns == 0
|| (!full_screen && ScreenLines == NULL))
@@ -8997,7 +8777,6 @@ retry:
new_ScreenLines = (schar_T *)lalloc((long_u)(
(Rows + 1) * Columns * sizeof(schar_T)), FALSE);
-#ifdef FEAT_MBYTE
vim_memset(new_ScreenLinesC, 0, sizeof(u8char_T *) * MAX_MCO);
if (enc_utf8)
{
@@ -9010,7 +8789,6 @@ retry:
if (enc_dbcs == DBCS_JPNU)
new_ScreenLines2 = (schar_T *)lalloc((long_u)(
(Rows + 1) * Columns * sizeof(schar_T)), FALSE);
-#endif
new_ScreenAttrs = (sattr_T *)lalloc((long_u)(
(Rows + 1) * Columns * sizeof(sattr_T)), FALSE);
new_LineOffset = (unsigned *)lalloc((long_u)(
@@ -9031,16 +8809,12 @@ retry:
outofmem = TRUE;
give_up:
-#ifdef FEAT_MBYTE
for (i = 0; i < p_mco; ++i)
if (new_ScreenLinesC[i] == NULL)
break;
-#endif
if (new_ScreenLines == NULL
-#ifdef FEAT_MBYTE
|| (enc_utf8 && (new_ScreenLinesUC == NULL || i != p_mco))
|| (enc_dbcs == DBCS_JPNU && new_ScreenLines2 == NULL)
-#endif
|| new_ScreenAttrs == NULL
|| new_LineOffset == NULL
|| new_LineWraps == NULL
@@ -9057,12 +8831,10 @@ give_up:
done_outofmem_msg = TRUE;
}
VIM_CLEAR(new_ScreenLines);
-#ifdef FEAT_MBYTE
VIM_CLEAR(new_ScreenLinesUC);
for (i = 0; i < p_mco; ++i)
VIM_CLEAR(new_ScreenLinesC[i]);
VIM_CLEAR(new_ScreenLines2);
-#endif
VIM_CLEAR(new_ScreenAttrs);
VIM_CLEAR(new_LineOffset);
VIM_CLEAR(new_LineWraps);
@@ -9087,7 +8859,6 @@ give_up:
{
(void)vim_memset(new_ScreenLines + new_row * Columns,
' ', (size_t)Columns * sizeof(schar_T));
-#ifdef FEAT_MBYTE
if (enc_utf8)
{
(void)vim_memset(new_ScreenLinesUC + new_row * Columns,
@@ -9100,7 +8871,6 @@ give_up:
if (enc_dbcs == DBCS_JPNU)
(void)vim_memset(new_ScreenLines2 + new_row * Columns,
0, (size_t)Columns * sizeof(schar_T));
-#endif
(void)vim_memset(new_ScreenAttrs + new_row * Columns,
0, (size_t)Columns * sizeof(sattr_T));
old_row = new_row + (screen_Rows - Rows);
@@ -9110,16 +8880,13 @@ give_up:
len = screen_Columns;
else
len = Columns;
-#ifdef FEAT_MBYTE
/* When switching to utf-8 don't copy characters, they
* may be invalid now. Also when p_mco changes. */
if (!(enc_utf8 && ScreenLinesUC == NULL)
&& p_mco == Screen_mco)
-#endif
mch_memmove(new_ScreenLines + new_LineOffset[new_row],
ScreenLines + LineOffset[old_row],
(size_t)len * sizeof(schar_T));
-#ifdef FEAT_MBYTE
if (enc_utf8 && ScreenLinesUC != NULL
&& p_mco == Screen_mco)
{
@@ -9136,7 +8903,6 @@ give_up:
mch_memmove(new_ScreenLines2 + new_LineOffset[new_row],
ScreenLines2 + LineOffset[old_row],
(size_t)len * sizeof(schar_T));
-#endif
mch_memmove(new_ScreenAttrs + new_LineOffset[new_row],
ScreenAttrs + LineOffset[old_row],
(size_t)len * sizeof(sattr_T));
@@ -9150,13 +8916,11 @@ give_up:
free_screenlines();
ScreenLines = new_ScreenLines;
-#ifdef FEAT_MBYTE
ScreenLinesUC = new_ScreenLinesUC;
for (i = 0; i < p_mco; ++i)
ScreenLinesC[i] = new_ScreenLinesC[i];
Screen_mco = p_mco;
ScreenLines2 = new_ScreenLines2;
-#endif
ScreenAttrs = new_ScreenAttrs;
LineOffset = new_LineOffset;
LineWraps = new_LineWraps;
@@ -9213,14 +8977,12 @@ give_up:
void
free_screenlines(void)
{
-#ifdef FEAT_MBYTE
int i;
vim_free(ScreenLinesUC);
for (i = 0; i < Screen_mco; ++i)
vim_free(ScreenLinesC[i]);
vim_free(ScreenLines2);
-#endif
vim_free(ScreenLines);
vim_free(ScreenAttrs);
vim_free(LineOffset);
@@ -9303,11 +9065,9 @@ screenclear2(void)
lineclear(unsigned off, int width, int attr)
{
(void)vim_memset(ScreenLines + off, ' ', (size_t)width * sizeof(schar_T));
-#ifdef FEAT_MBYTE
if (enc_utf8)
(void)vim_memset(ScreenLinesUC + off, 0,
(size_t)width * sizeof(u8char_T));
-#endif
(void)vim_memset(ScreenAttrs + off, attr, (size_t)width * sizeof(sattr_T));
}
@@ -9332,7 +9092,6 @@ linecopy(int to, int from, win_T *wp)
mch_memmove(ScreenLines + off_to, ScreenLines + off_from,
wp->w_width * sizeof(schar_T));
-#ifdef FEAT_MBYTE
if (enc_utf8)
{
int i;
@@ -9346,7 +9105,6 @@ linecopy(int to, int from, win_T *wp)
if (enc_dbcs == DBCS_JPNU)
mch_memmove(ScreenLines2 + off_to, ScreenLines2 + off_from,
wp->w_width * sizeof(schar_T));
-#endif
mch_memmove(ScreenAttrs + off_to, ScreenAttrs + off_from,
wp->w_width * sizeof(sattr_T));
}
@@ -9533,7 +9291,6 @@ windgoto(int row, int col)
if (i != 0)
cost = 999; /* different attributes, don't do it */
}
-#ifdef FEAT_MBYTE
if (enc_utf8)
{
/* Don't use an UTF-8 char for positioning, it's slow. */
@@ -9544,7 +9301,6 @@ windgoto(int row, int col)
break;
}
}
-#endif
}
/*
@@ -9603,15 +9359,11 @@ windgoto(int row, int col)
{
if (ScreenAttrs[off] != screen_attr)
screen_stop_highlight();
-#ifdef FEAT_MBYTE
out_flush_check();
-#endif
out_char(ScreenLines[off]);
-#ifdef FEAT_MBYTE
if (enc_dbcs == DBCS_JPNU
&& ScreenLines[off] == 0x8e)
out_char(ScreenLines2[off]);
-#endif
++off;
}
}
@@ -9660,13 +9412,10 @@ setcursor_mayforce(int force)
#ifdef FEAT_RIGHTLEFT
/* With 'rightleft' set and the cursor on a double-wide
* character, position it on the leftmost column. */
- curwin->w_p_rl ? ((int)curwin->w_width - curwin->w_wcol - (
-# ifdef FEAT_MBYTE
- (has_mbyte
+ curwin->w_p_rl ? ((int)curwin->w_width - curwin->w_wcol
+ - ((has_mbyte
&& (*mb_ptr2cells)(ml_get_cursor()) == 2
- && vim_isprintc(gchar_cursor())) ? 2 :
-# endif
- 1)) :
+ && vim_isprintc(gchar_cursor())) ? 2 : 1)) :
#endif
curwin->w_wcol));
}
@@ -10808,16 +10557,13 @@ draw_tabline(void)
shorten_dir(NameBuff);
len = vim_strsize(NameBuff);
p = NameBuff;
-#ifdef FEAT_MBYTE
if (has_mbyte)
while (len > room)
{
len -= ptr2cells(p);
MB_PTR_ADV(p);
}
- else
-#endif
- if (len > room)
+ else if (len > room)
{
p += len - room;
len = room;
@@ -11210,18 +10956,15 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum)
/* need at least 3 chars left for get_rel_pos() + NUL */
while (this_ru_col + o < width && RULER_BUF_LEN > i + 4)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
i += (*mb_char2bytes)(fillchar, buffer + i);
else
-#endif
buffer[i++] = fillchar;
++o;
}
get_rel_pos(wp, buffer + i, RULER_BUF_LEN - i);
}
/* Truncate at window boundary. */
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
o = 0;
@@ -11235,9 +10978,7 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum)
}
}
}
- else
-#endif
- if (this_ru_col + (int)STRLEN(buffer) > width)
+ else if (this_ru_col + (int)STRLEN(buffer) > width)
buffer[width - this_ru_col] = NUL;
screen_puts(buffer, row, this_ru_col + off, attr);