]> granicus.if.org Git - vim/commitdiff
patch 8.1.2321: cannot select all text with the mouse v8.1.2321
authorBram Moolenaar <Bram@vim.org>
Mon, 18 Nov 2019 22:31:48 +0000 (23:31 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 18 Nov 2019 22:31:48 +0000 (23:31 +0100)
Problem:    Cannot select all text with the mouse. (John Marriott)
Solution:   Move limiting the mouse column to f_getmousepos(). (closes #5242)

src/mouse.c
src/version.c

index f3ff26d2ea121d63860c5f4c064169abb68e4bb9..c141800689910e560833e3910c17e9ddc596a7c0 100644 (file)
@@ -2822,7 +2822,6 @@ mouse_comp_pos(
     int                retval = FALSE;
     int                off;
     int                count;
-    char_u     *p;
 
 #ifdef FEAT_RIGHTLEFT
     if (win->w_p_rl)
@@ -2882,11 +2881,6 @@ mouse_comp_pos(
        col += row * (win->w_width - off);
        // add skip column (for long wrapping line)
        col += win->w_skipcol;
-       // limit to text length plus one
-       p = ml_get_buf(win->w_buffer, lnum, FALSE);
-       count = (int)STRLEN(p);
-       if (col > count)
-           col = count;
     }
 
     if (!win->w_p_wrap)
@@ -3053,7 +3047,17 @@ f_getmousepos(typval_T *argvars UNUSED, typval_T *rettv)
            col -= left_off;
            if (row >= 0 && row < wp->w_height && col >= 0 && col < wp->w_width)
            {
+               char_u  *p;
+               int     count;
+
                mouse_comp_pos(wp, &row, &col, &line, NULL);
+
+               // limit to text length plus one
+               p = ml_get_buf(wp->w_buffer, line, FALSE);
+               count = (int)STRLEN(p);
+               if (col > count)
+                   col = count;
+
                column = col + 1;
            }
        }
index e1ffa9eff91705596434cf1e0f92866b9ec02e32..f512b087006e922663b50324e54282ee01f7089d 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2321,
 /**/
     2320,
 /**/