diff options
author | James McCoy <jamessan@jamessan.com> | 2017-04-05 22:39:40 -0400 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2017-04-05 22:39:40 -0400 |
commit | bb54d921aaf85f0393c1ba10585560056f7f4ec8 (patch) | |
tree | 316ff7424337b3572b58340383eeabb3a0d36e80 /src/nvim/cursor.c | |
parent | 4f69a8fb8854698adb2de8956ad0d86ff35a6f68 (diff) | |
parent | 210b013ce75b5ea8a897071e32decc1e1f88189e (diff) | |
download | rneovim-bb54d921aaf85f0393c1ba10585560056f7f4ec8.tar.gz rneovim-bb54d921aaf85f0393c1ba10585560056f7f4ec8.tar.bz2 rneovim-bb54d921aaf85f0393c1ba10585560056f7f4ec8.zip |
Merge remote-tracking branch 'origin/master' into vim-7.4.2170
Diffstat (limited to 'src/nvim/cursor.c')
-rw-r--r-- | src/nvim/cursor.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index 544bcf6ede..45abd314fc 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -12,6 +12,7 @@ #include "nvim/state.h" #include "nvim/vim.h" #include "nvim/ascii.h" +#include "nvim/mark.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "cursor.c.generated.h" @@ -227,9 +228,10 @@ static int coladvance2( } } - /* prevent from moving onto a trail byte */ - if (has_mbyte) - mb_adjustpos(curbuf, pos); + // Prevent from moving onto a trail byte. + if (has_mbyte) { + mark_mb_adjustpos(curbuf, pos); + } if (col < wcol) return FAIL; @@ -338,9 +340,8 @@ void check_cursor_col(void) check_cursor_col_win(curwin); } -/* - * Make sure win->w_cursor.col is valid. - */ +/// Make sure win->w_cursor.col is valid. Special handling of insert-mode. +/// @see mb_check_adjust_col void check_cursor_col_win(win_T *win) { colnr_T len; @@ -362,9 +363,10 @@ void check_cursor_col_win(win_T *win) win->w_cursor.col = len; } else { win->w_cursor.col = len - 1; - /* Move the cursor to the head byte. */ - if (has_mbyte) - mb_adjustpos(win->w_buffer, &win->w_cursor); + // Move the cursor to the head byte. + if (has_mbyte) { + mark_mb_adjustpos(win->w_buffer, &win->w_cursor); + } } } else if (win->w_cursor.col < 0) { win->w_cursor.col = 0; |