From 8328fc2439681cf7a2f3a2ccbfde844b2fa53427 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Tue, 25 May 2004 23:34:43 +0000
Subject: [PATCH] properly account for padding in titlebar()

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1767 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog   | 10 +++++-----
 src/winio.c | 12 +++++++-----
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5c7db957..24a874a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -263,11 +263,11 @@ CVS code -
 	- Overhaul to use display_string() to display the filename, and
 	  to better handle shorter screen widths.  Also remove
 	  now-unneeded wrefresh(topwin) calls. (David Benbennick)
-	  DLR: Tweak to reserve enough space for "Modified" in all
-	  cases, to make sure that the version message takes up no more
-	  more than 1/3 of the available width, and to include a
-	  reset_cursor() call so that the cursor is always in the right
-	  place.
+	  DLR: Tweak to reserve enough space for "Modified", plus
+	  padding, in all cases, to make sure that the version message
+	  takes up no more more than 1/3 of the available width, minus
+	  padding, and to include a reset_cursor() call so that the
+	  cursor is always in the right place.
   bottombars()
 	- Call blank_bottombars() instead of blank_bottomwin(). (David
 	  Benbennick)
diff --git a/src/winio.c b/src/winio.c
index 9958e188..c85530a8 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -1556,14 +1556,16 @@ void titlebar(const char *path)
 	space = 0;
     else {
 	space = COLS - 5 - verlen;
-	/* Reserve 2/3 of the screen for after the version message. */
-	if (space < COLS - (COLS / 3))
-	    space = COLS - (COLS / 3);
+	/* Reserve 2/3 of the screen plus one column for after the
+	 * version message. */
+	if (space < COLS - (COLS / 3) + 1)
+	    space = COLS - (COLS / 3) + 1;
     }
 
     if (COLS > 4) {
-	/* The version message should only take up 1/3 of the screen. */
-	mvwaddnstr(topwin, 0, 2, VERMSG, COLS / 3);
+	/* The version message should only take up 1/3 of the screen
+	 * minus one column. */
+	mvwaddnstr(topwin, 0, 2, VERMSG, (COLS / 3) - 3);
 	waddstr(topwin, "  ");
     }
 
-- 
GitLab