mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00
cleanup: remove legacy enc_dbcs
global #9660
This commit is contained in:
@@ -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';
|
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;
|
--no_mapping;
|
||||||
if (nc)
|
if (nc)
|
||||||
|
@@ -5489,24 +5489,18 @@ uc_check_code(
|
|||||||
break;
|
break;
|
||||||
case 1: /* Quote, but don't split */
|
case 1: /* Quote, but don't split */
|
||||||
result = STRLEN(eap->arg) + 2;
|
result = STRLEN(eap->arg) + 2;
|
||||||
for (p = eap->arg; *p; ++p) {
|
for (p = eap->arg; *p; p++) {
|
||||||
if (enc_dbcs != 0 && (*mb_ptr2len)(p) == 2)
|
if (*p == '\\' || *p == '"') {
|
||||||
/* DBCS can contain \ in a trail byte, skip the
|
result++;
|
||||||
* double-byte character. */
|
}
|
||||||
++p;
|
|
||||||
else if (*p == '\\' || *p == '"')
|
|
||||||
++result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buf != NULL) {
|
if (buf != NULL) {
|
||||||
*buf++ = '"';
|
*buf++ = '"';
|
||||||
for (p = eap->arg; *p; ++p) {
|
for (p = eap->arg; *p; p++) {
|
||||||
if (enc_dbcs != 0 && (*mb_ptr2len)(p) == 2)
|
if (*p == '\\' || *p == '"') {
|
||||||
/* DBCS can contain \ in a trail byte, copy the
|
|
||||||
* double-byte character to avoid escaping. */
|
|
||||||
*buf++ = *p++;
|
|
||||||
else if (*p == '\\' || *p == '"')
|
|
||||||
*buf++ = '\\';
|
*buf++ = '\\';
|
||||||
|
}
|
||||||
*buf++ = *p;
|
*buf++ = *p;
|
||||||
}
|
}
|
||||||
*buf = '"';
|
*buf = '"';
|
||||||
|
@@ -5313,9 +5313,7 @@ void forward_slash(char_u *fname)
|
|||||||
}
|
}
|
||||||
for (p = fname; *p != NUL; p++) {
|
for (p = fname; *p != NUL; p++) {
|
||||||
// The Big5 encoding can have '\' in the trail byte.
|
// The Big5 encoding can have '\' in the trail byte.
|
||||||
if (enc_dbcs != 0 && (*mb_ptr2len)(p) > 1) {
|
if (*p == '\\') {
|
||||||
p++;
|
|
||||||
} else if (*p == '\\') {
|
|
||||||
*p = '/';
|
*p = '/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7615,10 +7613,6 @@ char_u * file_pat_to_reg_pat(
|
|||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
size++;
|
size++;
|
||||||
if (enc_dbcs != 0 && (*mb_ptr2len)(p) > 1) {
|
|
||||||
++p;
|
|
||||||
++size;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7739,10 +7733,9 @@ char_u * file_pat_to_reg_pat(
|
|||||||
reg_pat[i++] = ',';
|
reg_pat[i++] = ',';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (enc_dbcs != 0 && (*mb_ptr2len)(p) > 1)
|
if (allow_dirs != NULL && vim_ispathsep(*p)) {
|
||||||
reg_pat[i++] = *p++;
|
*allow_dirs = true;
|
||||||
else if (allow_dirs != NULL && vim_ispathsep(*p))
|
}
|
||||||
*allow_dirs = TRUE;
|
|
||||||
reg_pat[i++] = *p;
|
reg_pat[i++] = *p;
|
||||||
break;
|
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
|
// 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
|
// 'encoding' is always "utf-8". Code that use them can be refactored to
|
||||||
// remove dead code.
|
// remove dead code.
|
||||||
#define enc_dbcs 0
|
|
||||||
#define enc_utf8 true
|
#define enc_utf8 true
|
||||||
#define has_mbyte true
|
#define has_mbyte true
|
||||||
|
|
||||||
|
@@ -4,9 +4,8 @@
|
|||||||
/// mbyte.c: Code specifically for handling multi-byte characters.
|
/// mbyte.c: Code specifically for handling multi-byte characters.
|
||||||
/// Multibyte extensions partly by Sung-Hoon Baek
|
/// Multibyte extensions partly by Sung-Hoon Baek
|
||||||
///
|
///
|
||||||
/// The encoding used in nvim is always UTF-8. "enc_utf8" and "has_mbyte" is
|
/// Strings internal to Nvim are always encoded as UTF-8 (thus the legacy
|
||||||
/// thus always true. "enc_dbcs" is always zero. The 'encoding' option is
|
/// 'encoding' option is always "utf-8").
|
||||||
/// read-only and always reads "utf-8".
|
|
||||||
///
|
///
|
||||||
/// The cell width on the display needs to be determined from the character
|
/// 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,
|
/// 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. */
|
/* Use up to 'showcmd' column. */
|
||||||
room = (int)(Rows - msg_row - 1) * Columns + sc_col - 1;
|
room = (int)(Rows - msg_row - 1) * Columns + sc_col - 1;
|
||||||
if (len > room && room > 0) {
|
if (len > room && room > 0) {
|
||||||
if (enc_utf8)
|
// may have up to 18 bytes per cell (6 per char, up to two
|
||||||
/* may have up to 18 bytes per cell (6 per char, up to two
|
// composing chars)
|
||||||
* composing chars) */
|
len = (room + 2) * 18;
|
||||||
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;
|
|
||||||
buf = xmalloc(len);
|
buf = xmalloc(len);
|
||||||
trunc_string(s, buf, room, len);
|
trunc_string(s, buf, room, len);
|
||||||
}
|
}
|
||||||
|
@@ -1974,8 +1974,6 @@ int swapchar(int op_type, pos_T *pos)
|
|||||||
inc(pos);
|
inc(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enc_dbcs != 0 && c >= 0x100) /* No lower/uppercase letter */
|
|
||||||
return FALSE;
|
|
||||||
nc = c;
|
nc = c;
|
||||||
if (mb_islower(c)) {
|
if (mb_islower(c)) {
|
||||||
if (op_type == OP_ROT13) {
|
if (op_type == OP_ROT13) {
|
||||||
|
@@ -3229,37 +3229,18 @@ static int in_html_tag(int end_tag)
|
|||||||
int lc = NUL;
|
int lc = NUL;
|
||||||
pos_T pos;
|
pos_T pos;
|
||||||
|
|
||||||
if (enc_dbcs) {
|
for (p = line + curwin->w_cursor.col; p > line; ) {
|
||||||
char_u *lp = NULL;
|
if (*p == '<') { // find '<' under/before cursor
|
||||||
|
break;
|
||||||
/* 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
|
MB_PTR_BACK(line, p);
|
||||||
if (lc != '<') {
|
if (*p == '>') { // find '>' before cursor
|
||||||
return false;
|
break;
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (*p != '<') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
pos.lnum = curwin->w_cursor.lnum;
|
pos.lnum = curwin->w_cursor.lnum;
|
||||||
pos.col = (colnr_T)(p - line);
|
pos.col = (colnr_T)(p - line);
|
||||||
|
Reference in New Issue
Block a user