From 991892fff518f59f02bbe1c8a4637843a82bd74e Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Tue, 27 Sep 2016 23:30:10 +0200 Subject: Allow specifying terminal name in termo_new() --- termo.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'termo.c') diff --git a/termo.c b/termo.c index 953bc88..8a92821 100644 --- a/termo.c +++ b/termo.c @@ -415,7 +415,7 @@ abort_free_to_utf32: } termo_t * -termo_new (int fd, const char *encoding, int flags) +termo_new (int fd, const char *term, const char *encoding, int flags) { termo_t *tk = termo_alloc (); if (!tk) @@ -424,7 +424,11 @@ termo_new (int fd, const char *encoding, int flags) tk->fd = fd; termo_set_flags (tk, flags); - const char *term = getenv ("TERM"); + // In theory, we might have multiple different terminals open + // simultaneously; I'm not currently sure if it works + if (!term) + term = getenv ("TERM"); + if (termo_init (tk, term, encoding) && termo_start (tk)) return tk; -- cgit v1.2.3-70-g09d2