linenoise icon indicating copy to clipboard operation
linenoise copied to clipboard

TERM=null likely means no escape sequence support

Open DomBlack opened this issue 7 years ago • 3 comments

Currently if the TERM is null, it is counted as a terminal which supports escape sequences. However if no TERM is set, the likelihood is that escape sequences are not supported.

For instance CLion's integrated terminate does not support escape sequences and does not set a TERM.

With this change an application goes from displaying:

db34bf7c-13c6-11e7-93b0-0974fad154ee

To displaying:

0f0dc03c-13c7-11e7-9337-d25d20d38c23

DomBlack avatar Mar 29 '17 07:03 DomBlack

Hello, thanks for your contrib, I hope that we don't break other systems with TERM set to NULL but actually having escape sequences. Isn't there another discriminant we can use? For instance, even if it's not a terminal, it still returns true to isatty()? Thanks.

antirez avatar Mar 29 '17 08:03 antirez

Yes it turns true for isatty(0)

DomBlack avatar Mar 29 '17 11:03 DomBlack

This is a useful fix for the but needs updated to use isatty(0) instead of (only) checking if TERM is NULL.

Needs work before merge!

rain-1 avatar Mar 30 '18 23:03 rain-1