diff options
Diffstat (limited to 'src/getchar.c')
-rw-r--r-- | src/getchar.c | 68 |
1 files changed, 2 insertions, 66 deletions
diff --git a/src/getchar.c b/src/getchar.c index 0f8197944..ff1b06b02 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -291,14 +291,11 @@ add_num_buff(buffheader_T *buf, long n) static void add_char_buff(buffheader_T *buf, int c) { -#ifdef FEAT_MBYTE char_u bytes[MB_MAXBYTES + 1]; int len; int i; -#endif char_u temp[4]; -#ifdef FEAT_MBYTE if (IS_SPECIAL(c)) len = 1; else @@ -307,7 +304,6 @@ add_char_buff(buffheader_T *buf, int c) { if (!IS_SPECIAL(c)) c = bytes[i]; -#endif if (IS_SPECIAL(c) || c == K_SPECIAL || c == NUL) { @@ -333,9 +329,7 @@ add_char_buff(buffheader_T *buf, int c) temp[1] = NUL; } add_buff(buf, temp, -1L); -#ifdef FEAT_MBYTE } -#endif } /* First read ahead buffer. Used for translated commands. */ @@ -596,12 +590,10 @@ AppendToRedobuffLit( break; /* Handle a special or multibyte character. */ -#ifdef FEAT_MBYTE if (has_mbyte) /* Handle composing chars separately. */ c = mb_cptr2char_adv(&s); else -#endif c = *s++; if (c < ' ' || c == DEL || (*s == NUL && (c == '0' || c == '^'))) add_char_buff(&redobuff, Ctrl_V); @@ -686,11 +678,7 @@ stuffReadbuffSpec(char_u *s) } else { -#ifdef FEAT_MBYTE c = mb_ptr2char_adv(&s); -#else - c = *s++; -#endif if (c == CAR || c == NL || c == ESC) c = ' '; stuffcharReadbuff(c); @@ -732,11 +720,9 @@ read_redo(int init, int old_redo) static buffblock_T *bp; static char_u *p; int c; -#ifdef FEAT_MBYTE int n; char_u buf[MB_MAXBYTES + 1]; int i; -#endif if (init) { @@ -752,7 +738,6 @@ read_redo(int init, int old_redo) if ((c = *p) != NUL) { /* Reverse the conversion done by add_char_buff() */ -#ifdef FEAT_MBYTE /* For a multi-byte character get all the bytes and return the * converted character. */ if (has_mbyte && (c != K_SPECIAL || p[1] == KS_SPECIAL)) @@ -760,7 +745,6 @@ read_redo(int init, int old_redo) else n = 1; for (i = 0; ; ++i) -#endif { if (c == K_SPECIAL) /* special key or escaped K_SPECIAL */ { @@ -776,7 +760,6 @@ read_redo(int init, int old_redo) bp = bp->b_next; p = bp->b_str; } -#ifdef FEAT_MBYTE buf[i] = c; if (i == n - 1) /* last byte of a character */ { @@ -787,7 +770,6 @@ read_redo(int init, int old_redo) c = *p; if (c == NUL) /* cannot happen? */ break; -#endif } } @@ -1093,11 +1075,7 @@ ins_typebuf( void ins_char_typebuf(int c) { -#ifdef FEAT_MBYTE char_u buf[MB_MAXBYTES + 1]; -#else - char_u buf[4]; -#endif if (IS_SPECIAL(c)) { buf[0] = K_SPECIAL; @@ -1106,14 +1084,7 @@ ins_char_typebuf(int c) buf[3] = NUL; } else - { -#ifdef FEAT_MBYTE buf[(*mb_char2bytes)(c, buf)] = NUL; -#else - buf[0] = c; - buf[1] = NUL; -#endif - } (void)ins_typebuf(buf, KeyNoremap, 0, !KeyTyped, cmd_silent); } @@ -1579,11 +1550,9 @@ updatescript(int c) vgetc(void) { int c, c2; -#ifdef FEAT_MBYTE int n; char_u buf[MB_MAXBYTES + 1]; int i; -#endif #ifdef FEAT_EVAL /* Do garbage collection when garbagecollect() was called previously and @@ -1763,7 +1732,6 @@ vgetc(void) case K_XRIGHT: c = K_RIGHT; break; } -#ifdef FEAT_MBYTE /* For a multi-byte character get all the bytes and return the * converted character. * Note: This will loop until enough bytes are received! @@ -1794,7 +1762,6 @@ vgetc(void) --no_mapping; c = (*mb_ptr2char)(buf); } -#endif break; } @@ -2212,7 +2179,6 @@ vgetorpeek(int advance) break; } -#ifdef FEAT_MBYTE /* Don't allow mapping the first byte(s) of a * multi-byte char. Happens when mapping * <M-a> and then changing 'encoding'. Beware @@ -2225,7 +2191,6 @@ vgetorpeek(int advance) && MB_BYTE2LEN(c1) > MB_PTR2LEN(p2)) mlen = 0; } -#endif /* * Check an entry whether it matches. * - Full match: mlen == keylen @@ -2685,38 +2650,29 @@ vgetorpeek(int advance) curwin->w_wcol = vcol; vcol += lbr_chartabsize(ptr, ptr + col, (colnr_T)vcol); -#ifdef FEAT_MBYTE if (has_mbyte) col += (*mb_ptr2len)(ptr + col); else -#endif ++col; } curwin->w_wrow = curwin->w_cline_row + curwin->w_wcol / curwin->w_width; curwin->w_wcol %= curwin->w_width; curwin->w_wcol += curwin_col_off(); -#ifdef FEAT_MBYTE col = 0; /* no correction needed */ -#endif } else { --curwin->w_wcol; -#ifdef FEAT_MBYTE col = curwin->w_cursor.col - 1; -#endif } } else if (curwin->w_p_wrap && curwin->w_wrow) { --curwin->w_wrow; curwin->w_wcol = curwin->w_width - 1; -#ifdef FEAT_MBYTE col = curwin->w_cursor.col - 1; -#endif } -#ifdef FEAT_MBYTE if (has_mbyte && col > 0 && curwin->w_wcol > 0) { /* Correct when the cursor is on the right halve @@ -2726,7 +2682,6 @@ vgetorpeek(int advance) if ((*mb_ptr2cells)(ptr + col) > 1) --curwin->w_wcol; } -#endif } setcursor(); out_flush(); @@ -3434,7 +3389,6 @@ do_map( * Otherwise we won't be able to find the start of it in a * vi-compatible way. */ -#ifdef FEAT_MBYTE if (has_mbyte) { int first, last; @@ -3458,9 +3412,7 @@ do_map( goto theend; } } - else -#endif - if (vim_iswordc(keys[len - 1])) /* ends in keyword char */ + else if (vim_iswordc(keys[len - 1])) // ends in keyword char for (n = 0; n < len - 2; ++n) if (vim_iswordc(keys[n]) != vim_iswordc(keys[len - 2])) { @@ -4458,9 +4410,7 @@ check_abbr( #ifdef FEAT_LOCALMAP mapblock_T *mp2; #endif -#ifdef FEAT_MBYTE int clen = 0; /* length in characters */ -#endif int is_id = TRUE; int vim_abbr; @@ -4480,7 +4430,6 @@ check_abbr( if (col == 0) /* cannot be an abbr. */ return FALSE; -#ifdef FEAT_MBYTE if (has_mbyte) { char_u *p; @@ -4508,7 +4457,6 @@ check_abbr( scol = (int)(p - ptr); } else -#endif { if (!vim_iswordc(ptr[col - 1])) vim_abbr = TRUE; /* Vim added abbr. */ @@ -4601,7 +4549,6 @@ check_abbr( { if (c < ABBR_OFF && (c < ' ' || c > '~')) tb[j++] = Ctrl_V; /* special char needs CTRL-V */ -#ifdef FEAT_MBYTE if (has_mbyte) { /* if ABBR_OFF has been added, remove it here */ @@ -4610,7 +4557,6 @@ check_abbr( j += (*mb_char2bytes)(c, tb + j); } else -#endif tb[j++] = c; } tb[j] = NUL; @@ -4637,10 +4583,8 @@ check_abbr( tb[0] = Ctrl_H; tb[1] = NUL; -#ifdef FEAT_MBYTE if (has_mbyte) len = clen; /* Delete characters instead of bytes */ -#endif while (len-- > 0) /* delete the from string */ (void)ins_typebuf(tb, 1, 0, TRUE, mp->m_silent); return TRUE; @@ -4715,13 +4659,7 @@ vim_strsave_escape_csi( /* Need a buffer to hold up to three times as much. Four in case of an * illegal utf-8 byte: * 0xc0 -> 0xc3 0x80 -> 0xc3 K_SPECIAL KS_SPECIAL KE_FILLER */ - res = alloc((unsigned)(STRLEN(p) * -#ifdef FEAT_MBYTE - 4 -#else - 3 -#endif - ) + 1); + res = alloc((unsigned)(STRLEN(p) * 4) + 1); if (res != NULL) { d = res; @@ -5012,7 +4950,6 @@ put_escstr(FILE *fd, char_u *strstart, int what) for ( ; *str != NUL; ++str) { -#ifdef FEAT_MBYTE char_u *p; /* Check for a multi-byte character, which may contain escaped @@ -5026,7 +4963,6 @@ put_escstr(FILE *fd, char_u *strstart, int what) --str; continue; } -#endif c = *str; /* |