mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Remove has_mbytes from lines local to parent commit
This commit is contained in:
parent
1c03a06487
commit
1015aa6ff3
@ -5649,7 +5649,7 @@ void ex_sign(exarg_T *eap)
|
||||
|
||||
// Count cells and check for non-printable chars
|
||||
cells = 0;
|
||||
for (s = arg; s < p; s += (*mb_ptr2len)(s)) {
|
||||
for (s = arg; s < p; s += utfc_ptr2len(s)) {
|
||||
if (!vim_isprintc(utf_ptr2char(s))) {
|
||||
break;
|
||||
}
|
||||
|
@ -2152,7 +2152,7 @@ static void set_cmdspos_cursor(void)
|
||||
*/
|
||||
static void correct_cmdspos(int idx, int cells)
|
||||
{
|
||||
if ((*mb_ptr2len)(ccline.cmdbuff + idx) > 1
|
||||
if (utfc_ptr2len(ccline.cmdbuff + idx) > 1
|
||||
&& utf_ptr2cells(ccline.cmdbuff + idx) > 1
|
||||
&& ccline.cmdspos % Columns + cells > Columns)
|
||||
ccline.cmdspos++;
|
||||
|
@ -892,10 +892,7 @@ static colnr_T hardcopy_line(prt_settings_T *psettings, int page_line, prt_pos_T
|
||||
need_break = 1;
|
||||
} else {
|
||||
need_break = mch_print_text_out(line + col, (size_t)outputlen);
|
||||
if (has_mbyte)
|
||||
print_pos += utf_ptr2cells(line + col);
|
||||
else
|
||||
print_pos++;
|
||||
print_pos += utf_ptr2cells(line + col);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -700,7 +700,7 @@ char_u *msg_may_trunc(int force, char_u *s)
|
||||
|
||||
for (n = 0; size >= room; ) {
|
||||
size -= utf_ptr2cells(s + n);
|
||||
n += (*mb_ptr2len)(s + n);
|
||||
n += utfc_ptr2len(s + n);
|
||||
}
|
||||
--n;
|
||||
}
|
||||
@ -1476,13 +1476,13 @@ void msg_prt_line(char_u *s, int list)
|
||||
c = c_extra;
|
||||
else
|
||||
c = *p_extra++;
|
||||
} else if (has_mbyte && (l = (*mb_ptr2len)(s)) > 1) {
|
||||
} else if ((l = utfc_ptr2len(s)) > 1) {
|
||||
col += utf_ptr2cells(s);
|
||||
char buf[MB_MAXBYTES + 1];
|
||||
if (lcs_nbsp != NUL && list
|
||||
&& (utf_ptr2char(s) == 160 || utf_ptr2char(s) == 0x202f)) {
|
||||
mb_char2bytes(lcs_nbsp, (char_u *)buf);
|
||||
buf[(*mb_ptr2len)((char_u *)buf)] = NUL;
|
||||
utf_char2bytes(lcs_nbsp, (char_u *)buf);
|
||||
buf[utfc_ptr2len((char_u *)buf)] = NUL;
|
||||
} else {
|
||||
memmove(buf, s, (size_t)l);
|
||||
buf[l] = NUL;
|
||||
@ -1711,14 +1711,12 @@ static void msg_puts_display(const char_u *str, int maxlen, int attr,
|
||||
&& (*s == '\n' || (cmdmsg_rl
|
||||
? (msg_col <= 1
|
||||
|| (*s == TAB && msg_col <= 7)
|
||||
|| (has_mbyte
|
||||
&& utf_ptr2cells(s) > 1
|
||||
|| (utf_ptr2cells(s) > 1
|
||||
&& msg_col <= 2))
|
||||
: (msg_col + t_col >= Columns - 1
|
||||
|| (*s == TAB
|
||||
&& msg_col + t_col >= ((Columns - 1) & ~7))
|
||||
|| (has_mbyte
|
||||
&& utf_ptr2cells(s) > 1
|
||||
|| (utf_ptr2cells(s) > 1
|
||||
&& msg_col + t_col >= Columns - 2))))) {
|
||||
// The screen is scrolled up when at the last row (some terminals
|
||||
// scroll automatically, some don't. To avoid problems we scroll
|
||||
@ -1787,7 +1785,7 @@ static void msg_puts_display(const char_u *str, int maxlen, int attr,
|
||||
|
||||
wrap = *s == '\n'
|
||||
|| msg_col + t_col >= Columns
|
||||
|| (has_mbyte && utf_ptr2cells(s) > 1
|
||||
|| (utf_ptr2cells(s) > 1
|
||||
&& msg_col + t_col >= Columns - 1)
|
||||
;
|
||||
if (t_col > 0 && (wrap || *s == '\r' || *s == '\b'
|
||||
|
@ -399,7 +399,7 @@ void pum_redraw(void)
|
||||
|
||||
if (size > pum_width) {
|
||||
do {
|
||||
size -= has_mbyte ? utf_ptr2cells(rt) : 1;
|
||||
size -= utf_ptr2cells(rt);
|
||||
MB_PTR_ADV(rt);
|
||||
} while (size > pum_width);
|
||||
|
||||
|
@ -1875,7 +1875,7 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T
|
||||
// Store multibyte characters in ScreenLines[] et al. correctly.
|
||||
for (p = text; *p != NUL; ) {
|
||||
cells = utf_ptr2cells(p);
|
||||
c_len = (*mb_ptr2len)(p);
|
||||
c_len = utfc_ptr2len(p);
|
||||
if (col + cells > wp->w_width - (wp->w_p_rl ? col : 0)) {
|
||||
break;
|
||||
}
|
||||
@ -2914,7 +2914,7 @@ win_line (
|
||||
if (draw_state == WL_LINE && area_highlighting) {
|
||||
/* handle Visual or match highlighting in this line */
|
||||
if (vcol == fromcol
|
||||
|| (has_mbyte && vcol + 1 == fromcol && n_extra == 0
|
||||
|| (vcol + 1 == fromcol && n_extra == 0
|
||||
&& utf_ptr2cells(ptr) > 1)
|
||||
|| ((int)vcol_prev == fromcol_prev
|
||||
&& vcol_prev < vcol /* not at margin */
|
||||
@ -4879,7 +4879,7 @@ static void win_redr_status(win_T *wp, int ignore_pum)
|
||||
// Find first character that will fit.
|
||||
// Going from start to end is much faster for DBCS.
|
||||
for (i = 0; p[i] != NUL && clen >= this_ru_col - 1;
|
||||
i += (*mb_ptr2len)(p + i)) {
|
||||
i += utfc_ptr2len(p + i)) {
|
||||
clen -= utf_ptr2cells(p + i);
|
||||
}
|
||||
len = clen;
|
||||
@ -6133,8 +6133,7 @@ void setcursor(void)
|
||||
/* With 'rightleft' set and the cursor on a double-wide
|
||||
* character, position it on the leftmost column. */
|
||||
curwin->w_p_rl ? (curwin->w_width - curwin->w_wcol - (
|
||||
(has_mbyte
|
||||
&& utf_ptr2cells(get_cursor_pos_ptr()) == 2
|
||||
(utf_ptr2cells(get_cursor_pos_ptr()) == 2
|
||||
&& vim_isprintc(gchar_cursor())) ? 2 :
|
||||
1)) :
|
||||
curwin->w_wcol));
|
||||
@ -6969,17 +6968,14 @@ static void win_redr_ruler(win_T *wp, int always)
|
||||
get_rel_pos(wp, buffer + i, RULER_BUF_LEN - i);
|
||||
}
|
||||
/* Truncate at window boundary. */
|
||||
if (has_mbyte) {
|
||||
o = 0;
|
||||
for (i = 0; buffer[i] != NUL; i += (*mb_ptr2len)(buffer + i)) {
|
||||
o += utf_ptr2cells(buffer + i);
|
||||
if (this_ru_col + o > width) {
|
||||
buffer[i] = NUL;
|
||||
break;
|
||||
}
|
||||
o = 0;
|
||||
for (i = 0; buffer[i] != NUL; i += utfc_ptr2len(buffer + i)) {
|
||||
o += utf_ptr2cells(buffer + i);
|
||||
if (this_ru_col + o > width) {
|
||||
buffer[i] = NUL;
|
||||
break;
|
||||
}
|
||||
} else if (this_ru_col + (int)STRLEN(buffer) > width)
|
||||
buffer[width - this_ru_col] = NUL;
|
||||
}
|
||||
|
||||
screen_puts(buffer, row, this_ru_col + off, attr);
|
||||
i = redraw_cmdline;
|
||||
|
Loading…
Reference in New Issue
Block a user