diff options
author | Tommy Allen <tommy@esdf.io> | 2018-01-25 10:33:44 -0500 |
---|---|---|
committer | Tommy Allen <tommy@esdf.io> | 2018-01-28 23:47:11 -0500 |
commit | 60d035311945c3cf7b87cc3838091f7cd97944f1 (patch) | |
tree | f95534c88d4b707928351cf2e8c9e95ad2328e38 /src | |
parent | d2ff5d5bb0807be17211b5e3e86da16038d23537 (diff) | |
download | rneovim-60d035311945c3cf7b87cc3838091f7cd97944f1.tar.gz rneovim-60d035311945c3cf7b87cc3838091f7cd97944f1.tar.bz2 rneovim-60d035311945c3cf7b87cc3838091f7cd97944f1.zip |
Don't move cursor to the left if on the first column of wrapped line
ref: #7887
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/mouse.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c index ea3505aec1..d2b33b03d7 100644 --- a/src/nvim/mouse.c +++ b/src/nvim/mouse.c @@ -646,13 +646,11 @@ static int mouse_adjust_click(win_T *wp, int row, int col) int matchid; int prev_matchid; int len = 0; - int prev_len = 0; #define incr() col++; ptr_end += utfc_ptr2len(ptr_end) #define decr() col--; ptr_end -= utfc_ptr2len(ptr_end) while (ptr < ptr_end) { - prev_len = len; len = utfc_ptr2len(ptr); matchid = syn_get_concealed_id(wp, wp->w_cursor.lnum, (colnr_T)(ptr - line)); @@ -660,19 +658,10 @@ static int mouse_adjust_click(win_T *wp, int row, int col) if (wp->w_p_cole == 3) { incr(); } else { - if (row > 0 && ptr == ptr_row_offset) { - // Check if the current concealed character is actually part of - // the previous wrapped row's conceal group. - prev_matchid = syn_get_concealed_id(wp, wp->w_cursor.lnum, - (colnr_T)((ptr - line) - - prev_len)); - if (prev_matchid == matchid) { - incr(); - } - } else if (wp->w_p_cole == 1 - || (wp->w_p_cole == 2 - && (lcs_conceal != NUL - || syn_get_sub_char() != NUL))) { + if (!(row > 0 && ptr == ptr_row_offset) + && (wp->w_p_cole == 1 || (wp->w_p_cole == 2 + && (lcs_conceal != NUL + || syn_get_sub_char() != NUL)))) { // At least one placeholder character will be displayed. decr(); } @@ -681,7 +670,6 @@ static int mouse_adjust_click(win_T *wp, int row, int col) do { incr(); ptr += len; - prev_len = len; len = utfc_ptr2len(ptr); matchid = syn_get_concealed_id(wp, wp->w_cursor.lnum, (colnr_T)(ptr - line)); |