From 68f7c24cfbbbe9a8041bf44a2997ffd3a67c5d78 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Fri, 4 Nov 2011 10:23:27 +0000
Subject: [PATCH] strip trailing white-space off the end of printed messages
 *after* they're word wrapped. Pass the column width to wordwrap() instead of
 columns-1.

---
 src/sbbs3/getmsg.cpp | 1 -
 src/sbbs3/putmsg.cpp | 6 ++++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/sbbs3/getmsg.cpp b/src/sbbs3/getmsg.cpp
index 2df549ab0c..b473d689fe 100644
--- a/src/sbbs3/getmsg.cpp
+++ b/src/sbbs3/getmsg.cpp
@@ -187,7 +187,6 @@ void sbbs_t::show_msg(smbmsg_t* msg, long mode)
 	show_msghdr(msg);
 
 	if((text=smb_getmsgtxt(&smb,msg,GETMSGTXT_ALL))!=NULL) {
-		truncsp_lines(text);
 		putmsg(text, mode|P_WORDWRAP);
 		smb_freemsgtxt(text);
 	}
diff --git a/src/sbbs3/putmsg.cpp b/src/sbbs3/putmsg.cpp
index d709e8fd09..72de8a2efc 100644
--- a/src/sbbs3/putmsg.cpp
+++ b/src/sbbs3/putmsg.cpp
@@ -67,10 +67,12 @@ char sbbs_t::putmsg(const char *buf, long mode)
 		putcom("\x02\x02");
 	if(mode&P_WORDWRAP) {
 		char *wrapped;
-		if((wrapped=::wordwrap((char*)buf, cols-1, 79, WORDWRAP_FLAG_QUOTES)) == NULL)
+		if((wrapped=::wordwrap((char*)buf, cols, 79, WORDWRAP_FLAG_QUOTES)) == NULL)
 			errormsg(WHERE,ERR_ALLOC,"wordwrap buffer",0);
-		else
+		else {
+			truncsp_lines(wrapped);
 			str=wrapped;
+		}
 	}
 
 	while(str[l] && (mode&P_NOABORT || !msgabort()) && online) {
-- 
GitLab