1
0
forked from aniani/vim

patch 8.1.0805: too many #ifdefs

Problem:    Too many #ifdefs.
Solution:   Graduate FEAT_MBYTE, part 1.
This commit is contained in:
Bram Moolenaar
2019-01-24 15:04:48 +01:00
parent 4b9e91f0ba
commit 135059724f
17 changed files with 234 additions and 1147 deletions

View File

@@ -212,9 +212,7 @@ static int spell_bad_len = 0; /* length of located bad word */
static void stop_insert(pos_T *end_insert_pos, int esc, int nomove);
static int echeck_abbr(int);
static void replace_join(int off);
#ifdef FEAT_MBYTE
static void mb_replace_pop_ins(int cc);
#endif
static void replace_flush(void);
static void replace_do_bs(int limit_col);
static int del_char_after_col(int limit_col);
@@ -567,14 +565,12 @@ edit(
{
if (ptr[1] == NUL)
++curwin->w_cursor.col;
#ifdef FEAT_MBYTE
else if (has_mbyte)
{
i = (*mb_ptr2len)(ptr);
if (ptr[i] == NUL)
curwin->w_cursor.col += i;
}
#endif
}
ins_at_eol = FALSE;
}
@@ -1580,12 +1576,10 @@ normalchar:
* special character. Let CTRL-] expand abbreviations without
* inserting it. */
if (vim_iswordc(c) || (!echeck_abbr(
#ifdef FEAT_MBYTE
/* Add ABBR_OFF for characters above 0x100, this is
* what check_abbr() expects. */
(has_mbyte && c >= 0x100) ? (c + ABBR_OFF) :
#endif
c) && c != Ctrl_RSB))
// Add ABBR_OFF for characters above 0x100, this is
// what check_abbr() expects.
(has_mbyte && c >= 0x100) ? (c + ABBR_OFF) : c)
&& c != Ctrl_RSB))
{
insert_special(c, FALSE, FALSE);
#ifdef FEAT_RIGHTLEFT
@@ -1835,14 +1829,11 @@ edit_putchar(int c, int highlight)
attr = 0;
pc_row = W_WINROW(curwin) + curwin->w_wrow;
pc_col = curwin->w_wincol;
#if defined(FEAT_RIGHTLEFT) || defined(FEAT_MBYTE)
pc_status = PC_STATUS_UNSET;
#endif
#ifdef FEAT_RIGHTLEFT
if (curwin->w_p_rl)
{
pc_col += curwin->w_width - 1 - curwin->w_wcol;
# ifdef FEAT_MBYTE
if (has_mbyte)
{
int fix_col = mb_fix_col(pc_col, pc_row);
@@ -1854,22 +1845,17 @@ edit_putchar(int c, int highlight)
pc_status = PC_STATUS_RIGHT;
}
}
# endif
}
else
#endif
{
pc_col += curwin->w_wcol;
#ifdef FEAT_MBYTE
if (mb_lefthalve(pc_row, pc_col))
pc_status = PC_STATUS_LEFT;
#endif
}
/* save the character to be able to put it back */
#if defined(FEAT_RIGHTLEFT) || defined(FEAT_MBYTE)
if (pc_status == PC_STATUS_UNSET)
#endif
{
screen_getbytes(pc_row, pc_col, pc_bytes, &pc_attr);
pc_status = PC_STATUS_SET;
@@ -1953,13 +1939,11 @@ edit_unputchar(void)
{
if (pc_status != PC_STATUS_UNSET && pc_row >= msg_scrolled)
{
#if defined(FEAT_MBYTE)
if (pc_status == PC_STATUS_RIGHT)
++curwin->w_wcol;
if (pc_status == PC_STATUS_RIGHT || pc_status == PC_STATUS_LEFT)
redrawWinline(curwin, curwin->w_cursor.lnum);
else
#endif
screen_puts(pc_bytes, pc_row - msg_scrolled, pc_col, pc_attr);
}
}
@@ -1979,7 +1963,6 @@ display_dollar(colnr_T col)
cursor_off();
save_col = curwin->w_cursor.col;
curwin->w_cursor.col = col;
#ifdef FEAT_MBYTE
if (has_mbyte)
{
char_u *p;
@@ -1988,7 +1971,6 @@ display_dollar(colnr_T col)
p = ml_get_curline();
curwin->w_cursor.col -= (*mb_head_off)(p, p + col);
}
#endif
curs_columns(FALSE); /* recompute w_wrow and w_wcol */
if (curwin->w_wcol < curwin->w_width)
{
@@ -2132,11 +2114,9 @@ change_indent(
while (vcol <= (int)curwin->w_virtcol)
{
last_vcol = vcol;
#ifdef FEAT_MBYTE
if (has_mbyte && new_cursor_col >= 0)
new_cursor_col += (*mb_ptr2len)(ptr + new_cursor_col);
else
#endif
++new_cursor_col;
vcol += lbr_chartabsize(ptr, ptr + new_cursor_col, (colnr_T)vcol);
}
@@ -2302,7 +2282,6 @@ backspace_until_column(int col)
static int
del_char_after_col(int limit_col UNUSED)
{
#ifdef FEAT_MBYTE
if (enc_utf8 && limit_col >= 0)
{
colnr_T ecol = curwin->w_cursor.col + 1;
@@ -2324,7 +2303,6 @@ del_char_after_col(int limit_col UNUSED)
del_bytes((long)((int)ecol - curwin->w_cursor.col), FALSE, TRUE);
}
else
#endif
(void)del_char(FALSE);
return TRUE;
}
@@ -2529,7 +2507,6 @@ ins_compl_add_infercase(
/* Infer case of completed part. */
/* Find actual length of completion. */
#ifdef FEAT_MBYTE
if (has_mbyte)
{
p = str;
@@ -2541,11 +2518,9 @@ ins_compl_add_infercase(
}
}
else
#endif
actual_len = len;
/* Find actual length of original text. */
#ifdef FEAT_MBYTE
if (has_mbyte)
{
p = compl_orig_text;
@@ -2557,7 +2532,6 @@ ins_compl_add_infercase(
}
}
else
#endif
actual_compl_length = compl_length;
/* "actual_len" may be smaller than "actual_compl_length" when using
@@ -2571,22 +2545,18 @@ ins_compl_add_infercase(
{
p = str;
for (i = 0; i < actual_len; ++i)
#ifdef FEAT_MBYTE
if (has_mbyte)
wca[i] = mb_ptr2char_adv(&p);
else
#endif
wca[i] = *(p++);
/* Rule 1: Were any chars converted to lower? */
p = compl_orig_text;
for (i = 0; i < min_len; ++i)
{
#ifdef FEAT_MBYTE
if (has_mbyte)
c = mb_ptr2char_adv(&p);
else
#endif
c = *(p++);
if (MB_ISLOWER(c))
{
@@ -2610,11 +2580,9 @@ ins_compl_add_infercase(
p = compl_orig_text;
for (i = 0; i < min_len; ++i)
{
#ifdef FEAT_MBYTE
if (has_mbyte)
c = mb_ptr2char_adv(&p);
else
#endif
c = *(p++);
if (was_letter && MB_ISUPPER(c) && MB_ISLOWER(wca[i]))
{
@@ -2631,11 +2599,9 @@ ins_compl_add_infercase(
p = compl_orig_text;
for (i = 0; i < min_len; ++i)
{
#ifdef FEAT_MBYTE
if (has_mbyte)
c = mb_ptr2char_adv(&p);
else
#endif
c = *(p++);
if (MB_ISLOWER(c))
wca[i] = MB_TOLOWER(wca[i]);
@@ -2652,11 +2618,9 @@ ins_compl_add_infercase(
p = IObuff;
i = 0;
while (i < actual_len && (p - IObuff + 6) < IOSIZE)
#ifdef FEAT_MBYTE
if (has_mbyte)
p += (*mb_char2bytes)(wca[i++], p);
else
#endif
*(p++) = wca[i++];
*p = NUL;
@@ -2837,14 +2801,12 @@ ins_compl_longest_match(compl_T *match)
s = match->cp_str;
while (*p != NUL)
{
#ifdef FEAT_MBYTE
if (has_mbyte)
{
c1 = mb_ptr2char(p);
c2 = mb_ptr2char(s);
}
else
#endif
{
c1 = *p;
c2 = *s;
@@ -2852,14 +2814,12 @@ ins_compl_longest_match(compl_T *match)
if (match->cp_icase ? (MB_TOLOWER(c1) != MB_TOLOWER(c2))
: (c1 != c2))
break;
#ifdef FEAT_MBYTE
if (has_mbyte)
{
MB_PTR_ADV(p);
MB_PTR_ADV(s);
}
else
#endif
{
++p;
++s;
@@ -3426,7 +3386,6 @@ ins_compl_files(
wstart = ptr;
/* Find end of the word. */
#ifdef FEAT_MBYTE
if (has_mbyte)
/* Japanese words may have characters in
* different classes, only separate words
@@ -3440,7 +3399,6 @@ ins_compl_files(
ptr += l;
}
else
#endif
ptr = find_word_end(ptr);
/* Add the word. Skip the regexp match. */
@@ -3475,12 +3433,10 @@ ins_compl_files(
char_u *
find_word_start(char_u *ptr)
{
#ifdef FEAT_MBYTE
if (has_mbyte)
while (*ptr != NUL && *ptr != '\n' && mb_get_class(ptr) <= 1)
ptr += (*mb_ptr2len)(ptr);
else
#endif
while (*ptr != NUL && *ptr != '\n' && !vim_iswordc(*ptr))
++ptr;
return ptr;
@@ -3493,7 +3449,6 @@ find_word_start(char_u *ptr)
char_u *
find_word_end(char_u *ptr)
{
#ifdef FEAT_MBYTE
int start_class;
if (has_mbyte)
@@ -3508,7 +3463,6 @@ find_word_end(char_u *ptr)
}
}
else
#endif
while (vim_iswordc(*ptr))
++ptr;
return ptr;
@@ -3719,13 +3673,10 @@ ins_compl_len(void)
static void
ins_compl_addleader(int c)
{
#ifdef FEAT_MBYTE
int cc;
#endif
if (stop_arrow() == FAIL)
return;
#ifdef FEAT_MBYTE
if (has_mbyte && (cc = (*mb_char2len)(c)) > 1)
{
char_u buf[MB_MAXBYTES + 1];
@@ -3737,7 +3688,6 @@ ins_compl_addleader(int c)
AppendToRedobuff(buf);
}
else
#endif
{
ins_char(c);
if (compl_opt_refresh_always)
@@ -4155,10 +4105,8 @@ ins_compl_fixRedoBufForLeader(char_u *ptr_arg)
p = compl_orig_text;
for (len = 0; p[len] != NUL && p[len] == ptr[len]; ++len)
;
#ifdef FEAT_MBYTE
if (len > 0)
len -= (*mb_head_off)(p, p + len);
#endif
for (p += len; *p != NUL; MB_PTR_ADV(p))
AppendCharToRedobuff(K_BS);
}
@@ -5416,25 +5364,14 @@ ins_complete(int c, int enable_pum)
return FAIL;
if (!vim_iswordp(line + compl_col)
|| (compl_col > 0
&& (
#ifdef FEAT_MBYTE
vim_iswordp(mb_prevptr(line, line + compl_col))
#else
vim_iswordc(line[compl_col - 1])
#endif
)))
&& (vim_iswordp(mb_prevptr(line, line + compl_col)))))
prefix = (char_u *)"";
STRCPY((char *)compl_pattern, prefix);
(void)quote_meta(compl_pattern + STRLEN(prefix),
line + compl_col, compl_length);
}
else if (--startcol < 0 ||
#ifdef FEAT_MBYTE
!vim_iswordp(mb_prevptr(line, line + startcol + 1))
#else
!vim_iswordc(line[startcol])
#endif
)
else if (--startcol < 0
|| !vim_iswordp(mb_prevptr(line, line + startcol + 1)))
{
/* Match any word of at least two chars */
compl_pattern = vim_strsave((char_u *)"\\<\\k\\k");
@@ -5445,7 +5382,6 @@ ins_complete(int c, int enable_pum)
}
else
{
#ifdef FEAT_MBYTE
/* Search the point of change class of multibyte character
* or not a word single byte character backward. */
if (has_mbyte)
@@ -5465,7 +5401,6 @@ ins_complete(int c, int enable_pum)
}
}
else
#endif
while (--startcol >= 0 && vim_iswordc(line[startcol]))
;
compl_col += ++startcol;
@@ -5956,7 +5891,6 @@ quote_meta(char_u *dest, char_u *src, int len)
}
if (dest != NULL)
*dest++ = *src;
# ifdef FEAT_MBYTE
/* Copy remaining bytes of a multibyte character. */
if (has_mbyte)
{
@@ -5972,7 +5906,6 @@ quote_meta(char_u *dest, char_u *src, int len)
*dest++ = *src;
}
}
# endif
}
if (dest != NULL)
*dest = NUL;
@@ -5995,9 +5928,7 @@ get_literal(void)
int i;
int hex = FALSE;
int octal = FALSE;
#ifdef FEAT_MBYTE
int unicode = 0;
#endif
if (got_int)
return Ctrl_C;
@@ -6022,28 +5953,18 @@ get_literal(void)
{
nc = plain_vgetc();
#ifdef FEAT_CMDL_INFO
if (!(State & CMDLINE)
# ifdef FEAT_MBYTE
&& MB_BYTE2LEN_CHECK(nc) == 1
# endif
)
if (!(State & CMDLINE) && MB_BYTE2LEN_CHECK(nc) == 1)
add_to_showcmd(nc);
#endif
if (nc == 'x' || nc == 'X')
hex = TRUE;
else if (nc == 'o' || nc == 'O')
octal = TRUE;
#ifdef FEAT_MBYTE
else if (nc == 'u' || nc == 'U')
unicode = nc;
#endif
else
{
if (hex
#ifdef FEAT_MBYTE
|| unicode != 0
#endif
)
if (hex || unicode != 0)
{
if (!vim_isxdigit(nc))
break;
@@ -6065,11 +5986,7 @@ get_literal(void)
++i;
}
if (cc > 255
#ifdef FEAT_MBYTE
&& unicode == 0
#endif
)
if (cc > 255 && unicode == 0)
cc = 255; /* limit range to 0-255 */
nc = 0;
@@ -6078,13 +5995,11 @@ get_literal(void)
if (i >= 2)
break;
}
#ifdef FEAT_MBYTE
else if (unicode) /* Unicode: up to four or eight chars */
{
if ((unicode == 'u' && i >= 4) || (unicode == 'U' && i >= 8))
break;
}
#endif
else if (i >= 3) /* decimal or octal: up to three chars */
break;
}
@@ -6104,11 +6019,9 @@ get_literal(void)
if (cc == 0) /* NUL is stored as NL */
cc = '\n';
#ifdef FEAT_MBYTE
if (enc_dbcs && (cc & 0xff) == 0)
cc = '?'; /* don't accept an illegal DBCS char, the NUL in the
second byte will cause trouble! */
#endif
--no_mapping;
#ifdef FEAT_GUI
@@ -6179,11 +6092,7 @@ insert_special(
# define ISSPECIAL(c) ((c) < ' ' || (c) >= DEL || (c) == '0' || (c) == '^')
#endif
#ifdef FEAT_MBYTE
# define WHITECHAR(cc) (VIM_ISWHITE(cc) && (!enc_utf8 || !utf_iscomposing(utf_ptr2char(ml_get_cursor() + 1))))
#else
# define WHITECHAR(cc) VIM_ISWHITE(cc)
#endif
#define WHITECHAR(cc) (VIM_ISWHITE(cc) && (!enc_utf8 || !utf_iscomposing(utf_ptr2char(ml_get_cursor() + 1))))
/*
* "flags": INSCHAR_FORMAT - force formatting
@@ -6340,9 +6249,7 @@ insertchar(
#endif
if ( !ISSPECIAL(c)
#ifdef FEAT_MBYTE
&& (!has_mbyte || (*mb_char2len)(c) == 1)
#endif
&& !has_insertcharpre()
&& vpeekc() != NUL
&& !(State & REPLACE_FLAG)
@@ -6373,9 +6280,7 @@ insertchar(
*/
while ( (c = vpeekc()) != NUL
&& !ISSPECIAL(c)
#ifdef FEAT_MBYTE
&& (!has_mbyte || MB_BYTE2LEN_CHECK(c) == 1)
#endif
&& i < INPUT_BUFLEN
# ifdef FEAT_FKMAP
&& !(p_fkmap && KeyTyped) /* Farsi mode mapping moves cursor */
@@ -6412,7 +6317,6 @@ insertchar(
}
else
{
#ifdef FEAT_MBYTE
int cc;
if (has_mbyte && (cc = (*mb_char2len)(c)) > 1)
@@ -6425,7 +6329,6 @@ insertchar(
AppendCharToRedobuff(c);
}
else
#endif
{
ins_char(c);
if (flags & INSCHAR_CTRLV)
@@ -6454,9 +6357,7 @@ internal_format(
int save_char = NUL;
int haveto_redraw = FALSE;
int fo_ins_blank = has_format_option(FO_INS_BLANK);
#ifdef FEAT_MBYTE
int fo_multibyte = has_format_option(FO_MBYTE_BREAK);
#endif
int fo_white_par = has_format_option(FO_WHITE_PAR);
int first_line = TRUE;
#ifdef FEAT_COMMENTS
@@ -6613,7 +6514,6 @@ internal_format(
if (curwin->w_cursor.col <= (colnr_T)wantcol)
break;
}
#ifdef FEAT_MBYTE
else if (cc >= 0x100 && fo_multibyte)
{
/* Break after or before a multi-byte character. */
@@ -6660,7 +6560,6 @@ internal_format(
if (curwin->w_cursor.col <= (colnr_T)wantcol)
break;
}
#endif
if (curwin->w_cursor.col == 0)
break;
dec_cursor();
@@ -7350,7 +7249,6 @@ free_last_insert(void)
char_u *
add_char2buf(int c, char_u *s)
{
#ifdef FEAT_MBYTE
char_u temp[MB_MAXBYTES + 1];
int i;
int len;
@@ -7359,7 +7257,6 @@ add_char2buf(int c, char_u *s)
for (i = 0; i < len; ++i)
{
c = temp[i];
#endif
/* Need to escape K_SPECIAL and CSI like in the typeahead buffer. */
if (c == K_SPECIAL)
{
@@ -7377,9 +7274,7 @@ add_char2buf(int c, char_u *s)
#endif
else
*s++ = c;
#ifdef FEAT_MBYTE
}
#endif
return s;
}
@@ -7435,13 +7330,8 @@ oneright(void)
/* Adjust for multi-wide char (excluding TAB) */
ptr = ml_get_cursor();
coladvance(getviscol() + ((*ptr != TAB && vim_isprintc(
# ifdef FEAT_MBYTE
(*mb_ptr2char)(ptr)
# else
*ptr
# endif
))
coladvance(getviscol() + ((*ptr != TAB
&& vim_isprintc((*mb_ptr2char)(ptr)))
? ptr2cells(ptr) : 1));
curwin->w_set_curswant = TRUE;
/* Return OK if the cursor moved, FAIL otherwise (at window edge). */
@@ -7454,11 +7344,9 @@ oneright(void)
if (*ptr == NUL)
return FAIL; /* already at the very end */
#ifdef FEAT_MBYTE
if (has_mbyte)
l = (*mb_ptr2len)(ptr);
else
#endif
l = 1;
/* move "l" bytes right, but don't end up on the NUL, unless 'virtualedit'
@@ -7499,10 +7387,7 @@ oneleft(void)
* 'breakindent' is not set and there are no multi-byte
* characters */
if ((*p_sbr == NUL && !curwin->w_p_bri
# ifdef FEAT_MBYTE
&& !has_mbyte
# endif
) || getviscol() < v)
&& !has_mbyte) || getviscol() < v)
break;
++width;
}
@@ -7516,13 +7401,8 @@ oneleft(void)
/* Adjust for multi-wide char (not a TAB) */
ptr = ml_get_cursor();
if (*ptr != TAB && vim_isprintc(
# ifdef FEAT_MBYTE
(*mb_ptr2char)(ptr)
# else
*ptr
# endif
) && ptr2cells(ptr) > 1)
if (*ptr != TAB && vim_isprintc((*mb_ptr2char)(ptr))
&& ptr2cells(ptr) > 1)
curwin->w_cursor.coladd = 0;
}
@@ -7537,12 +7417,10 @@ oneleft(void)
curwin->w_set_curswant = TRUE;
--curwin->w_cursor.col;
#ifdef FEAT_MBYTE
/* if the character on the left of the current cursor is a multi-byte
* character, move to its first byte */
if (has_mbyte)
mb_adjust_cursor();
#endif
return OK;
}
@@ -7829,7 +7707,6 @@ replace_push(
++replace_stack_nr;
}
#if defined(FEAT_MBYTE) || defined(PROTO)
/*
* Push a character onto the replace stack. Handles a multi-byte character in
* reverse byte order, so that the first byte is popped off first.
@@ -7845,7 +7722,6 @@ replace_push_mb(char_u *p)
replace_push(p[j]);
return l;
}
#endif
/*
* Pop one item from the replace stack.
@@ -7893,17 +7769,12 @@ replace_pop_ins(void)
State = NORMAL; /* don't want REPLACE here */
while ((cc = replace_pop()) > 0)
{
#ifdef FEAT_MBYTE
mb_replace_pop_ins(cc);
#else
ins_char(cc);
#endif
dec_cursor();
}
State = oldState;
}
#ifdef FEAT_MBYTE
/*
* Insert bytes popped from the replace stack. "cc" is the first byte. If it
* indicates a multi-byte char, pop the other bytes too.
@@ -7956,7 +7827,6 @@ mb_replace_pop_ins(int cc)
}
}
}
#endif
/*
* make the replace stack empty
@@ -8012,7 +7882,6 @@ replace_do_bs(int limit_col)
getvcol(curwin, &curwin->w_cursor, NULL, &start_vcol, NULL);
orig_vcols = chartabsize(ml_get_cursor(), start_vcol);
}
#ifdef FEAT_MBYTE
if (has_mbyte)
{
(void)del_char_after_col(limit_col);
@@ -8021,7 +7890,6 @@ replace_do_bs(int limit_col)
replace_push(cc);
}
else
#endif
{
pchar_cursor(cc);
if (State & VREPLACE_FLAG)
@@ -8038,9 +7906,7 @@ replace_do_bs(int limit_col)
for (i = 0; i < ins_len; ++i)
{
vcol += chartabsize(p + i, vcol);
#ifdef FEAT_MBYTE
i += (*mb_ptr2len)(p) - 1;
#endif
}
vcol -= start_vcol;
@@ -8329,7 +8195,6 @@ in_cinkeys(
/* Just completed a word, check if it starts with "look".
* search back for the start of a word. */
line = ml_get_curline();
# ifdef FEAT_MBYTE
if (has_mbyte)
{
char_u *n;
@@ -8342,7 +8207,6 @@ in_cinkeys(
}
}
else
# endif
for (s = line + curwin->w_cursor.col; s > line; --s)
if (!vim_iswordc(s[-1]))
break;
@@ -8823,11 +8687,9 @@ ins_esc(
#endif
{
--curwin->w_cursor.col;
#ifdef FEAT_MBYTE
/* Correct cursor for multi-byte character. */
if (has_mbyte)
mb_adjust_cursor();
#endif
}
}
@@ -9137,9 +8999,7 @@ ins_bs(
int did_backspace = FALSE;
int in_indent;
int oldState;
#ifdef FEAT_MBYTE
int cpc[MAX_MCO]; /* composing characters */
#endif
/*
* can't delete anything in an empty file
@@ -9287,11 +9147,7 @@ ins_bs(
while (cc > 0)
{
save_col = curwin->w_cursor.col;
#ifdef FEAT_MBYTE
mb_replace_pop_ins(cc);
#else
ins_char(cc);
#endif
curwin->w_cursor.col = save_col;
cc = replace_pop();
}
@@ -9413,12 +9269,10 @@ ins_bs(
*/
else
{
#ifdef FEAT_MBYTE
int cclass = 0, prev_cclass = 0;
if (has_mbyte)
cclass = mb_get_class(ml_get_cursor());
#endif
do
{
#ifdef FEAT_RIGHTLEFT
@@ -9427,14 +9281,12 @@ ins_bs(
dec_cursor();
cc = gchar_cursor();
#ifdef FEAT_MBYTE
/* look multi-byte character class */
if (has_mbyte)
{
prev_cclass = cclass;
cclass = mb_get_class(ml_get_cursor());
}
#endif
/* start of word? */
if (mode == BACKSPACE_WORD && !vim_isspace(cc))
@@ -9445,10 +9297,7 @@ ins_bs(
/* end of word? */
else if (mode == BACKSPACE_WORD_NOT_SPACE
&& ((vim_isspace(cc) || vim_iswordc(cc) != temp)
#ifdef FEAT_MBYTE
|| prev_cclass != cclass
#endif
))
|| prev_cclass != cclass))
{
#ifdef FEAT_RIGHTLEFT
if (!revins_on)
@@ -9464,12 +9313,9 @@ ins_bs(
replace_do_bs(-1);
else
{
#ifdef FEAT_MBYTE
if (enc_utf8 && p_deco)
(void)utfc_ptr2char(ml_get_cursor(), cpc);
#endif
(void)del_char(FALSE);
#ifdef FEAT_MBYTE
/*
* If there are combining characters and 'delcombine' is set
* move the cursor back. Don't back up before the base
@@ -9477,7 +9323,6 @@ ins_bs(
*/
if (enc_utf8 && p_deco && cpc[0] != NUL)
inc_cursor();
#endif
#ifdef FEAT_RIGHTLEFT
if (revins_chars)
{
@@ -9713,11 +9558,9 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
// won't get the end sequence.
break;
#ifdef FEAT_MBYTE
if (has_mbyte)
idx += (*mb_char2bytes)(c, buf + idx);
else
#endif
buf[idx++] = c;
buf[idx] = NUL;
if (end != NULL && STRNCMP(buf, end, idx) == 0)
@@ -9760,11 +9603,9 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
case PASTE_ONE_CHAR:
if (ret_char == -1)
{
#ifdef FEAT_MBYTE
if (has_mbyte)
ret_char = (*mb_ptr2char)(buf);
else
#endif
ret_char = buf[0];
}
break;
@@ -9972,11 +9813,9 @@ ins_right(
else
#endif
{
#ifdef FEAT_MBYTE
if (has_mbyte)
curwin->w_cursor.col += (*mb_ptr2len)(ml_get_cursor());
else
#endif
++curwin->w_cursor.col;
}
@@ -10590,11 +10429,7 @@ ins_copychar(linenr_T lnum)
if ((colnr_T)temp > curwin->w_virtcol)
ptr = prev_ptr;
#ifdef FEAT_MBYTE
c = (*mb_ptr2char)(ptr);
#else
c = *ptr;
#endif
if (c == NUL)
vim_beep(BO_COPY);
return c;
@@ -10773,11 +10608,9 @@ do_insert_char_pre(int c)
if (!has_insertcharpre())
return NULL;
# ifdef FEAT_MBYTE
if (has_mbyte)
buf[(*mb_char2bytes)(c, buf)] = NUL;
else
# endif
{
buf[0] = c;
buf[1] = NUL;