diff options
-rw-r--r-- | src/nvim/edit.c | 6 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 20 | ||||
-rw-r--r-- | src/nvim/fileio.c | 15 | ||||
-rw-r--r-- | src/nvim/globals.h | 1 | ||||
-rw-r--r-- | src/nvim/mbyte.c | 5 | ||||
-rw-r--r-- | src/nvim/message.c | 12 | ||||
-rw-r--r-- | src/nvim/ops.c | 2 | ||||
-rw-r--r-- | src/nvim/search.c | 37 |
8 files changed, 27 insertions, 71 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 5a21c50fa6..67ac675a14 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -5110,11 +5110,9 @@ int get_literal(void) } } - if (cc == 0) /* NUL is stored as NL */ + if (cc == 0) { // NUL is stored as NL cc = '\n'; - if (enc_dbcs && (cc & 0xff) == 0) - cc = '?'; /* don't accept an illegal DBCS char, the NUL in the - second byte will cause trouble! */ + } --no_mapping; if (nc) diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index cda80dad39..bbec977c74 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -5489,24 +5489,18 @@ uc_check_code( break; case 1: /* Quote, but don't split */ result = STRLEN(eap->arg) + 2; - for (p = eap->arg; *p; ++p) { - if (enc_dbcs != 0 && (*mb_ptr2len)(p) == 2) - /* DBCS can contain \ in a trail byte, skip the - * double-byte character. */ - ++p; - else if (*p == '\\' || *p == '"') - ++result; + for (p = eap->arg; *p; p++) { + if (*p == '\\' || *p == '"') { + result++; + } } if (buf != NULL) { *buf++ = '"'; - for (p = eap->arg; *p; ++p) { - if (enc_dbcs != 0 && (*mb_ptr2len)(p) == 2) - /* DBCS can contain \ in a trail byte, copy the - * double-byte character to avoid escaping. */ - *buf++ = *p++; - else if (*p == '\\' || *p == '"') + for (p = eap->arg; *p; p++) { + if (*p == '\\' || *p == '"') { *buf++ = '\\'; + } *buf++ = *p; } *buf = '"'; diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index ba3625bf95..b9de46efc8 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -5313,9 +5313,7 @@ void forward_slash(char_u *fname) } for (p = fname; *p != NUL; p++) { // The Big5 encoding can have '\' in the trail byte. - if (enc_dbcs != 0 && (*mb_ptr2len)(p) > 1) { - p++; - } else if (*p == '\\') { + if (*p == '\\') { *p = '/'; } } @@ -7615,10 +7613,6 @@ char_u * file_pat_to_reg_pat( #endif default: size++; - if (enc_dbcs != 0 && (*mb_ptr2len)(p) > 1) { - ++p; - ++size; - } break; } } @@ -7739,10 +7733,9 @@ char_u * file_pat_to_reg_pat( reg_pat[i++] = ','; break; default: - if (enc_dbcs != 0 && (*mb_ptr2len)(p) > 1) - reg_pat[i++] = *p++; - else if (allow_dirs != NULL && vim_ispathsep(*p)) - *allow_dirs = TRUE; + if (allow_dirs != NULL && vim_ispathsep(*p)) { + *allow_dirs = true; + } reg_pat[i++] = *p; break; } diff --git a/src/nvim/globals.h b/src/nvim/globals.h index a988af79b2..1e2c6eea59 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -641,7 +641,6 @@ EXTERN int vr_lines_changed INIT(= 0); /* #Lines changed by "gR" so far */ // mbyte flags that used to depend on 'encoding'. These are now deprecated, as // 'encoding' is always "utf-8". Code that use them can be refactored to // remove dead code. -#define enc_dbcs 0 #define enc_utf8 true #define has_mbyte true diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index 1cf045d7e0..5ed2b4c564 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -4,9 +4,8 @@ /// mbyte.c: Code specifically for handling multi-byte characters. /// Multibyte extensions partly by Sung-Hoon Baek /// -/// The encoding used in nvim is always UTF-8. "enc_utf8" and "has_mbyte" is -/// thus always true. "enc_dbcs" is always zero. The 'encoding' option is -/// read-only and always reads "utf-8". +/// Strings internal to Nvim are always encoded as UTF-8 (thus the legacy +/// 'encoding' option is always "utf-8"). /// /// The cell width on the display needs to be determined from the character /// value. Recognizing UTF-8 bytes is easy: 0xxx.xxxx is a single-byte char, diff --git a/src/nvim/message.c b/src/nvim/message.c index b22508c23f..9a0a3565ea 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -281,15 +281,9 @@ msg_strtrunc ( /* Use up to 'showcmd' column. */ room = (int)(Rows - msg_row - 1) * Columns + sc_col - 1; if (len > room && room > 0) { - if (enc_utf8) - /* may have up to 18 bytes per cell (6 per char, up to two - * composing chars) */ - len = (room + 2) * 18; - else if (enc_dbcs == DBCS_JPNU) - /* may have up to 2 bytes per cell for euc-jp */ - len = (room + 2) * 2; - else - len = room + 2; + // may have up to 18 bytes per cell (6 per char, up to two + // composing chars) + len = (room + 2) * 18; buf = xmalloc(len); trunc_string(s, buf, room, len); } diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 674a9244f0..9d9ee0c9e3 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -1974,8 +1974,6 @@ int swapchar(int op_type, pos_T *pos) inc(pos); } - if (enc_dbcs != 0 && c >= 0x100) /* No lower/uppercase letter */ - return FALSE; nc = c; if (mb_islower(c)) { if (op_type == OP_ROT13) { diff --git a/src/nvim/search.c b/src/nvim/search.c index d635763acc..5566df74ef 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -3229,37 +3229,18 @@ static int in_html_tag(int end_tag) int lc = NUL; pos_T pos; - if (enc_dbcs) { - char_u *lp = NULL; - - /* We search forward until the cursor, because searching backwards is - * very slow for DBCS encodings. */ - for (p = line; p < line + curwin->w_cursor.col; MB_PTR_ADV(p)) { - if (*p == '>' || *p == '<') { - lc = *p; - lp = p; - } - } - if (*p != '<') { // check for '<' under cursor - if (lc != '<') { - return false; - } - p = lp; - } - } else { - for (p = line + curwin->w_cursor.col; p > line; ) { - if (*p == '<') { // find '<' under/before cursor - break; - } - MB_PTR_BACK(line, p); - if (*p == '>') { // find '>' before cursor - break; - } + for (p = line + curwin->w_cursor.col; p > line; ) { + if (*p == '<') { // find '<' under/before cursor + break; } - if (*p != '<') { - return false; + MB_PTR_BACK(line, p); + if (*p == '>') { // find '>' before cursor + break; } } + if (*p != '<') { + return false; + } pos.lnum = curwin->w_cursor.lnum; pos.col = (colnr_T)(p - line); |