Mikołaj Zalewski : wineconsole: Remove spaces from the ends of lines while copying to the clipboard.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Oct 20 08:00:35 CDT 2006


Module: wine
Branch: master
Commit: c52238d69bc63f52f14815dc804b846c10265685
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c52238d69bc63f52f14815dc804b846c10265685

Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date:   Thu Oct 19 19:25:08 2006 +0200

wineconsole: Remove spaces from the ends of lines while copying to the clipboard.

---

 programs/wineconsole/user.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/programs/wineconsole/user.c b/programs/wineconsole/user.c
index e1efda2..557ccfc 100644
--- a/programs/wineconsole/user.c
+++ b/programs/wineconsole/user.c
@@ -689,8 +689,15 @@ static void	WCUSER_CopySelectionToClipbo
 
 	for (y = 0; y < h; y++, c.Y++)
 	{
-	    ReadConsoleOutputCharacter(data->hConOut, &p[y * w], w - 1, c, NULL);
-	    p[y * w + w - 1] = (y < h - 1) ? '\n' : '\0';
+	    LPWSTR end;
+	    ReadConsoleOutputCharacter(data->hConOut, p, w - 1, c, NULL);
+	    
+	    /* strip spaces from the end of the line */
+	    end = p + w - 1;
+	    while (end > p && *(end - 1) == ' ')
+	        end--;
+	    *end = (y < h - 1) ? '\n' : '\0';
+	    p = end + 1;
 	}
 	GlobalUnlock(hMem);
 	SetClipboardData(CF_UNICODETEXT, hMem);




More information about the wine-cvs mailing list