From: Michael D. Lowis Date: Sat, 22 Sep 2018 02:51:49 +0000 (-0400) Subject: add status flags for tab and eol mode to window title X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=9b21b79af082cafc80b1cff6567080c759b842e5;p=projs%2Ftide.git add status flags for tab and eol mode to window title --- diff --git a/TODO.md b/TODO.md index c82f2dc..e9fab48 100644 --- a/TODO.md +++ b/TODO.md @@ -4,7 +4,6 @@ BUGS: * no trimming of trailing whitespace * use transaction processing for joining lines -* Add tab and eol mode to window title * implement mouse warping on search, jump to line, and focus change * gap buffer does not handle UTF-8 currently * no magic right click diff --git a/lib/x11.c b/lib/x11.c index d0f0d37..620f3bb 100644 --- a/lib/x11.c +++ b/lib/x11.c @@ -559,7 +559,14 @@ void win_init(KeyBinding* bindings) { } void win_title(char* path) { - XStoreName(X.display, X.self, path); + char title[4096] = {0}; + if (!path) path = win_view(EDIT)->buffer.path; + if (!path) path = "*scratch*"; + snprintf(title, sizeof(title)-1, "[%c%c] %s", + (DosLineFeed ? 'C' : 'N'), + (ExpandTabs ? 'S' : 'T'), + path); + XStoreName(X.display, X.self, title); } void win_font(char* font) { diff --git a/tide.c b/tide.c index 9dfbf3a..d9a1898 100644 --- a/tide.c +++ b/tide.c @@ -352,14 +352,17 @@ static void goto_ctag(char* arg) { static void tabs(char* arg) { ExpandTabs = !ExpandTabs; + win_title(NULL); // force an update of title } static void indent(char* arg) { CopyIndent = !CopyIndent; + win_title(NULL); // force an update of title } static void eol_mode(char* arg) { DosLineFeed = !DosLineFeed; + win_title(NULL); View* view = win_view(EDIT); view_selectall(view); char* txt = view_getstr(view);