From 760a2dc9b25fea90f333f6819a9bf76c6f3baf9c Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Wed, 14 Jan 2004 06:38:00 +0000
Subject: [PATCH] if color support is enabled, we only need to call
 edit_refresh() to properly paint multi-line color regexes when COLOR_SYNTAX
 is set

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1621 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog   | 5 +++++
 src/files.c | 9 ++++++---
 src/nano.c  | 6 ++++--
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e406deba..b5b7828c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
 CVS code -
+- General:
+	- Change instances in the code that refresh the entire edit
+	  window when color support is enabled (in order to properly
+	  handle multi-line color regexes) to only do so when
+	  it's necessary, i.e, when COLOR_SYNTAX is set. (DLR)
 - nano.c:
   main()
 	- Move the call to raw() on systems that don't define
diff --git a/src/files.c b/src/files.c
index 6a410ffe..12e028df 100644
--- a/src/files.c
+++ b/src/files.c
@@ -62,7 +62,8 @@ void load_file(int update)
 
 #ifdef ENABLE_COLOR
     update_color();
-    edit_refresh();
+    if (ISSET(COLOR_SYNTAX))
+	edit_refresh();
 #endif
 }
 
@@ -100,7 +101,8 @@ void new_file(void)
 
 #ifdef ENABLE_COLOR
     update_color();
-    edit_refresh();
+    if (ISSET(COLOR_SYNTAX))
+	edit_refresh();
 #endif
 }
 
@@ -1647,7 +1649,8 @@ int write_file(const char *name, int tmp, int append, int nonamechange)
 	    filename = mallocstrcpy(filename, realname);
 #ifdef ENABLE_COLOR
 	    update_color();
-	    edit_refresh();
+	    if (ISSET(COLOR_SYNTAX))
+		edit_refresh();
 #endif
 	}
 
diff --git a/src/nano.c b/src/nano.c
index 98f9a7f3..a766d68d 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -988,7 +988,8 @@ void do_char(char ch)
 #endif
 
 #ifdef ENABLE_COLOR
-    refresh = 1;
+    if (ISSET(COLOR_SYNTAX))
+	refresh = 1;
 #endif
 
 #if !defined(DISABLE_WRAPPING) || defined(ENABLE_COLOR)
@@ -1067,7 +1068,8 @@ int do_delete(void)
 
 	align(&current->data);
 #ifdef ENABLE_COLOR
-	refresh = 1;
+	if (ISSET(COLOR_SYNTAX))
+	    refresh = 1;
 #endif
     } else if (current->next != NULL && (current->next != filebot || blbf)) {
 	/* We can delete the line before filebot only if it is blank: it
-- 
GitLab