From 803379c52c1fb3f4cc71018f9733591af53b2a97 Mon Sep 17 00:00:00 2001
From: Chris Allegretta <chrisa@asty.org>
Date: Sat, 7 Feb 2009 07:09:31 +0000
Subject: [PATCH] Add shortcut for CBEGINBEFORE case to edit_draw() Added bug
 80 to document segfault when editing near COLS

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4366 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 BUGS        | 4 +++-
 src/winio.c | 6 ++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/BUGS b/BUGS
index 5c3b1275..9a1822c5 100644
--- a/BUGS
+++ b/BUGS
@@ -1,6 +1,7 @@
 ** Open BUGS **
 - Cutting the line at the top of the screen recenters to center (71)
-- Many menu items are probably missing from the new backend (73)
+- Segfault editing at COLS presumably due to new color syntax 
+  highlighting (80)
 
 ** Fixed BUGS **
 - Marked cutting sometimes leaves a newline in the file unintelligently,
@@ -143,6 +144,7 @@
 - Trying to insert a file of 0 bytes will hang nano (70) [FIXED].
 - Meta-space and ^Space are not yet handled  in new backend code (77) [FIXED]
 - F-keys do not work with new shortcut backend (72) [FIXED]
+- Many menu items are probably missing from the new backend (73) [FIXED]
 - Need a 'check-vitals-mapped' function to check that the end used didn't
   unbind all the keys for exit or cancel before starting up the editor (74) [FIXED]
 - Browser and prompt code still implement old switch on raw key input instead
diff --git a/src/winio.c b/src/winio.c
index 90f9e91f..39a89811 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2577,6 +2577,12 @@ void edit_draw(filestruct *fileptr, const char *converted, int
 		else if (md == CWHOLELINE) {
 		    mvwaddnstr(edit, line, 0, converted, -1);
 		    continue;
+		} else if (md == CBEGINBEFORE) {
+		    regexec(tmpcolor->end, fileptr->data, 1, &endmatch, 0);
+		    paintlen = actual_x(converted, strnlenpt(fileptr->data,
+			endmatch.rm_eo) - start);
+		    mvwaddnstr(edit, line, 0, converted, paintlen);
+		    continue;
 		}
 
 		while (start_line != NULL && regexec(tmpcolor->start,
-- 
GitLab