# HG changeset patch # User Bram Moolenaar # Date 1566052202 -7200 # Node ID 6ffe295f7492c75d2a44bf833f77aa3f5fe0d3f6 # Parent 9786645b20c0384218d2c90d100527cd82e1695c patch 8.1.1871: modeless selection in GUI still not correct commit https://github.com/vim/vim/commit/ff9f27cdc7be6023f833b9d63189894839df9655 Author: Bram Moolenaar Date: Sat Aug 17 16:15:53 2019 +0200 patch 8.1.1871: modeless selection in GUI still not correct Problem: Modeless selection in GUI still not correct. Solution: Fix max_col. diff --git a/src/ui.c b/src/ui.c --- a/src/ui.c +++ b/src/ui.c @@ -1098,8 +1098,9 @@ clip_start_selection(int col, int row, i // Click in a popup window restricts selection to that window, // excluding the border. cb->min_col = wp->w_wincol + wp->w_popup_border[3]; - cb->max_col = wp->w_wincol + popup_width(wp) - 1 - - wp->w_popup_border[1]; + cb->max_col = wp->w_wincol + popup_width(wp) - wp->w_popup_border[1]; + if (cb->max_col > screen_Columns) + cb->max_col = screen_Columns; cb->min_row = wp->w_winrow + wp->w_popup_border[0]; cb->max_row = wp->w_winrow + popup_height(wp) - 1 - wp->w_popup_border[2]; @@ -1440,7 +1441,7 @@ clip_invert_area( int max_col; #ifdef FEAT_TEXT_PROP - max_col = cbd->max_col; + max_col = cbd->max_col - 1; #else max_col = Columns - 1; #endif @@ -1519,8 +1520,8 @@ clip_invert_rectangle( width -= cbd->min_col - col; col = cbd->min_col; } - if (width > cbd->max_col - col + 1) - width = cbd->max_col - col + 1; + if (width > cbd->max_col - col) + width = cbd->max_col - col; if (row < cbd->min_row) { height -= cbd->min_row - row; @@ -1581,8 +1582,8 @@ clip_copy_modeless_selection(int both UN #ifdef FEAT_TEXT_PROP if (col1 < clip_star.min_col) col1 = clip_star.min_col; - if (col2 > clip_star.max_col + 1) - col2 = clip_star.max_col + 1; + if (col2 > clip_star.max_col) + col2 = clip_star.max_col; if (row1 < clip_star.min_row) row1 = clip_star.min_row; if (row2 > clip_star.max_row) @@ -1619,19 +1620,19 @@ clip_copy_modeless_selection(int both UN if (row == row2) end_col = col2; + else #ifdef FEAT_TEXT_PROP - else if (clip_star.max_col < Columns) - end_col = clip_star.max_col + 1; + end_col = clip_star.max_col; +#else + end_col = Columns; #endif - else - end_col = Columns; line_end_col = clip_get_line_end(&clip_star, row); /* See if we need to nuke some trailing whitespace */ if (end_col >= #ifdef FEAT_TEXT_PROP - clip_star.max_col + 1 + clip_star.max_col #else Columns #endif @@ -1797,7 +1798,7 @@ clip_get_line_end(Clipboard_T *cbd UNUSE return 0; for (i = #ifdef FEAT_TEXT_PROP - cbd->max_col >= screen_Columns ? screen_Columns : cbd->max_col + 1; + cbd->max_col; #else screen_Columns; #endif diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -770,6 +770,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1871, +/**/ 1870, /**/ 1869,