From 90f772b250c6f3eb83dae59579fc8bf2c63ee9e7 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Mon, 11 Jul 2005 07:12:33 +0000
Subject: [PATCH] fixing titlebar(), take three

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2847 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 src/winio.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/winio.c b/src/winio.c
index e9470517..ea88d638 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2755,7 +2755,7 @@ void titlebar(const char *path)
 	 * buffer. */
     size_t statelen = 0;
 	/* The length of the state in columns, or the length of
-	 * "Modified" if the state is blank, plus one for padding. */
+	 * "Modified" if the state is blank. */
     char *exppath = NULL;
 	/* The file name, expanded for display. */
     bool newfie = FALSE;
@@ -2782,8 +2782,8 @@ void titlebar(const char *path)
     }
 
     if (space >= 4) {
-	/* Add one space after the version message, and account for both it
-	 * and the two spaces before it. */
+	/* Add a space after the version message, and account for both
+	 * it and the two spaces before it. */
 	mvwaddnstr(topwin, 0, 2, VERMSG, actual_x(VERMSG, verlen));
 	verlen += 3;
 
@@ -2800,7 +2800,7 @@ void titlebar(const char *path)
 	state = openfile->modified ? _("Modified") : ISSET(VIEW_MODE) ?
 		_("View") : "";
 
-    statelen = strlenpt((state[0] != '\0') ? state : _("Modified")) + 1;
+    statelen = strlenpt((state[0] != '\0') ? state : _("Modified"));
 
     /* If possible, add a space before state. */
     if (space > 0 && statelen < space)
@@ -2860,14 +2860,13 @@ void titlebar(const char *path)
 	mvwaddnstr(topwin, 0, verlen + ((space - exppathlen) / 3),
 		prefix, actual_x(prefix, prefixlen));
 	if (!newfie) {
-	    assert(strlenpt(prefix) + 1 == prefixlen);
-
 	    waddch(topwin, ' ');
 	    waddstr(topwin, exppath);
 	}
     } else {
 	/* We will say something like "File: ...ename". */
-	waddnstr(topwin, prefix, actual_x(prefix, prefixlen));
+	mvwaddnstr(topwin, 0, verlen - 1, prefix, actual_x(prefix,
+		prefixlen));
 	if (space <= -3 || newfie)
 	    goto the_end;
 	waddch(topwin, ' ');
-- 
GitLab