From 8ec17d4f8ce2edab30d998d6b279f0e5cd840022 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sun, 2 Feb 2020 18:39:08 -0500 Subject: Use tsl/fsl capabilities for title if available Also manually fill them if TERM=xterm* because they really should be there. --- chat.h | 2 -- term.c | 14 -------------- ui.c | 11 +++++++++-- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/chat.h b/chat.h index f9de779..8a806f1 100644 --- a/chat.h +++ b/chat.h @@ -129,9 +129,7 @@ enum TermEvent { TermPasteStart, TermPasteEnd, }; -void termInit(void); void termNoFlow(void); -void termTitle(const char *title); void termMode(enum TermMode mode, bool set); enum TermEvent termEvent(char ch); diff --git a/term.c b/term.c index bf4a933..427cac6 100644 --- a/term.c +++ b/term.c @@ -17,19 +17,11 @@ #include #include #include -#include #include #include #include "chat.h" -static bool xterm; - -void termInit(void) { - const char *term = getenv("TERM"); - xterm = (term && !strncmp(term, "xterm", 5)); -} - void termNoFlow(void) { struct termios attr; int error = tcgetattr(STDIN_FILENO, &attr); @@ -39,12 +31,6 @@ void termNoFlow(void) { tcsetattr(STDIN_FILENO, TCSANOW, &attr); } -void termTitle(const char *title) { - if (!xterm) return; - printf("\33]0;%s\33\\", title); - fflush(stdout); -} - static void privateMode(const char *mode, bool set) { printf("\33[?%s%c", mode, (set ? 'h' : 'l')); fflush(stdout); diff --git a/ui.c b/ui.c index 2d5e454..f434289 100644 --- a/ui.c +++ b/ui.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -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) { -- cgit 1.4.1 m/init.vim?id=c309a9fefa2a2dfa4efd308be8fb6266f2e9565a&follow=1'>init.vim (unfollow)
Commit message (Expand)Author
2020-01-20Use C syntax for Objective-C .m filesJune McEnroe
2020-01-20Add litterbox to causal.agencyJune McEnroe
2020-01-15Move mksh to Linux-onlyJune McEnroe
2020-01-15Remove gpg from install.shJune McEnroe
2020-01-15Remove git from install.shJune McEnroe
2020-01-14Highlight single-char variables nested in make interpolationsJune McEnroe
2020-01-08Set Bl -column tables to 100% widthJune McEnroe
2020-01-08Don't add dt margins to Bl-compact listsJune McEnroe
2020-01-08Use mandoc -T html for about-filterJune McEnroe
2020-01-05Add The Book of FloraJune McEnroe
2020-01-04Replace gr alias with git resetJune McEnroe
2020-01-03Remove shotty -c flag from upJune McEnroe
2020-01-03Add Darling Don't CryJune McEnroe
2020-01-01Update license header templates for the new yearJune McEnroe
2019-12-26Add \S to sort inside bracesJune McEnroe
2019-12-23Reformat music.txtJune McEnroe
2019-12-23Rename music.md to music.txtJune McEnroe
2019-12-23Add DO YOU DOUBT ME TRAITORJune McEnroe
2019-12-22Add license header to cgit CSSJune McEnroe
2019-12-22Add The Book of EttaJune McEnroe
2019-12-21Revert "Add first working version of imbox"June McEnroe
2019-12-21Add first working version of imboxJune McEnroe
2019-12-20Respect mailmap in gl pretty formatJune McEnroe
2019-12-20Set LANG in cgit filtersJune McEnroe
2019-12-20Source .editrc before applying -v or -eJune McEnroe
2019-12-20Disable signing commitsJune McEnroe
2019-12-19Ignore about-filterJune McEnroe
2019-12-19Fix matching make tags with no sourcesJune McEnroe
2019-12-19Avoid matching := assignments as tagsJune McEnroe
2019-12-18Hide line numbers when rendering mdocJune McEnroe
2019-12-18Customize cgit CSSJune McEnroe
2019-12-18Use :target rather than :focus pseudo-classJune McEnroe
2019-12-18Copy cgit auxiliary binaries properlyJune McEnroe
2019-12-18Add git.causal.agency cgit configJune McEnroe
2019-12-18Bail from hi if input is binaryJune McEnroe
2019-12-16Post "cgit setup"June McEnroe