wineconsole[3/6]: remove spaces from the ends of lines while copying
to the clipboard (resend)
Mikołaj Zalewski
mikolaj at zalewski.pl
Thu Oct 19 12:25:08 CDT 2006
I've checked several input and output modes and it seems no one affects
the way the content of the console is copied to the clipboard - the
spaces are stripped from the ends of the lines. I was unable to check
all the combinations of the flags but I have checked each flag at least
once.
-------------- next part --------------
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);
--
1.4.2.3
More information about the wine-patches
mailing list