]> git.mdlowis.com Git - projs/tide.git/commitdiff
add status flags for tab and eol mode to window title
authorMichael D. Lowis <mike@mdlowis.com>
Sat, 22 Sep 2018 02:51:49 +0000 (22:51 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Sat, 22 Sep 2018 02:51:49 +0000 (22:51 -0400)
TODO.md
lib/x11.c
tide.c

diff --git a/TODO.md b/TODO.md
index c82f2dc6080651d403476b0e0eb4b796b065a859..e9fab4818309bb2d8e294cd3610a2be7dfcb6c27 100644 (file)
--- 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
index d0f0d376319da5efb591d8d874e38278baccf070..620f3bb32acf2d8d200f6998e77fb50d19acffe7 100644 (file)
--- 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 9dfbf3a958de547f4560e619f293a6297b531830..d9a18985e91513885741e3a8c393b015ee2ab320 100644 (file)
--- 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);