Skip to content

Commit

Permalink
Default less output for timg-help to preserve escape codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
hzeller committed Jan 15, 2024
1 parent 8d5bb57 commit bcf9b74
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/timg-help.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "timg-help.h"

#include <libdeflate.h>
#include <stdlib.h>

// Build from create-manpage-inc.sh
#include "timg-manpage.inc"
Expand All @@ -32,6 +33,7 @@ void InvokeHelpPager() {

libdeflate_free_decompressor(decompress);
if (result == LIBDEFLATE_SUCCESS) {
setenv("LESS", "-R", 1); // Output terminal escape codes.
FILE *myout = popen("${PAGER:-less}", "w");
fwrite(uncompressed, 1, uncompressed_size, myout);
pclose(myout);
Expand Down

0 comments on commit bcf9b74

Please sign in to comment.