From c1e3d941a564dd8f1f11dcc3f9c174822e4534f6 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Wed, 12 Jan 2005 18:23:09 +0000
Subject: [PATCH] fix problem where displaying multiline regexes that have
 their start on one page of a line and their end on a different page of the
 same line would paint past the end of the regex by tweaking DB's changes to
 add multibyte string support to edit_add(); now calculate paintlen the same
 way the original working code did, but keep accounting for multibyte
 characters as DB'S new code did

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

diff --git a/src/winio.c b/src/winio.c
index c6320357..50b1b665 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2994,9 +2994,8 @@ void edit_add(const filestruct *fileptr, const char *converted, int
 			index = actual_x(converted, x_start);
 
 			paintlen = actual_x(converted + index,
-				strnlenpt(fileptr->data +
-				startmatch.rm_so, startmatch.rm_eo -
-				startmatch.rm_so));
+				strnlenpt(fileptr->data,
+				startmatch.rm_eo) - start - x_start);
 
 			assert(0 <= x_start && 0 <= paintlen);
 
@@ -3125,9 +3124,8 @@ void edit_add(const filestruct *fileptr, const char *converted, int
 			if (endmatch.rm_eo > startpos &&
 				endmatch.rm_eo > startmatch.rm_so) {
 			    paintlen = actual_x(converted + index,
-				strnlenpt(fileptr->data +
-				startmatch.rm_so, endmatch.rm_eo -
-				startmatch.rm_so));
+				strnlenpt(fileptr->data,
+				endmatch.rm_eo) - start - x_start);
 
 			    assert(0 <= x_start && x_start < COLS);
 
-- 
GitLab