Skip to content

Commit 1350597

Browse files
committed
patch 8.1.0805: too many #ifdefs
Problem: Too many #ifdefs. Solution: Graduate FEAT_MBYTE, part 1.
1 parent 4b9e91f commit 1350597

17 files changed

Lines changed: 233 additions & 1146 deletions

src/buffer.c

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -704,10 +704,8 @@ buf_clear_file(buf_T *buf)
704704
buf->b_shortname = FALSE;
705705
buf->b_p_eol = TRUE;
706706
buf->b_start_eol = TRUE;
707-
#ifdef FEAT_MBYTE
708707
buf->b_p_bomb = FALSE;
709708
buf->b_start_bomb = FALSE;
710-
#endif
711709
buf->b_ml.ml_mfp = NULL;
712710
buf->b_ml.ml_flags = ML_EMPTY; /* empty buffer */
713711
#ifdef FEAT_NETBEANS_INTG
@@ -940,9 +938,7 @@ free_buffer_stuff(
940938
map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */
941939
map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */
942940
#endif
943-
#ifdef FEAT_MBYTE
944941
VIM_CLEAR(buf->b_start_fenc);
945-
#endif
946942
}
947943

948944
/*
@@ -2133,9 +2129,7 @@ free_buf_options(
21332129
{
21342130
if (free_p_ff)
21352131
{
2136-
#ifdef FEAT_MBYTE
21372132
clear_string_option(&buf->b_p_fenc);
2138-
#endif
21392133
clear_string_option(&buf->b_p_ff);
21402134
clear_string_option(&buf->b_p_bh);
21412135
clear_string_option(&buf->b_p_bt);
@@ -2245,9 +2239,7 @@ free_buf_options(
22452239
clear_string_option(&buf->b_p_lw);
22462240
#endif
22472241
clear_string_option(&buf->b_p_bkc);
2248-
#ifdef FEAT_MBYTE
22492242
clear_string_option(&buf->b_p_menc);
2250-
#endif
22512243
}
22522244

22532245
/*
@@ -3778,10 +3770,8 @@ maketitle(void)
37783770
if (len > 100)
37793771
{
37803772
len -= 100;
3781-
#ifdef FEAT_MBYTE
37823773
if (has_mbyte)
37833774
len += (*mb_tail_off)(p, p + len) + 1;
3784-
#endif
37853775
p += len;
37863776
}
37873777
STRCPY(icon_str, p);
@@ -3939,11 +3929,9 @@ build_stl_str_hl(
39393929

39403930
if (fillchar == 0)
39413931
fillchar = ' ';
3942-
#ifdef FEAT_MBYTE
39433932
/* Can't handle a multi-byte fill character yet. */
39443933
else if (mb_char2len(fillchar) > 1)
39453934
fillchar = '-';
3946-
#endif
39473935

39483936
// The cursor in windows other than the current one isn't always
39493937
// up-to-date, esp. because of autocommands and timers.
@@ -3973,11 +3961,7 @@ build_stl_str_hl(
39733961
byteval = 0;
39743962
}
39753963
else
3976-
#ifdef FEAT_MBYTE
39773964
byteval = (*mb_ptr2char)(p + wp->w_cursor.col);
3978-
#else
3979-
byteval = p[wp->w_cursor.col];
3980-
#endif
39813965

39823966
groupdepth = 0;
39833967
p = out;
@@ -4079,7 +4063,6 @@ build_stl_str_hl(
40794063
if (l > item[groupitem[groupdepth]].maxwid)
40804064
{
40814065
/* truncate, remove n bytes of text at the start */
4082-
#ifdef FEAT_MBYTE
40834066
if (has_mbyte)
40844067
{
40854068
/* Find the first character that should be included. */
@@ -4091,17 +4074,15 @@ build_stl_str_hl(
40914074
}
40924075
}
40934076
else
4094-
#endif
40954077
n = (long)(p - t) - item[groupitem[groupdepth]].maxwid + 1;
40964078

40974079
*t = '<';
40984080
mch_memmove(t + 1, t + n, (size_t)(p - (t + n)));
40994081
p = p - n + 1;
4100-
#ifdef FEAT_MBYTE
4101-
/* Fill up space left over by half a double-wide char. */
4082+
4083+
// Fill up space left over by half a double-wide char.
41024084
while (++l < item[groupitem[groupdepth]].minwid)
41034085
*p++ = fillchar;
4104-
#endif
41054086

41064087
/* correct the start of the items for the truncation */
41074088
for (l = groupitem[groupdepth] + 1; l < curitem; l++)
@@ -4483,14 +4464,12 @@ build_stl_str_hl(
44834464
if (l > maxwid)
44844465
{
44854466
while (l >= maxwid)
4486-
#ifdef FEAT_MBYTE
44874467
if (has_mbyte)
44884468
{
44894469
l -= ptr2cells(t);
44904470
t += (*mb_ptr2len)(t);
44914471
}
44924472
else
4493-
#endif
44944473
l -= byte2cells(*t++);
44954474
if (p + 1 >= out + outlen)
44964475
break;
@@ -4610,7 +4589,6 @@ build_stl_str_hl(
46104589
if (width - vim_strsize(s) >= maxwidth)
46114590
{
46124591
/* Truncation mark is beyond max length */
4613-
#ifdef FEAT_MBYTE
46144592
if (has_mbyte)
46154593
{
46164594
s = out;
@@ -4627,7 +4605,6 @@ build_stl_str_hl(
46274605
*s++ = fillchar;
46284606
}
46294607
else
4630-
#endif
46314608
s = out + maxwidth - 1;
46324609
for (l = 0; l < itemcnt; l++)
46334610
if (item[l].start > s)
@@ -4638,7 +4615,6 @@ build_stl_str_hl(
46384615
}
46394616
else
46404617
{
4641-
#ifdef FEAT_MBYTE
46424618
if (has_mbyte)
46434619
{
46444620
n = 0;
@@ -4649,7 +4625,6 @@ build_stl_str_hl(
46494625
}
46504626
}
46514627
else
4652-
#endif
46534628
n = width - maxwidth + 1;
46544629
p = s + n;
46554630
STRMOVE(s + 1, p);

0 commit comments

Comments
 (0)