summary refs log tree commit diff
path: root/term.c
diff options
context:
space:
mode:
Diffstat (limited to 'term.c')
-rw-r--r--term.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/term.c b/term.c
index 09fe4fa..2a8960a 100644
--- a/term.c
+++ b/term.c
@@ -108,19 +108,27 @@ ACTION(csi) {
 }
 
 static void csiParam(struct Term *t, wchar_t ch) {
-	if (ch == L'?') {
-		t->param.q = true;
-	} else if (ch == L';' && t->param.n < ParamCap) {
-		t->param.n++;
-		t->param.i++;
-	} else if (ch >= L'0' && ch <= L'9') {
-		t->param.s[t->param.i] *= 10;
-		t->param.s[t->param.i] += ch - L'0';
-		if (!t->param.n) t->param.n++;
-	} else {
-		// FIXME: Allow other characters in CSI params.
-		unhandled("CSI %lc", ch);
-		return;
+	switch (ch) {
+		case L'0': case L'1': case L'2': case L'3': case L'4':
+		case L'5': case L'6': case L'7': case L'8': case L'9': {
+			t->param.s[t->param.i] *= 10;
+			t->param.s[t->param.i] += ch - L'0';
+			if (!t->param.n) t->param.n++;
+		}
+		break; case L':': // ignore
+		break; case L';': {
+			if (t->param.n == ParamCap) break;
+			t->param.n++;
+			t->param.i++;
+		}
+		break; case L'<': t->param.lt = true;
+		break; case L'=': t->param.eq = true;
+		break; case L'>': t->param.gt = true;
+		break; case L'?': t->param.qm = true;
+		break; default: {
+			unhandled("CSI %lc", ch);
+			return;
+		}
 	}
 	t->state = CSI;
 }
@@ -227,7 +235,7 @@ enum {
 static void mode(struct Term *t, wchar_t ch) {
 	enum Mode mode = 0;
 	for (uint i = 0; i < t->param.n; ++i) {
-		if (t->param.q) {
+		if (t->param.qm) {
 			switch (t->param.s[i]) {
 				break; case 1: // DECCKM
 				break; case DECAWM: mode |= Wrap;
s: add Valgrind supportJohn Keeping 2014-01-12cache: don't leave cache_slot fields uninitializedJohn Keeping 2014-01-10filter: split filter functions into their own fileJason A. Donenfeld 2014-01-10filter: make exit status localJason A. Donenfeld 2014-01-10parsing: fix header typoJason A. Donenfeld 2014-01-10cgit.c: Fix comment on bit mask hackLukas Fleischer 2014-01-10cgit.c: Use "else" for mutually exclusive branchesLukas Fleischer 2014-01-10ui-snapshot.c: Do not reinvent suffixcmp()Lukas Fleischer 2014-01-10Refactor cgit_parse_snapshots_mask()Lukas Fleischer 2014-01-10Disallow use of undocumented snapshot delimitersLukas Fleischer 2014-01-10Replace most uses of strncmp() with prefixcmp()Lukas Fleischer 2014-01-09README: Fix dependenciesLukas Fleischer 2014-01-08README: Spelling and formatting fixesLukas Fleischer 2014-01-08Fix UTF-8 with syntax-highlighting.pyPřemysl Janouch 2014-01-08Add a suggestion to the manpagePřemysl Janouch 2014-01-08Fix the example configurationPřemysl Janouch 2014-01-08Fix about-formatting.shPřemysl Janouch 2014-01-08Fix some spelling errorsPřemysl Janouch 2014-01-08filters: highlight.sh: add css comments for highlight 2.6 and 3.8Ferry Huberts