From 1c03a064870af18f50d4f11cf4c7532c5cfae495 Mon Sep 17 00:00:00 2001 From: ZviRackover Date: Wed, 29 Aug 2018 21:15:32 +0300 Subject: Refactor: remove mb_ptr2len_len, mb_ptr2cells and mb_ptr2cells_len Remove occurences of these macros. --- src/nvim/ex_cmds.c | 2 +- src/nvim/ex_getln.c | 2 +- src/nvim/hardcopy.c | 4 ++-- src/nvim/keymap.c | 2 +- src/nvim/mbyte.c | 4 ++-- src/nvim/mbyte.h | 3 --- src/nvim/message.c | 16 ++++++++-------- src/nvim/os/shell.c | 2 +- src/nvim/popupmnu.c | 2 +- src/nvim/screen.c | 10 +++++----- 10 files changed, 22 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index c9eccfa6b0..2da6721011 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -5653,7 +5653,7 @@ void ex_sign(exarg_T *eap) if (!vim_isprintc(utf_ptr2char(s))) { break; } - cells += (*mb_ptr2cells)(s); + cells += utf_ptr2cells(s); } // Currently must be one or two display cells if (s != p || cells < 1 || cells > 2) { diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 5c02c4c4d6..380c6c60d1 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -2153,7 +2153,7 @@ static void set_cmdspos_cursor(void) static void correct_cmdspos(int idx, int cells) { if ((*mb_ptr2len)(ccline.cmdbuff + idx) > 1 - && (*mb_ptr2cells)(ccline.cmdbuff + idx) > 1 + && utf_ptr2cells(ccline.cmdbuff + idx) > 1 && ccline.cmdspos % Columns + cells > Columns) ccline.cmdspos++; } diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c index a2f48f46aa..3853f42d55 100644 --- a/src/nvim/hardcopy.c +++ b/src/nvim/hardcopy.c @@ -893,7 +893,7 @@ static colnr_T hardcopy_line(prt_settings_T *psettings, int page_line, prt_pos_T } else { need_break = mch_print_text_out(line + col, (size_t)outputlen); if (has_mbyte) - print_pos += (*mb_ptr2cells)(line + col); + print_pos += utf_ptr2cells(line + col); else print_pos++; } @@ -2912,7 +2912,7 @@ int mch_print_text_out(char_u *const textp, size_t len) } } if (prt_out_mbyte) { - const bool half_width = ((*mb_ptr2cells)(p) == 1); + const bool half_width = (utf_ptr2cells(p) == 1); if (half_width) { char_width /= 2; } diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c index 628bfef221..8997778125 100644 --- a/src/nvim/keymap.c +++ b/src/nvim/keymap.c @@ -898,7 +898,7 @@ char_u *replace_termcodes(const char_u *from, const size_t from_len, } // skip multibyte char correctly - for (i = (*mb_ptr2len_len)(src, (int) (end - src) + 1); i > 0; i--) { + for (i = utfc_ptr2len_len(src, (int) (end - src) + 1); i > 0; i--) { // If the character is K_SPECIAL, replace it with K_SPECIAL // KS_SPECIAL KE_FILLER. // If compiled with the GUI replace CSI with K_CSI. diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index 11c1897153..0bc97e1686 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -550,7 +550,7 @@ size_t mb_string2cells(const char_u *str) size_t clen = 0; for (const char_u *p = str; *p != NUL; p += (*mb_ptr2len)(p)) { - clen += (*mb_ptr2cells)(p); + clen += utf_ptr2cells(p); } return clen; @@ -2124,7 +2124,7 @@ static char_u *iconv_string(const vimconv_T *const vcp, char_u *str, * conversion from 'encoding' to something else. In other * situations we don't know what to skip anyway. */ *to++ = '?'; - if ((*mb_ptr2cells)((char_u *)from) > 1) + if (utf_ptr2cells((char_u *)from) > 1) *to++ = '?'; l = utfc_ptr2len_len((const char_u *)from, (int)fromlen); from += l; diff --git a/src/nvim/mbyte.h b/src/nvim/mbyte.h index 6ec25edc4a..6656780df5 100644 --- a/src/nvim/mbyte.h +++ b/src/nvim/mbyte.h @@ -47,11 +47,8 @@ enum { MAX_MCO = 6 }; // TODO(bfredl): eventually we should keep only one of the namings #define mb_ptr2len utfc_ptr2len -#define mb_ptr2len_len utfc_ptr2len_len #define mb_char2len utf_char2len #define mb_char2bytes utf_char2bytes -#define mb_ptr2cells utf_ptr2cells -#define mb_ptr2cells_len utf_ptr2cells_len #define mb_char2cells utf_char2cells /// Flags for vimconv_T diff --git a/src/nvim/message.c b/src/nvim/message.c index e550bf0a37..278372a266 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -699,7 +699,7 @@ char_u *msg_may_trunc(int force, char_u *s) return s; for (n = 0; size >= room; ) { - size -= (*mb_ptr2cells)(s + n); + size -= utf_ptr2cells(s + n); n += (*mb_ptr2len)(s + n); } --n; @@ -1222,7 +1222,7 @@ int msg_outtrans_len_attr(char_u *msgstr, int len, int attr) c = utf_ptr2char((char_u *)str); if (vim_isprintc(c)) { // Printable multi-byte char: count the cells. - retval += (*mb_ptr2cells)((char_u *)str); + retval += utf_ptr2cells((char_u *)str); } else { // Unprintable multi-byte char: print the printable chars so // far and the translation of the unprintable char. @@ -1477,7 +1477,7 @@ void msg_prt_line(char_u *s, int list) else c = *p_extra++; } else if (has_mbyte && (l = (*mb_ptr2len)(s)) > 1) { - col += (*mb_ptr2cells)(s); + col += utf_ptr2cells(s); char buf[MB_MAXBYTES + 1]; if (lcs_nbsp != NUL && list && (utf_ptr2char(s) == 160 || utf_ptr2char(s) == 0x202f)) { @@ -1549,7 +1549,7 @@ static char_u *screen_puts_mbyte(char_u *s, int l, int attr) int cw; msg_didout = true; // remember that line is not empty - cw = (*mb_ptr2cells)(s); + cw = utf_ptr2cells(s); if (cw > 1 && (cmdmsg_rl ? msg_col <= 1 : msg_col == Columns - 1)) { // Doesn't fit, print a highlighted '>' to fill it up. @@ -1712,13 +1712,13 @@ static void msg_puts_display(const char_u *str, int maxlen, int attr, ? (msg_col <= 1 || (*s == TAB && msg_col <= 7) || (has_mbyte - && (*mb_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 - && (*mb_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 +1787,7 @@ static void msg_puts_display(const char_u *str, int maxlen, int attr, wrap = *s == '\n' || msg_col + t_col >= Columns - || (has_mbyte && (*mb_ptr2cells)(s) > 1 + || (has_mbyte && utf_ptr2cells(s) > 1 && msg_col + t_col >= Columns - 1) ; if (t_col > 0 && (wrap || *s == '\r' || *s == '\b' @@ -1821,7 +1821,7 @@ static void msg_puts_display(const char_u *str, int maxlen, int attr, } else if (*s == BELL) { // beep (from ":sh") vim_beep(BO_SH); } else if (*s >= 0x20) { // printable char - cw = mb_ptr2cells(s); + cw = utf_ptr2cells(s); if (maxlen >= 0) { // avoid including composing chars after the end l = utfc_ptr2len_len(s, (int)((str + maxlen) - s)); diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index bd1e99cc8e..f42005f392 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -466,7 +466,7 @@ static void out_data_append_to_screen(char *output, size_t *count, bool eof) // incomplete UTF-8 sequence that could be composing with the last // complete sequence. // This will be corrected when we switch to vterm based implementation - int i = *p ? mb_ptr2len_len((char_u *)p, (int)(end-p)) : 1; + int i = *p ? utfc_ptr2len_len((char_u *)p, (int)(end-p)) : 1; if (!eof && i == 1 && utf8len_tab_zero[*(uint8_t *)p] > (end-p)) { *count = (size_t)(p - output); goto end; diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index 5bd4b4ddff..ac660039b2 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -399,7 +399,7 @@ void pum_redraw(void) if (size > pum_width) { do { - size -= has_mbyte ? (*mb_ptr2cells)(rt) : 1; + size -= has_mbyte ? utf_ptr2cells(rt) : 1; MB_PTR_ADV(rt); } while (size > pum_width); diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 5a43f1b619..077bad766a 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -1874,7 +1874,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 = (*mb_ptr2cells)(p); + cells = utf_ptr2cells(p); c_len = (*mb_ptr2len)(p); if (col + cells > wp->w_width - (wp->w_p_rl ? col : 0)) { break; @@ -2915,7 +2915,7 @@ win_line ( /* handle Visual or match highlighting in this line */ if (vcol == fromcol || (has_mbyte && vcol + 1 == fromcol && n_extra == 0 - && (*mb_ptr2cells)(ptr) > 1) + && utf_ptr2cells(ptr) > 1) || ((int)vcol_prev == fromcol_prev && vcol_prev < vcol /* not at margin */ && vcol < tocol)) @@ -4880,7 +4880,7 @@ static void win_redr_status(win_T *wp, int ignore_pum) // 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)) { - clen -= (*mb_ptr2cells)(p + i); + clen -= utf_ptr2cells(p + i); } len = clen; if (i > 0) { @@ -6134,7 +6134,7 @@ void setcursor(void) * character, position it on the leftmost column. */ curwin->w_p_rl ? (curwin->w_width - curwin->w_wcol - ( (has_mbyte - && (*mb_ptr2cells)(get_cursor_pos_ptr()) == 2 + && utf_ptr2cells(get_cursor_pos_ptr()) == 2 && vim_isprintc(gchar_cursor())) ? 2 : 1)) : curwin->w_wcol)); @@ -6972,7 +6972,7 @@ static void win_redr_ruler(win_T *wp, int always) if (has_mbyte) { o = 0; for (i = 0; buffer[i] != NUL; i += (*mb_ptr2len)(buffer + i)) { - o += (*mb_ptr2cells)(buffer + i); + o += utf_ptr2cells(buffer + i); if (this_ru_col + o > width) { buffer[i] = NUL; break; -- cgit From 1015aa6ff36b6f936f4707119d57cf561df28feb Mon Sep 17 00:00:00 2001 From: ZviRackover Date: Wed, 29 Aug 2018 21:55:35 +0300 Subject: Remove has_mbytes from lines local to parent commit --- src/nvim/ex_cmds.c | 2 +- src/nvim/ex_getln.c | 2 +- src/nvim/hardcopy.c | 5 +---- src/nvim/message.c | 16 +++++++--------- src/nvim/popupmnu.c | 2 +- src/nvim/screen.c | 26 +++++++++++--------------- 6 files changed, 22 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 2da6721011..ca975ee02a 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -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; } diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 380c6c60d1..cfa8f3879f 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -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++; diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c index 3853f42d55..a8731d5bd7 100644 --- a/src/nvim/hardcopy.c +++ b/src/nvim/hardcopy.c @@ -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); } } diff --git a/src/nvim/message.c b/src/nvim/message.c index 278372a266..0821ff3489 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -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' diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index ac660039b2..60c7502fa4 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -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); diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 077bad766a..0e9f4cd60a 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -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; -- cgit From a3549286b24000dcdd4411bd5faf637e1c9a0d3d Mon Sep 17 00:00:00 2001 From: ZviRackover Date: Wed, 29 Aug 2018 23:32:57 +0300 Subject: lint: clean-up after parent commits --- src/nvim/ex_getln.c | 3 ++- src/nvim/keymap.c | 2 +- src/nvim/mbyte.c | 3 ++- src/nvim/screen.c | 34 ++++++++++++++++++---------------- 4 files changed, 23 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index cfa8f3879f..786e2cd12c 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -2154,8 +2154,9 @@ static void correct_cmdspos(int idx, int cells) { if (utfc_ptr2len(ccline.cmdbuff + idx) > 1 && utf_ptr2cells(ccline.cmdbuff + idx) > 1 - && ccline.cmdspos % Columns + cells > Columns) + && ccline.cmdspos % Columns + cells > Columns) { ccline.cmdspos++; + } } /* diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c index 8997778125..3cc74c0044 100644 --- a/src/nvim/keymap.c +++ b/src/nvim/keymap.c @@ -898,7 +898,7 @@ char_u *replace_termcodes(const char_u *from, const size_t from_len, } // skip multibyte char correctly - for (i = utfc_ptr2len_len(src, (int) (end - src) + 1); i > 0; i--) { + for (i = utfc_ptr2len_len(src, (int)(end - src) + 1); i > 0; i--) { // If the character is K_SPECIAL, replace it with K_SPECIAL // KS_SPECIAL KE_FILLER. // If compiled with the GUI replace CSI with K_CSI. diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index 0bc97e1686..0ee8e2bd85 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -2124,8 +2124,9 @@ static char_u *iconv_string(const vimconv_T *const vcp, char_u *str, * conversion from 'encoding' to something else. In other * situations we don't know what to skip anyway. */ *to++ = '?'; - if (utf_ptr2cells((char_u *)from) > 1) + if (utf_ptr2cells((char_u *)from) > 1) { *to++ = '?'; + } l = utfc_ptr2len_len((const char_u *)from, (int)fromlen); from += l; fromlen -= l; diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 0e9f4cd60a..91840026a5 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2917,13 +2917,14 @@ win_line ( || (vcol + 1 == fromcol && n_extra == 0 && utf_ptr2cells(ptr) > 1) || ((int)vcol_prev == fromcol_prev - && vcol_prev < vcol /* not at margin */ - && vcol < tocol)) - area_attr = attr; /* start highlighting */ - else if (area_attr != 0 - && (vcol == tocol - || (noinvcur && (colnr_T)vcol == wp->w_virtcol))) - area_attr = 0; /* stop highlighting */ + && vcol_prev < vcol // not at margin + && vcol < tocol)) { + area_attr = attr; // start highlighting + } else if (area_attr != 0 && (vcol == tocol + || (noinvcur + && (colnr_T)vcol == wp->w_virtcol))) { + area_attr = 0; // stop highlighting + } if (!n_extra) { /* @@ -6128,15 +6129,16 @@ void setcursor(void) { if (redrawing()) { validate_cursor(); + int left_offset = curwin->w_wcol; + if (curwin->w_p_rl) { + // With 'rightleft' set and the cursor on a double-wide character, + // position it on the leftmost column. + left_offset = curwin->w_width - curwin->w_wcol + - ((utf_ptr2cells(get_cursor_pos_ptr()) == 2 + && vim_isprintc(gchar_cursor())) ? 2 : 1); + } ui_cursor_goto(curwin->w_winrow + curwin->w_wrow, - curwin->w_wincol + ( - /* 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 - ( - (utf_ptr2cells(get_cursor_pos_ptr()) == 2 - && vim_isprintc(gchar_cursor())) ? 2 : - 1)) : - curwin->w_wcol)); + curwin->w_wincol + left_offset); } } @@ -6967,7 +6969,7 @@ static void win_redr_ruler(win_T *wp, int always) } get_rel_pos(wp, buffer + i, RULER_BUF_LEN - i); } - /* Truncate at window boundary. */ + // Truncate at window boundary. o = 0; for (i = 0; buffer[i] != NUL; i += utfc_ptr2len(buffer + i)) { o += utf_ptr2cells(buffer + i); -- cgit