From 179f0ea742b8c56ac4df1aa7adc3622a6ed358f4 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Tue, 4 Jan 2005 02:55:45 +0000
Subject: [PATCH] undo the initialization of index, as the warning was
 indirectly caused by a missing snippet of code that also broke color regex
 display, and add the aforementioned snippet

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2227 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 src/winio.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/winio.c b/src/winio.c
index 26a13d49..f04bd5a3 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -3185,7 +3185,7 @@ void edit_add(const filestruct *fileptr, const char *converted, int
 	    int paintlen;
 		/* Number of chars to paint on this line.  There are COLS
 		 * characters on a whole line. */
-	    size_t index = 0;
+	    size_t index;
 		/* Index in converted where we paint. */
 	    regmatch_t startmatch;	/* match position for start_regexp */
 	    regmatch_t endmatch;	/* match position for end_regexp */
@@ -3307,8 +3307,8 @@ void edit_add(const filestruct *fileptr, const char *converted, int
 		    end_line = end_line->next;
 
 		/* No end found, or it is too early. */
-		if (end_line == NULL ||
-			(end_line == fileptr && endmatch.rm_eo <= startpos))
+		if (end_line == NULL || (end_line == fileptr &&
+			endmatch.rm_eo <= startpos))
 		    goto step_two;
 
 		/* Now paint the start of fileptr. */
@@ -3338,6 +3338,7 @@ void edit_add(const filestruct *fileptr, const char *converted, int
 		    else
 			x_start = strnlenpt(fileptr->data,
 				startmatch.rm_so) - start;
+		    index = actual_x(converted, x_start);
 		    if (regexec(tmpcolor->end,
 			fileptr->data + startmatch.rm_eo, 1, &endmatch,
 			startmatch.rm_eo == 0 ? 0 : REG_NOTBOL) == 0) {
@@ -3408,7 +3409,7 @@ void edit_add(const filestruct *fileptr, const char *converted, int
 	int paintlen;
 	    /* Number of chars to paint on this line.  There are COLS
 	     * characters on a whole line. */
-	size_t index = 0;
+	size_t index;
 	    /* Index in converted where we paint. */
 
 	mark_order(&top, &top_x, &bot, &bot_x, NULL);
-- 
GitLab