Skip to content

Commit

Permalink
Merge pull request #2 from mkgessen/add-tmux-256color-term-option
Browse files Browse the repository at this point in the history
Add support to  $TERM=tmux or tmux-256color
  • Loading branch information
martinlindhe authored Oct 16, 2024
2 parents eaacb56 + 96a98b0 commit c39f35c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/imgcat.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@ func CatFile(fileName string, w io.Writer) error {

func embed(r io.Reader, w io.Writer) error {

inScreen := os.Getenv("TERM") == "screen"
var inScreen bool
switch os.Getenv("TERM") {
case
"screen",
"tmux",
"tmux-256color":
inScreen = true
default:
inScreen = false
}

buf := new(bytes.Buffer)
_, err := buf.ReadFrom(r)
Expand Down

0 comments on commit c39f35c

Please sign in to comment.