changeset 28576:3a16a350614f v8.2.4812

patch 8.2.4812: unused struct item Commit: https://github.com/vim/vim/commit/8279cfe49961b3711c84c66a9954c9f70e9b78c8 Author: zeertzjq <zeertzjq@outlook.com> Date: Sat Apr 23 12:05:51 2022 +0100 patch 8.2.4812: unused struct item Problem: Unused struct item. Solution: Remove "lines" match_T. Simplify the code. (closes https://github.com/vim/vim/issues/10256)
author Bram Moolenaar <Bram@vim.org>
date Sat, 23 Apr 2022 13:15:03 +0200
parents b02c86cf0678
children 46633e743329
files src/match.c src/structs.h src/version.c
diffstat 3 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/match.c
+++ b/src/match.c
@@ -624,10 +624,10 @@ prepare_search_hl(win_T *wp, match_T *se
     static void
 check_cur_search_hl(win_T *wp, match_T *shl)
 {
-    long linecount = shl->rm.endpos[0].lnum - shl->rm.startpos[0].lnum;
+    linenr_T linecount = shl->rm.endpos[0].lnum - shl->rm.startpos[0].lnum;
 
     if (wp->w_cursor.lnum >= shl->lnum
-	    && wp->w_cursor.lnum <= shl->lnum + shl->rm.endpos[0].lnum
+	    && wp->w_cursor.lnum <= shl->lnum + linecount
 	    && (wp->w_cursor.lnum > shl->lnum
 				|| wp->w_cursor.col >= shl->rm.startpos[0].col)
 	    && (wp->w_cursor.lnum < shl->lnum + linecount
@@ -673,7 +673,6 @@ prepare_search_hl_line(
 	    shl = &cur->hl;
 	shl->startcol = MAXCOL;
 	shl->endcol = MAXCOL;
-	shl->lines = 0;
 	shl->attr_cur = 0;
 	shl->is_addpos = FALSE;
 	shl->has_cursor = FALSE;
@@ -697,9 +696,6 @@ prepare_search_hl_line(
 		shl->endcol = shl->rm.endpos[0].col;
 	    else
 		shl->endcol = MAXCOL;
-	    shl->lines = shl->rm.endpos[0].lnum - shl->rm.startpos[0].lnum;
-	    if (shl->lines == 0)
-		shl->lines = 1;
 
 	    // check if the cursor is in the match before changing the columns
 	    if (shl == search_hl)
--- a/src/structs.h
+++ b/src/structs.h
@@ -3331,7 +3331,6 @@ typedef struct
 			    // found match (may continue in next line)
     buf_T	*buf;	    // the buffer to search for a match
     linenr_T	lnum;	    // the line to search for a match
-    linenr_T	lines;	    // number of lines starting from lnum
     int		attr;	    // attributes to be used for a match
     int		attr_cur;   // attributes currently active in win_line()
     linenr_T	first_lnum; // first lnum to search for multi-line pat
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4812,
+/**/
     4811,
 /**/
     4810,