mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
cleanup: remove legacy enc_dbcs
global #9660
This commit is contained in:
parent
708176aea1
commit
ed4132d7e9
@ -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)
|
||||
|
@ -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 = '"';
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
for (p = line + curwin->w_cursor.col; p > line; ) {
|
||||
if (*p == '<') { // find '<' under/before cursor
|
||||
break;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user