diff options
author | June McEnroe <june@causal.agency> | 2019-12-31 15:30:41 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-12-31 15:30:41 -0500 |
commit | 5515a70dabf9af1b63727734b5ccafbce009cec5 (patch) | |
tree | c2515edc20e7589b54c904d47144c80649d9c6b8 | |
parent | Set up pager pipe (diff) | |
download | litterbox-5515a70dabf9af1b63727734b5ccafbce009cec5.tar.gz litterbox-5515a70dabf9af1b63727734b5ccafbce009cec5.zip |
Only enable highlighting on terminal output
-rw-r--r-- | scoop.c | 11 |
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); |