mirror of
https://github.com/neovim/neovim.git
synced 2025-09-11 22:08:18 +00:00
refactor(multibyte): eliminate mb_char2cells alias for utf_char2cells
This commit is contained in:
@@ -41,7 +41,6 @@
|
|||||||
// TODO(bfredl): eventually we should keep only one of the namings
|
// TODO(bfredl): eventually we should keep only one of the namings
|
||||||
#define mb_ptr2len utfc_ptr2len
|
#define mb_ptr2len utfc_ptr2len
|
||||||
#define mb_char2len utf_char2len
|
#define mb_char2len utf_char2len
|
||||||
#define mb_char2cells utf_char2cells
|
|
||||||
|
|
||||||
/// Flags for vimconv_T
|
/// Flags for vimconv_T
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@@ -1837,7 +1837,7 @@ int op_replace(oparg_T *oap, int c)
|
|||||||
|
|
||||||
// A double-wide character can be replaced only up to half the
|
// A double-wide character can be replaced only up to half the
|
||||||
// times.
|
// times.
|
||||||
if ((*mb_char2cells)(c) > 1) {
|
if (utf_char2cells(c) > 1) {
|
||||||
if ((numc & 1) && !bd.is_short) {
|
if ((numc & 1) && !bd.is_short) {
|
||||||
++bd.endspaces;
|
++bd.endspaces;
|
||||||
++n;
|
++n;
|
||||||
|
@@ -3529,7 +3529,7 @@ static char *set_chars_option(win_T *wp, char_u **varp, bool set)
|
|||||||
// TODO(bfredl): use schar_T representation and utfc_ptr2len
|
// TODO(bfredl): use schar_T representation and utfc_ptr2len
|
||||||
int c1len = utf_ptr2len(s);
|
int c1len = utf_ptr2len(s);
|
||||||
c1 = mb_cptr2char_adv((const char_u **)&s);
|
c1 = mb_cptr2char_adv((const char_u **)&s);
|
||||||
if (mb_char2cells(c1) > 1 || (c1len == 1 && c1 > 127)) {
|
if (utf_char2cells(c1) > 1 || (c1len == 1 && c1 > 127)) {
|
||||||
return e_invarg;
|
return e_invarg;
|
||||||
}
|
}
|
||||||
if (tab[i].cp == &wp->w_p_lcs_chars.tab2) {
|
if (tab[i].cp == &wp->w_p_lcs_chars.tab2) {
|
||||||
@@ -3538,13 +3538,13 @@ static char *set_chars_option(win_T *wp, char_u **varp, bool set)
|
|||||||
}
|
}
|
||||||
int c2len = utf_ptr2len(s);
|
int c2len = utf_ptr2len(s);
|
||||||
c2 = mb_cptr2char_adv((const char_u **)&s);
|
c2 = mb_cptr2char_adv((const char_u **)&s);
|
||||||
if (mb_char2cells(c2) > 1 || (c2len == 1 && c2 > 127)) {
|
if (utf_char2cells(c2) > 1 || (c2len == 1 && c2 > 127)) {
|
||||||
return e_invarg;
|
return e_invarg;
|
||||||
}
|
}
|
||||||
if (!(*s == ',' || *s == NUL)) {
|
if (!(*s == ',' || *s == NUL)) {
|
||||||
int c3len = utf_ptr2len(s);
|
int c3len = utf_ptr2len(s);
|
||||||
c3 = mb_cptr2char_adv((const char_u **)&s);
|
c3 = mb_cptr2char_adv((const char_u **)&s);
|
||||||
if (mb_char2cells(c3) > 1 || (c3len == 1 && c3 > 127)) {
|
if (utf_char2cells(c3) > 1 || (c3len == 1 && c3 > 127)) {
|
||||||
return e_invarg;
|
return e_invarg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3579,7 +3579,7 @@ static char *set_chars_option(win_T *wp, char_u **varp, bool set)
|
|||||||
while (*s != NUL && *s != ',') {
|
while (*s != NUL && *s != ',') {
|
||||||
int c1len = utf_ptr2len(s);
|
int c1len = utf_ptr2len(s);
|
||||||
c1 = mb_cptr2char_adv((const char_u **)&s);
|
c1 = mb_cptr2char_adv((const char_u **)&s);
|
||||||
if (mb_char2cells(c1) > 1 || (c1len == 1 && c1 > 127)) {
|
if (utf_char2cells(c1) > 1 || (c1len == 1 && c1 > 127)) {
|
||||||
return e_invarg;
|
return e_invarg;
|
||||||
}
|
}
|
||||||
multispace_len++;
|
multispace_len++;
|
||||||
|
@@ -3279,7 +3279,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
|||||||
|
|
||||||
// If a double-width char doesn't fit display a '>' in the last column.
|
// If a double-width char doesn't fit display a '>' in the last column.
|
||||||
if ((wp->w_p_rl ? (col <= 0) : (col >= grid->Columns - 1))
|
if ((wp->w_p_rl ? (col <= 0) : (col >= grid->Columns - 1))
|
||||||
&& (*mb_char2cells)(mb_c) == 2) {
|
&& utf_char2cells(mb_c) == 2) {
|
||||||
c = '>';
|
c = '>';
|
||||||
mb_c = c;
|
mb_c = c;
|
||||||
mb_l = 1;
|
mb_l = 1;
|
||||||
@@ -3393,7 +3393,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
|||||||
// next line.
|
// next line.
|
||||||
if ((wp->w_p_rl ? (col <= 0) :
|
if ((wp->w_p_rl ? (col <= 0) :
|
||||||
(col >= grid->Columns - 1))
|
(col >= grid->Columns - 1))
|
||||||
&& (*mb_char2cells)(mb_c) == 2) {
|
&& utf_char2cells(mb_c) == 2) {
|
||||||
c = '>';
|
c = '>';
|
||||||
mb_c = c;
|
mb_c = c;
|
||||||
mb_utf8 = false;
|
mb_utf8 = false;
|
||||||
@@ -3964,7 +3964,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
|||||||
&& c != NUL) {
|
&& c != NUL) {
|
||||||
c = wp->w_p_lcs_chars.prec;
|
c = wp->w_p_lcs_chars.prec;
|
||||||
lcs_prec_todo = NUL;
|
lcs_prec_todo = NUL;
|
||||||
if ((*mb_char2cells)(mb_c) > 1) {
|
if (utf_char2cells(mb_c) > 1) {
|
||||||
// Double-width character being overwritten by the "precedes"
|
// Double-width character being overwritten by the "precedes"
|
||||||
// character, need to fill up half the character.
|
// character, need to fill up half the character.
|
||||||
c_extra = MB_FILLER_CHAR;
|
c_extra = MB_FILLER_CHAR;
|
||||||
@@ -4275,7 +4275,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
|||||||
//
|
//
|
||||||
// Store the character.
|
// Store the character.
|
||||||
//
|
//
|
||||||
if (wp->w_p_rl && (*mb_char2cells)(mb_c) > 1) {
|
if (wp->w_p_rl && utf_char2cells(mb_c) > 1) {
|
||||||
// A double-wide character is: put first halve in left cell.
|
// A double-wide character is: put first halve in left cell.
|
||||||
off--;
|
off--;
|
||||||
col--;
|
col--;
|
||||||
@@ -4292,7 +4292,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
|||||||
linebuf_attr[off] = char_attr;
|
linebuf_attr[off] = char_attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*mb_char2cells)(mb_c) > 1) {
|
if (utf_char2cells(mb_c) > 1) {
|
||||||
// Need to fill two screen columns.
|
// Need to fill two screen columns.
|
||||||
off++;
|
off++;
|
||||||
col++;
|
col++;
|
||||||
@@ -4353,7 +4353,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((*mb_char2cells)(mb_c) > 1) {
|
if (utf_char2cells(mb_c) > 1) {
|
||||||
// Need to fill two screen columns.
|
// Need to fill two screen columns.
|
||||||
if (wp->w_p_rl) {
|
if (wp->w_p_rl) {
|
||||||
--boguscols;
|
--boguscols;
|
||||||
|
Reference in New Issue
Block a user