Author: hbelusca
Date: Sun Apr 13 12:54:24 2014
New Revision: 62738
URL:
http://svn.reactos.org/svn/reactos?rev=62738&view=rev
Log:
[CONSRV]
- Code cleaning.
- Properly remove trailing whitespace when copying text from the console.
Modified:
trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c
trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c
Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c [iso-8859-1]
(original)
+++ trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c [iso-8859-1] Sun
Apr 13 12:54:24 2014
@@ -110,7 +110,7 @@
}
else if (!wcscmp(szValueName, L"WindowPosition"))
{
- TermInfo->AutoPosition = FALSE;
+ TermInfo->AutoPosition = FALSE;
TermInfo->WindowOrigin.x = LOWORD(Value);
TermInfo->WindowOrigin.y = HIWORD(Value);
RetVal = TRUE;
@@ -326,7 +326,6 @@
GuiInfo->FontWeight = GuiData->GuiInfo.FontWeight;
GuiInfo->UseRasterFonts = GuiData->GuiInfo.UseRasterFonts;
GuiInfo->FullScreen = GuiData->GuiInfo.FullScreen;
- /// GuiInfo->WindowPosition = GuiData->GuiInfo.WindowPosition;
GuiInfo->AutoPosition = GuiData->GuiInfo.AutoPosition;
GuiInfo->WindowOrigin = GuiData->GuiInfo.WindowOrigin;
/* Offsetize */
Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c [iso-8859-1] Sun Apr 13
12:54:24 2014
@@ -59,6 +59,11 @@
Console->Selection.srSelection.Right,
Console->Selection.srSelection.Bottom);
+#ifdef IS_WHITESPACE
+#undef IS_WHITESPACE
+#endif
+#define IS_WHITESPACE(c) ((c) == L'\0' || (c) == L' ' || (c) ==
L'\t')
+
/* Basic size for one line... */
size = selWidth;
/* ... and for the other lines, add newline characters if needed. */
@@ -89,23 +94,31 @@
for (yPos = 0; yPos < selHeight; yPos++)
{
+ ULONG length = selWidth;
+
ptr = ConioCoordToPointer(Buffer,
Console->Selection.srSelection.Left,
Console->Selection.srSelection.Top + yPos);
+
+ /* Trim whitespace from the right */
+ while (length > 0)
+ {
+ if (IS_WHITESPACE(ptr[length-1].Char.UnicodeChar))
+ --length;
+ else
+ break;
+ }
+
/* Copy only the characters, leave attributes alone */
- for (xPos = 0; xPos < selWidth; xPos++)
+ for (xPos = 0; xPos < length; xPos++)
{
/*
* Sometimes, applications can put NULL chars into the screen-buffer
* (this behaviour is allowed). Detect this and replace by a space.
- * FIXME - HACK: Improve the way we're doing that (i.e., put spaces
- * instead of NULLs (or even, nothing) only if it exists a non-null
- * char *after* those NULLs, before the end-of-line of the selection.
- * Do the same concerning spaces -- i.e. trailing spaces --).
*/
dstPos[xPos] = (ptr[xPos].Char.UnicodeChar ? ptr[xPos].Char.UnicodeChar :
L' ');
}
- dstPos += selWidth;
+ dstPos += length;
/* Add newline characters if we are not in inline-text copy mode */
if (!InlineCopyMode)