Slight refactor on the fix in the previous commit

Fri, 24 Jul 2015 04:30:17 +0300

author
Teemu Piippo <tsapii@utu.fi>
date
Fri, 24 Jul 2015 04:30:17 +0300
changeset 101
71f1cd8154a9
parent 100
d301ead29d7c
child 102
3492f8f0ee7e

Slight refactor on the fix in the previous commit

sources/interface.cpp file | annotate | diff | comparison | revisions
--- a/sources/interface.cpp	Fri Jul 24 04:24:38 2015 +0300
+++ b/sources/interface.cpp	Fri Jul 24 04:30:17 2015 +0300
@@ -278,6 +278,11 @@
 			mvaddch (y, x, char (byte));
 			++x;
 		}
+		else if (byte >= RLINE_ON_COLOR and byte < RLINE_ON_BOLD)
+		{
+			auto attrfunction = (byte < RLINE_OFF_COLOR ? &attron : &attroff);
+			(*attrfunction) (color_pair (Color ((byte - RLINE_ON_COLOR) & 7), DEFAULT));
+		}
 		else switch (byte)
 		{
 		case RLINE_ON_BOLD:
@@ -287,13 +292,6 @@
 		case RLINE_OFF_BOLD:
 			attroff (A_BOLD);
 			break;
-
-		default:
-			if (byte < 256)
-				break;
-
-			(byte < RLINE_OFF_COLOR ? attron : attroff) (color_pair (Color ((byte - RLINE_ON_COLOR) & 7), DEFAULT));
-			break;
 		}
 	}
 

mercurial