summary refs log tree commit diff
path: root/ui.c
diff options
context:
space:
mode:
authorC. McEnroe2020-02-02 18:39:08 -0500
committerC. McEnroe2020-02-02 18:40:21 -0500
commit8ec17d4f8ce2edab30d998d6b279f0e5cd840022 (patch)
treefe6824bfb005f1826f04fcb06988207ef2e733ee /ui.c
parenta507ff40732b1f6fe9c5dbc1f1f17ef00bcccf5d (diff)
Use tsl/fsl capabilities for title if available
Also manually fill them if TERM=xterm* because they really should be
there.
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/ui.c b/ui.c
index 2d5e454..f434289 100644
--- a/ui.c
+++ b/ui.c
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sysexits.h>
+#include <term.h>
 #include <time.h>
 #include <wchar.h>
 #include <wctype.h>
@@ -133,11 +134,15 @@ void uiInit(void) {
 	initscr();
 	cbreak();
 	noecho();
-	termInit();
 	termNoFlow();
 	def_prog_mode();
 	err_set_exit(errExit);
 	colorInit();
+	if (!to_status_line && !strncmp(termname(), "xterm", 5)) {
+		to_status_line = "\33]2;";
+		from_status_line = "\7";
+	}
+
 	status = newwin(1, COLS, 0, 0);
 	input = newpad(1, InputCols);
 	keypad(input, true);
@@ -305,7 +310,9 @@ static void statusUpdate(void) {
 		&unread, windows.active->unread
 	);
 	if (!windows.active->unread) buf[unread] = '\0';
-	termTitle(buf);
+	putp(to_status_line);
+	putp(buf);
+	putp(from_status_line);
 }
 
 void uiShowID(size_t id) {