nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/7] tweaks: move the displaying of the state letters into a sepa


From: Benno Schulenberg
Subject: [PATCH 1/7] tweaks: move the displaying of the state letters into a separate function
Date: Tue, 15 Dec 2020 10:44:03 +0100

---
 src/winio.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/winio.c b/src/winio.c
index e961cccb..05a6f858 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -1867,6 +1867,19 @@ int buffer_number(openfilestruct *buffer)
 }
 #endif
 
+#ifndef NANO_TINY
+/* Show the state of auto-indenting, the mark, hard-wrapping, macro recording,
+ * and soft-wrapping by showing corresponding letters in the given window. */
+void show_states_at(WINDOW *window)
+{
+       waddstr(window, ISSET(AUTOINDENT) ? "I" : " ");
+       waddstr(window, openfile->mark ? "M" : " ");
+       waddstr(window, ISSET(BREAK_LONG_LINES) ? "L" : " ");
+       waddstr(window, recording ? "R" : " ");
+       waddstr(window, ISSET(SOFTWRAP) ? "S" : " ");
+}
+#endif
+
 /* If path is NULL, we're in normal editing mode, so display the current
  * version of nano, the current filename, and whether the current file
  * has been modified on the title bar.  If path isn't NULL, we're either
@@ -2009,11 +2022,7 @@ void titlebar(const char *path)
                        waddstr(topwin, " *");
                if (statelen < COLS) {
                        wmove(topwin, 0, COLS + 2 - statelen);
-                       waddstr(topwin, ISSET(AUTOINDENT) ? "I" : " ");
-                       waddstr(topwin, openfile->mark ? "M" : " ");
-                       waddstr(topwin, ISSET(BREAK_LONG_LINES) ? "L" : " ");
-                       waddstr(topwin, recording ? "R" : " ");
-                       waddstr(topwin, ISSET(SOFTWRAP) ? "S" : " ");
+                       show_states_at(topwin);
                }
        } else
 #endif
-- 
2.29.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]