diff options
-rw-r--r-- | src/buffer.c | 29 | ||||
-rw-r--r-- | src/charset.c | 91 | ||||
-rw-r--r-- | src/diff.c | 14 | ||||
-rw-r--r-- | src/digraph.c | 173 | ||||
-rw-r--r-- | src/edit.c | 201 | ||||
-rw-r--r-- | src/eval.c | 14 | ||||
-rw-r--r-- | src/evalfunc.c | 109 | ||||
-rw-r--r-- | src/ex_cmds.c | 60 | ||||
-rw-r--r-- | src/ex_cmds2.c | 13 | ||||
-rw-r--r-- | src/ex_docmd.c | 79 | ||||
-rw-r--r-- | src/ex_getln.c | 86 | ||||
-rw-r--r-- | src/fileio.c | 311 | ||||
-rw-r--r-- | src/fold.c | 4 | ||||
-rw-r--r-- | src/gui.c | 105 | ||||
-rw-r--r-- | src/gui_mac.c | 72 | ||||
-rw-r--r-- | src/gui_photon.c | 16 | ||||
-rw-r--r-- | src/version.c | 2 |
17 files changed, 233 insertions, 1146 deletions
diff --git a/src/buffer.c b/src/buffer.c index fa2e6524b7..14152b7737 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -704,10 +704,8 @@ buf_clear_file(buf_T *buf) buf->b_shortname = FALSE; buf->b_p_eol = TRUE; buf->b_start_eol = TRUE; -#ifdef FEAT_MBYTE buf->b_p_bomb = FALSE; buf->b_start_bomb = FALSE; -#endif buf->b_ml.ml_mfp = NULL; buf->b_ml.ml_flags = ML_EMPTY; /* empty buffer */ #ifdef FEAT_NETBEANS_INTG @@ -940,9 +938,7 @@ free_buffer_stuff( map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */ map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */ #endif -#ifdef FEAT_MBYTE VIM_CLEAR(buf->b_start_fenc); -#endif } /* @@ -2133,9 +2129,7 @@ free_buf_options( { if (free_p_ff) { -#ifdef FEAT_MBYTE clear_string_option(&buf->b_p_fenc); -#endif clear_string_option(&buf->b_p_ff); clear_string_option(&buf->b_p_bh); clear_string_option(&buf->b_p_bt); @@ -2245,9 +2239,7 @@ free_buf_options( clear_string_option(&buf->b_p_lw); #endif clear_string_option(&buf->b_p_bkc); -#ifdef FEAT_MBYTE clear_string_option(&buf->b_p_menc); -#endif } /* @@ -3778,10 +3770,8 @@ maketitle(void) if (len > 100) { len -= 100; -#ifdef FEAT_MBYTE if (has_mbyte) len += (*mb_tail_off)(p, p + len) + 1; -#endif p += len; } STRCPY(icon_str, p); @@ -3939,11 +3929,9 @@ build_stl_str_hl( if (fillchar == 0) fillchar = ' '; -#ifdef FEAT_MBYTE /* Can't handle a multi-byte fill character yet. */ else if (mb_char2len(fillchar) > 1) fillchar = '-'; -#endif // The cursor in windows other than the current one isn't always // up-to-date, esp. because of autocommands and timers. @@ -3973,11 +3961,7 @@ build_stl_str_hl( byteval = 0; } else -#ifdef FEAT_MBYTE byteval = (*mb_ptr2char)(p + wp->w_cursor.col); -#else - byteval = p[wp->w_cursor.col]; -#endif groupdepth = 0; p = out; @@ -4079,7 +4063,6 @@ build_stl_str_hl( if (l > item[groupitem[groupdepth]].maxwid) { /* truncate, remove n bytes of text at the start */ -#ifdef FEAT_MBYTE if (has_mbyte) { /* Find the first character that should be included. */ @@ -4091,17 +4074,15 @@ build_stl_str_hl( } } else -#endif n = (long)(p - t) - item[groupitem[groupdepth]].maxwid + 1; *t = '<'; mch_memmove(t + 1, t + n, (size_t)(p - (t + n))); p = p - n + 1; -#ifdef FEAT_MBYTE - /* Fill up space left over by half a double-wide char. */ + + // Fill up space left over by half a double-wide char. while (++l < item[groupitem[groupdepth]].minwid) *p++ = fillchar; -#endif /* correct the start of the items for the truncation */ for (l = groupitem[groupdepth] + 1; l < curitem; l++) @@ -4483,14 +4464,12 @@ build_stl_str_hl( if (l > maxwid) { while (l >= maxwid) -#ifdef FEAT_MBYTE if (has_mbyte) { l -= ptr2cells(t); t += (*mb_ptr2len)(t); } else -#endif l -= byte2cells(*t++); if (p + 1 >= out + outlen) break; @@ -4610,7 +4589,6 @@ build_stl_str_hl( if (width - vim_strsize(s) >= maxwidth) { /* Truncation mark is beyond max length */ -#ifdef FEAT_MBYTE if (has_mbyte) { s = out; @@ -4627,7 +4605,6 @@ build_stl_str_hl( *s++ = fillchar; } else -#endif s = out + maxwidth - 1; for (l = 0; l < itemcnt; l++) if (item[l].start > s) @@ -4638,7 +4615,6 @@ build_stl_str_hl( } else { -#ifdef FEAT_MBYTE if (has_mbyte) { n = 0; @@ -4649,7 +4625,6 @@ build_stl_str_hl( } } else -#endif n = width - maxwidth + 1; p = s + n; STRMOVE(s + 1, p); diff --git a/src/charset.c b/src/charset.c index 0280954538..70e3bc2dcb 100644 --- a/src/charset.c +++ b/src/charset.c @@ -9,12 +9,10 @@ #include "vim.h" -#ifdef FEAT_MBYTE -# if defined(HAVE_WCHAR_H) -# include <wchar.h> /* for towupper() and towlower() */ -# endif -static int win_nolbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp); +#if defined(HAVE_WCHAR_H) +# include <wchar.h> /* for towupper() and towlower() */ #endif +static int win_nolbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp); static unsigned nr2hex(unsigned c); @@ -109,7 +107,6 @@ buf_init_chartab( #endif while (c < 256) { -#ifdef FEAT_MBYTE /* UTF-8: bytes 0xa0 - 0xff are printable (latin1) */ if (enc_utf8 && c >= 0xa0) g_chartab[c++] = CT_PRINT_CHAR + 1; @@ -120,26 +117,22 @@ buf_init_chartab( else if (enc_dbcs != 0 && MB_BYTE2LEN(c) == 2) g_chartab[c++] = CT_PRINT_CHAR + 2; else -#endif /* the rest is unprintable by default */ g_chartab[c++] = (dy_flags & DY_UHEX) ? 4 : 2; } -#ifdef FEAT_MBYTE /* Assume that every multi-byte char is a filename character. */ for (c = 1; c < 256; ++c) if ((enc_dbcs != 0 && MB_BYTE2LEN(c) > 1) || (enc_dbcs == DBCS_JPNU && c == 0x8e) || (enc_utf8 && c >= 0xa0)) g_chartab[c] |= CT_FNAME_CHAR; -#endif } /* * Init word char flags all to FALSE */ vim_memset(buf->b_chartab, 0, (size_t)32); -#ifdef FEAT_MBYTE if (enc_dbcs != 0) for (c = 0; c < 256; ++c) { @@ -147,7 +140,6 @@ buf_init_chartab( if (MB_BYTE2LEN(c) == 2) SET_CHARTAB(buf, c); } -#endif #ifdef FEAT_LISP /* @@ -184,11 +176,9 @@ buf_init_chartab( if (VIM_ISDIGIT(*p)) c = getdigits(&p); else -#ifdef FEAT_MBYTE if (has_mbyte) c = mb_ptr2char_adv(&p); else -#endif c = *p++; c2 = -1; if (*p == '-' && p[1] != NUL) @@ -197,11 +187,9 @@ buf_init_chartab( if (VIM_ISDIGIT(*p)) c2 = getdigits(&p); else -#ifdef FEAT_MBYTE if (has_mbyte) c2 = mb_ptr2char_adv(&p); else -#endif c2 = *p++; } if (c <= 0 || c >= 256 || (c2 < c && c2 != -1) || c2 >= 256 @@ -253,13 +241,9 @@ buf_init_chartab( || (p_altkeymap && (F_isalpha(c) || F_isdigit(c))) #endif - ) -#ifdef FEAT_MBYTE - /* For double-byte we keep the cell width, so - * that we can detect it from the first byte. */ - && !(enc_dbcs && MB_BYTE2LEN(c) == 2) -#endif - ) + // For double-byte we keep the cell width, so + // that we can detect it from the first byte. + ) && !(enc_dbcs && MB_BYTE2LEN(c) == 2)) { if (tilde) { @@ -322,12 +306,10 @@ trans_characters( room = bufsize - len; while (*buf != 0) { -# ifdef FEAT_MBYTE /* Assume a multi-byte character doesn't need translation. */ if (has_mbyte && (trs_len = (*mb_ptr2len)(buf)) > 1) len -= trs_len; else -# endif { trs = transchar_byte(*buf); trs_len = (int)STRLEN(trs); @@ -356,12 +338,9 @@ transstr(char_u *s) { char_u *res; char_u *p; -#ifdef FEAT_MBYTE int l, len, c; char_u hexbuf[11]; -#endif -#ifdef FEAT_MBYTE if (has_mbyte) { /* Compute the length of the result, taking account of unprintable @@ -394,7 +373,6 @@ transstr(char_u *s) res = alloc((unsigned)(len + 1)); } else -#endif res = alloc((unsigned)(vim_strsize(s) + 1)); if (res != NULL) { @@ -402,7 +380,6 @@ transstr(char_u *s) p = s; while (*p != NUL) { -#ifdef FEAT_MBYTE if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) { c = (*mb_ptr2char)(p); @@ -413,7 +390,6 @@ transstr(char_u *s) p += l; } else -#endif STRCAT(res, transchar_byte(*p++)); } } @@ -468,7 +444,6 @@ str_foldcase( i = 0; while (STR_CHAR(i) != NUL) { -#ifdef FEAT_MBYTE if (enc_utf8 || (has_mbyte && MB_BYTE2LEN(STR_CHAR(i)) > 1)) { if (enc_utf8) @@ -520,7 +495,6 @@ str_foldcase( i += (*mb_ptr2len)(STR_PTR(i)); } else -#endif { if (buf == NULL) GA_CHAR(i) = TOLOWER_LOC(GA_CHAR(i)); @@ -580,7 +554,6 @@ transchar(int c) return transchar_buf; } -#if defined(FEAT_MBYTE) || defined(PROTO) /* * Like transchar(), but called with a byte instead of a character. Checks * for an illegal UTF-8 byte. @@ -595,7 +568,6 @@ transchar_byte(int c) } return transchar(c); } -#endif /* * Convert non-printable character to two or more printable characters in @@ -632,12 +604,10 @@ transchar_nonprint(char_u *buf, int c) buf[2] = NUL; } -#ifdef FEAT_MBYTE else if (enc_utf8 && c >= 0x80) { transchar_hex(buf, c); } -#endif #ifndef EBCDIC else if (c >= ' ' + 0x80 && c <= '~' + 0x80) /* 0xa0 - 0xfe */ { @@ -675,13 +645,11 @@ transchar_hex(char_u *buf, int c) int i = 0; buf[0] = '<'; -#ifdef FEAT_MBYTE if (c > 255) { buf[++i] = nr2hex((unsigned)c >> 12); buf[++i] = nr2hex((unsigned)c >> 8); } -#endif buf[++i] = nr2hex((unsigned)c >> 4); buf[++i] = nr2hex((unsigned)c); buf[++i] = '>'; @@ -712,10 +680,8 @@ nr2hex(unsigned c) int byte2cells(int b) { -#ifdef FEAT_MBYTE if (enc_utf8 && b >= 0x80) return 0; -#endif return (g_chartab[b] & CT_CELL_MASK); } @@ -729,7 +695,6 @@ char2cells(int c) { if (IS_SPECIAL(c)) return char2cells(K_SECOND(c)) + 2; -#ifdef FEAT_MBYTE if (c >= 0x80) { /* UTF-8: above 0x80 need to check the value */ @@ -744,7 +709,6 @@ char2cells(int c) return 2; } } -#endif return (g_chartab[c & 0xff] & CT_CELL_MASK); } @@ -755,12 +719,10 @@ char2cells(int c) int ptr2cells(char_u *p) { -#ifdef FEAT_MBYTE /* For UTF-8 we need to look at more bytes if the first byte is >= 0x80. */ if (enc_utf8 && *p >= 0x80) return utf_ptr2cells(p); /* For DBCS we can tell the cell count from the first byte. */ -#endif return (g_chartab[*p] & CT_CELL_MASK); } @@ -784,8 +746,6 @@ vim_strnsize(char_u *s, int len) int size = 0; while (*s != NUL && --len >= 0) - { -#ifdef FEAT_MBYTE if (has_mbyte) { int l = (*mb_ptr2len)(s); @@ -795,9 +755,8 @@ vim_strnsize(char_u *s, int len) len -= l - 1; } else -#endif size += byte2cells(*s++); - } + return size; } @@ -907,12 +866,10 @@ vim_iswordc_buf(int c, buf_T *buf) { if (c >= 0x100) { -#ifdef FEAT_MBYTE if (enc_dbcs != 0) return dbcs_class((unsigned)c >> 8, (unsigned)(c & 0xff)) >= 2; if (enc_utf8) return utf_class_buf(c, buf) >= 2; -#endif return FALSE; } return (c > 0 && GET_CHARTAB(buf, c) != 0); @@ -932,10 +889,8 @@ vim_iswordp_buf(char_u *p, buf_T *buf) { int c = *p; -#ifdef FEAT_MBYTE if (has_mbyte && MB_BYTE2LEN(c) > 1) c = (*mb_ptr2char)(p); -#endif return vim_iswordc_buf(c, buf); } @@ -973,10 +928,8 @@ vim_isfilec_or_wc(int c) int vim_isprintc(int c) { -#ifdef FEAT_MBYTE if (enc_utf8 && c >= 0x100) return utf_printable(c); -#endif return (c >= 0x100 || (c > 0 && (g_chartab[c] & CT_PRINT_CHAR))); } @@ -987,12 +940,10 @@ vim_isprintc(int c) int vim_isprintc_strict(int c) { -#ifdef FEAT_MBYTE if (enc_dbcs != 0 && c < 0x100 && MB_BYTE2LEN(c) > 1) return FALSE; if (enc_utf8 && c >= 0x100) return utf_printable(c); -#endif return (c >= 0x100 || (c > 0 && (g_chartab[c] & CT_PRINT_CHAR))); } @@ -1009,10 +960,8 @@ lbr_chartabsize( if (!curwin->w_p_lbr && *p_sbr == NUL && !curwin->w_p_bri) { #endif -#ifdef FEAT_MBYTE if (curwin->w_p_wrap) return win_nolbr_chartabsize(curwin, s, col, NULL); -#endif RET_WIN_BUF_CHARTABSIZE(curwin, curbuf, s, col) #ifdef FEAT_LINEBREAK } @@ -1058,11 +1007,7 @@ win_lbr_chartabsize( colnr_T col_adj = 0; /* col + screen size of tab */ colnr_T colmax; int added; -# ifdef FEAT_MBYTE int mb_added = 0; -# else -# define mb_added 0 -# endif int numberextra; char_u *ps; int tab_corr = (*s == TAB); @@ -1074,10 +1019,8 @@ win_lbr_chartabsize( if (!wp->w_p_lbr && !wp->w_p_bri && *p_sbr == NUL) #endif { -#ifdef FEAT_MBYTE if (wp->w_p_wrap) return win_nolbr_chartabsize(wp, s, col, headp); -#endif RET_WIN_BUF_CHARTABSIZE(wp, wp->w_buffer, s, col) } @@ -1135,14 +1078,12 @@ win_lbr_chartabsize( } } } -# ifdef FEAT_MBYTE else if (has_mbyte && size == 2 && MB_BYTE2LEN(*s) > 1 && wp->w_p_wrap && in_win_border(wp, col)) { ++size; /* Count the ">" in the last column. */ mb_added = 1; } -# endif /* * May have to add something for 'breakindent' and/or 'showbreak' @@ -1210,7 +1151,6 @@ win_lbr_chartabsize( #endif } -#if defined(FEAT_MBYTE) || defined(PROTO) /* * Like win_lbr_chartabsize(), except that we know 'linebreak' is off and * 'wrap' is on. This means we need to check for a double-byte character that @@ -1269,7 +1209,6 @@ in_win_border(win_T *wp, colnr_T vcol) return FALSE; return ((vcol - width1) % width2 == width2 - 1); } -#endif /* FEAT_MBYTE */ /* * Get virtual column number of pos. @@ -1310,11 +1249,9 @@ getvcol( if (*ptr == NUL) pos->col = 0; posptr = ptr + pos->col; -#ifdef FEAT_MBYTE if (has_mbyte) /* always start on the first byte */ posptr -= (*mb_head_off)(line, posptr); -#endif } /* @@ -1329,14 +1266,10 @@ getvcol( #endif ) { -#ifndef FEAT_MBYTE head = 0; -#endif for (;;) { -#ifdef FEAT_MBYTE head = 0; -#endif c = *ptr; /* make sure we don't go past the end of the line */ if (c == NUL) @@ -1353,7 +1286,6 @@ getvcol( #endif else { -#ifdef FEAT_MBYTE if (has_mbyte) { /* For utf-8, if the byte is >= 0x80, need to look at @@ -1374,7 +1306,6 @@ getvcol( } } else -#endif incr = g_chartab[c] & CT_CELL_MASK; } @@ -1460,9 +1391,7 @@ getvvcol( colnr_T col; colnr_T coladd; colnr_T endadd; -# ifdef FEAT_MBYTE char_u *ptr; -# endif if (virtual_active()) { @@ -1471,7 +1400,6 @@ getvvcol( coladd = pos->coladd; endadd = 0; -# ifdef FEAT_MBYTE /* Cannot put the cursor on part of a wide character. */ ptr = ml_get_buf(wp->w_buffer, pos->lnum, FALSE); if (pos->col < (colnr_T)STRLEN(ptr)) @@ -1487,7 +1415,6 @@ getvvcol( coladd = 0; } } -# endif col += coladd; if (start != NULL) *start = col; @@ -1684,7 +1611,6 @@ vim_isbdigit(int c) return (c == '0' || c == '1'); } -#if defined(FEAT_MBYTE) || defined(PROTO) /* * Vim's own character class functions. These exist because many library * islower()/toupper() etc. do not work properly: they crash when used with @@ -1797,7 +1723,6 @@ vim_tolower(int c) return TOLOWER_ASC(c); return TOLOWER_LOC(c); } -#endif /* * skiptowhite: skip over text until ' ' or '\t' or NUL. @@ -2077,9 +2002,7 @@ rem_backslash(char_u *str) { #ifdef BACKSLASH_IN_FILENAME return (str[0] == '\\' -# ifdef FEAT_MBYTE && str[1] < 0x80 -# endif && (str[1] == ' ' || (str[1] != NUL && str[1] != '*' diff --git a/src/diff.c b/src/diff.c index ed63f51ee7..d368f96978 100644 --- a/src/diff.c +++ b/src/diff.c @@ -741,12 +741,10 @@ diff_write_buffer(buf_T *buf, diffin_T *din) if (diff_flags & DIFF_ICASE) { int c; - - // xdiff doesn't support ignoring case, fold-case the text. -#ifdef FEAT_MBYTE int orig_len; char_u cbuf[MB_MAXBYTES + 1]; + // xdiff doesn't support ignoring case, fold-case the text. c = PTR2CHAR(s); c = enc_utf8 ? utf_fold(c) : MB_TOLOWER(c); orig_len = MB_PTR2LEN(s); @@ -758,10 +756,6 @@ diff_write_buffer(buf_T *buf, diffin_T *din) s += orig_len; len += orig_len; -#else - c = *s++; - ptr[len++] = TOLOWER_LOC(c); -#endif } else ptr[len++] = *s++; @@ -1946,7 +1940,6 @@ diff_equal_entry(diff_T *dp, int idx1, int idx2) static int diff_equal_char(char_u *p1, char_u *p2, int *len) { -#ifdef FEAT_MBYTE int l = (*mb_ptr2len)(p1); if (l != (*mb_ptr2len)(p2)) @@ -1962,7 +1955,6 @@ diff_equal_char(char_u *p1, char_u *p2, int *len) *len = l; } else -#endif { if ((*p1 != *p2) && (!(diff_flags & DIFF_ICASE) @@ -2400,7 +2392,6 @@ diff_find_change( si_new += l; } } -#ifdef FEAT_MBYTE if (has_mbyte) { /* Move back to first byte of character in both lines (may @@ -2408,7 +2399,6 @@ diff_find_change( si_org -= (*mb_head_off)(line_org, line_org + si_org); si_new -= (*mb_head_off)(line_new, line_new + si_new); } -#endif if (*startp > si_org) *startp = si_org; @@ -2438,10 +2428,8 @@ diff_find_change( { p1 = line_org + ei_org; p2 = line_new + ei_new; -#ifdef FEAT_MBYTE p1 -= (*mb_head_off)(line_org, p1); p2 -= (*mb_head_off)(line_new, p2); -#endif if (!diff_equal_char(p1, p2, &l)) break; ei_org -= l; diff --git a/src/digraph.c b/src/digraph.c index 407b45f835..d936136805 100644 --- a/src/digraph.c +++ b/src/digraph.c @@ -15,11 +15,7 @@ #if defined(FEAT_DIGRAPHS) || defined(PROTO) -#ifdef FEAT_MBYTE typedef int result_T; -#else -typedef char_u result_T; -#endif typedef struct digraph { @@ -38,8 +34,8 @@ static garray_T user_digraphs = {0, 0, (int)sizeof(digr_T), 10, NULL}; * compilers cannot handle them (Amiga SAS/C is the most picky one). */ static digr_T digraphdefault[] = -#ifdef __MINT__ +#ifdef __MINT__ /* * ATARI digraphs */ @@ -320,137 +316,7 @@ static digr_T digraphdefault[] = }; # else -# if defined(MACOS_X) && !defined(FEAT_MBYTE) - - /* - * Macintosh digraphs - */ - {{'a', 't', 64}, /* @ */ - {'A', '"', 128}, /* ~@ XX */ - {'A', 'o', 129}, /* */ - {'C', ',', 130}, /* */ - {'E', '\'', 131}, /* */ - {'N', '~', 132}, /* */ - {'O', '"', 133}, /* */ - {'U', '"', 134}, /* */ - {'a', '\'', 135}, /* ~G XX */ - {'a', '`', 136}, /* ~H XX */ - {'a', '^', 137}, /* */ - {'a', '"', 138}, /* */ - {'a', '~', 139}, /* */ - {'a', 'o', 140}, /* */ - {'c', ',', 141}, /* */ - {'e', '\'', 142}, /* */ - {'e', '`', 143}, /* */ - {'e', '^', 144}, /* */ - {'e', '"', 145}, /* */ - {'i', '\'', 146}, /* */ - {'i', '`', 147}, /* */ - {'i', '^', 148}, /* */ - {'i', '"', 149}, /* */ - {'n', '~', 150}, /* */ - {'o', '\'', 151}, /* */ - {'o', '`', 152}, /* */ - {'o', '^', 153}, /* */ - {'o', '"', 154}, /* */ - {'o', '~', 155}, /* o */ - {'u', '\'', 156}, /* */ - {'u', '`', 157}, /* ~] XX */ - {'u', '^', 158}, /* */ - {'u', '"', 159}, /* */ - {'+', '_', 160}, /* */ - {'~', 'o', 161}, /* */ - {'c', '|', 162}, /* */ - {'$', '$', 163}, /* */ - {'p', 'a', 164}, /* */ - {'.', '.', 165}, /* * */ - {'P', 'P', 166}, /* */ - {'s', 's', 167}, /* */ - {'r', 'O', 168}, /* */ - {'c', 'O', 169}, /* */ - {'T', 'M', 170}, /* */ - {'=', '/', 173}, /* */ - {'A', 'E', 174}, /* */ - {'O', '/', 175}, /* */ - {'0', '0', 176}, /* */ - {'+', '-', 177}, /* */ - {'<', '=', 178}, /* */ - {'>', '=', 179}, /* */ - {'Y', '-', 180}, /* */ - {'j', 'u', 181}, /* */ - {'m', 'u', 181}, /* */ - {'d', 'd', 182}, /* */ - {'S', 'S', 183}, /* */ - {'S', 'I', 183}, /* */ - {'P', 'I', 184}, /* */ - {'p', 'i', 185}, /* */ - {'I', 'I', 186}, /* */ - {'a', '-', 187}, /* */ - {'o', '-', 188}, /* */ - {'O', 'M', 189}, /* */ - {'a', 'e', 190}, /* */ - {'o', '/', 191}, /* */ - {'~', '?', 192}, /* */ - {'~', '!', 193}, /* */ - {'-', ',', 194}, /* */ - {'v', '-', 195}, /* ~H XX */ - {'f', '-', 196}, /* */ - {'~', '~', 197}, /* */ - {'D', 'E', 198}, /* */ - {'<', '<', 199}, /* */ - {'>', '>', 200}, /* */ - {'.', ':', 201}, /* */ - {'A', '`', 203}, /* */ - {'A', '~', 204}, /* */ - {'O', '~', 205}, /* */ - {'O', 'E', 206}, /* */ - {'o', 'e', 207}, /* */ - {'-', '.', 208}, /* - */ - {'-', '-', 209}, /* - */ - {'`', '`', 210}, /* " */ - {'\'', '\'', 211}, /* " */ - {'`', ' ', 212}, /* ' */ - {'\'', ' ', 213}, /* ' */ - {'-', ':', 214}, /* */ - {'D', 'I', 215}, /* */ - {'y', ':', 216}, /* */ - {'Y', ':', 217}, /* */ - {'/', '/', 218}, /* */ - {'E', '=', 219}, /* Euro System >=8.5 */ - {'o', 'x', 219}, /* Currency System <=8.1*/ - {'<', ' ', 220}, /* */ - {'>', ' ', 221}, /* */ - {'f', 'i', 222}, /* */ - {'f', 'l', 223}, /* */ - {'+', '+', 224}, /* */ - {'~', '.', 225}, /* */ - {',', ' ', 226}, /* */ - {',', ',', 227}, /* */ - {'%', '.', 228}, /* */ - {'%', '0', 228}, /* */ - {'A', '^', 229}, /* */ - {'E', '^', 230}, /* */ - {'A', '\'', 231}, /* */ - {'E', '"', 232}, /* */ - {'E', '`', 233}, /* */ - {'I', '\'', 234}, /* */ - {'I', '^', 235}, /* */ - {'I', '"', 236}, /* */ - {'I', '`', 237}, /* */ - {'O', '\'', 238}, /* */ - {'O', '^', 239}, /* */ - {'A', 'P', 240}, /* */ - {'O', '`', 241}, /* */ - {'U', '\'', 242}, /* */ - {'U', '^', 243}, /* */ - {'U', '`', 244}, /* */ - {'i', '.', 245}, /* */ - {NUL, NUL, NUL} - }; - -# else /* !MACOS_X */ - -# ifdef OLD_DIGRAPHS +# ifdef OLD_DIGRAPHS /* * digraphs compatible with Vim 5.x @@ -557,7 +423,7 @@ static digr_T digraphdefault[] = {'y', '"', 255}, /* x XX */ {NUL, NUL, NUL} }; -# else /* OLD_DIGRAPHS */ +# else /* OLD_DIGRAPHS */ /* * digraphs for Unicode from RFC1345 @@ -792,7 +658,6 @@ static digr_T digraphdefault[] = {'y', ':', 0xff}, {'y', '"', 0xff}, // x XX Vim 5.x compatible -# ifdef FEAT_MBYTE # define USE_UNICODE_DIGRAPHS {'A', '-', 0x0100}, @@ -1957,14 +1822,11 @@ static digr_T digraphdefault[] = {'f', 'l', 0xfb02}, {'f', 't', 0xfb05}, {'s', 't', 0xfb06}, -# endif /* FEAT_MBYTE */ {NUL, NUL, NUL} }; -# endif /* OLD_DIGRAPHS */ - -# endif /* Macintosh */ +# endif /* OLD_DIGRAPHS */ # endif /* EBCDIC */ # endif /* !HPUX_DIGRAPHS */ #endif /* !__MINT__ */ @@ -2141,8 +2003,7 @@ getexactdigraph(int char1, int char2, int meta_char) ++dp; } } -#ifdef FEAT_MBYTE -# ifdef USE_UNICODE_DIGRAPHS +#ifdef USE_UNICODE_DIGRAPHS if (retval != 0 && !enc_utf8) { char_u buf[6], *to; @@ -2166,12 +2027,11 @@ getexactdigraph(int char1, int char2, int meta_char) (void)convert_setup(&vc, NULL, NULL); } } -# endif +#endif /* Ignore multi-byte characters when not in multi-byte mode. */ if (!has_mbyte && retval > 0xff) retval = 0; -#endif if (retval == 0) /* digraph deleted or not found */ { @@ -2297,10 +2157,7 @@ listdigraphs(int use_headers) #else if (getexactdigraph(dp->char1, dp->char2, FALSE) == dp->result -# ifdef FEAT_MBYTE - && (has_mbyte || dp->result <= 255) -# endif - ) + && (has_mbyte || dp->result <= 255)) printdigraph(dp, use_headers ? &previous : NULL); #endif ++dp; @@ -2364,11 +2221,7 @@ printdigraph(digr_T *dp, result_T *previous) int list_width; - if ((dy_flags & DY_UHEX) -#ifdef FEAT_MBYTE - || has_mbyte -#endif - ) + if ((dy_flags & DY_UHEX) || has_mbyte) list_width = 13; else list_width = 11; @@ -2404,7 +2257,6 @@ printdigraph(digr_T *dp, result_T *previous) *p = NUL; msg_outtrans(buf); p = buf; -#ifdef FEAT_MBYTE if (has_mbyte) { /* add a space to draw a composing char on */ @@ -2413,7 +2265,6 @@ printdigraph(digr_T *dp, result_T *previous) p += (*mb_char2bytes)(dp->result, p); } else -#endif *p++ = (char_u)dp->result; *p = NUL; msg_outtrans_attr(buf, HL_ATTR(HLF_8)); @@ -2465,21 +2316,15 @@ keymap_init(void) /* Source the keymap file. It will contain a ":loadkeymap" command * which will call ex_loadkeymap() below. */ - buflen = STRLEN(curbuf->b_p_keymap) -# ifdef FEAT_MBYTE - + STRLEN(p_enc) -# endif - + 14; + buflen = STRLEN(curbuf->b_p_keymap) + STRLEN(p_enc) + 14; buf = alloc((unsigned)buflen); if (buf == NULL) return e_outofmem; -# ifdef FEAT_MBYTE /* try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath' */ vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim", curbuf->b_p_keymap, p_enc); if (source_runtime(buf, 0) == FAIL) -# endif { /* try finding "keymap/'keymap'.vim" in 'runtimepath' */ vim_snprintf((char *)buf, buflen, "keymap/%s.vim", diff --git a/src/edit.c b/src/edit.c index 852060bd26..92dbf4cb51 100644 --- a/src/edit.c +++ b/src/edit.c @@ -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 UNUSE |