summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--scoop.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/scoop.c b/scoop.c
index 0b652d9..f32da90 100644
--- a/scoop.c
+++ b/scoop.c
@@ -187,9 +187,14 @@ int main(int argc, char *argv[]) {
 	if (search) dbBindText(stmt, ":search", search);
 	dbBindInt(stmt, ":limit", limit);
 
-	// FIXME: Conditional on terminal.
-	dbBindText(stmt, ":open", "\33[33m");
-	dbBindText(stmt, ":close", "\33[m");
+	if (tty) {
+		dbBindText(stmt, ":open", "\33[33m");
+		dbBindText(stmt, ":close", "\33[m");
+	} else {
+		// XXX: If you leave these NULL fts5 segfaults...
+		dbBindText(stmt, ":open", "");
+		dbBindText(stmt, ":close", "");
+	}
 
 	if (verbose) {
 		char *expand = sqlite3_expanded_sql(stmt);