From 6414f9f000b68c4bee8a32d285fe5e4910afa44a Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 13 Apr 2016 17:48:01 +0200
Subject: [PATCH] titlebar: snip two superfluous tests for having enough space

If nano has less than four columns available, it will die,
so there will always be room for at least four characters.
---
 src/nano.h  |  2 +-
 src/winio.c | 33 ++++++++++++---------------------
 2 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/src/nano.h b/src/nano.h
index f811f338..7a9e0083 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -563,7 +563,7 @@ enum
 #define MAIN_VISIBLE (((COLS + 40) / 20) * 2)
 
 /* The minimum editor window columns and rows required for nano to work
- * correctly. */
+ * correctly.  Don't make these smaller than 4 and 1. */
 #define MIN_EDITOR_COLS 4
 #define MIN_EDITOR_ROWS 1
 
diff --git a/src/winio.c b/src/winio.c
index 669a3071..c07ebae6 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -1980,27 +1980,18 @@ void titlebar(const char *path)
 
     blank_titlebar();
 
-    /* space has to be at least 4: two spaces before the version message,
-     * at least one character of the version message, and one space
-     * after the version message. */
-    if (space < 4)
-	space = 0;
-    else {
-	/* Limit verlen to 1/3 the length of the screen in columns,
-	 * minus three columns for spaces. */
-	if (verlen > (COLS / 3) - 3)
-	    verlen = (COLS / 3) - 3;
-    }
-
-    if (space >= 4) {
-	/* Add a space after the version message, and account for both
-	 * it and the two spaces before it. */
-	mvwaddnstr(topwin, 0, 2, BRANDING, actual_x(BRANDING, verlen));
-	verlen += 3;
-
-	/* Account for the full length of the version message. */
-	space -= verlen;
-    }
+    /* Limit the length of the version message to a third of the width of
+     * the screen, minus three columns for spaces. */
+    if (verlen > (COLS / 3) - 3)
+	verlen = (COLS / 3) - 3;
+
+    /* Leave two spaces before the version message, and account also
+     * for the space after it. */
+     mvwaddnstr(topwin, 0, 2, BRANDING, actual_x(BRANDING, verlen));
+     verlen += 3;
+
+    /* Account for the full length of the version message. */
+    space -= verlen;
 
 #ifndef DISABLE_BROWSER
     /* Don't display the state if we're in the file browser. */
-- 
GitLab