From 9b21b79af082cafc80b1cff6567080c759b842e5 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Fri, 21 Sep 2018 22:51:49 -0400 Subject: [PATCH] add status flags for tab and eol mode to window title --- TODO.md | 1 - lib/x11.c | 9 ++++++++- tide.c | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) 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); -- 2.49.0