aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_getln.c3
-rw-r--r--src/nvim/keymap.c2
-rw-r--r--src/nvim/mbyte.c3
-rw-r--r--src/nvim/screen.c34
4 files changed, 23 insertions, 19 deletions
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);