From 5515a70dabf9af1b63727734b5ccafbce009cec5 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Tue, 31 Dec 2019 15:30:41 -0500 Subject: Only enable highlighting on terminal output --- scoop.c | 11 ++++++++--- 1 file 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); -- cgit 1.4.1