diff --git a/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c b/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c index 9da334dd683..f12305ee6fc 100644 --- a/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c +++ b/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c @@ -110,7 +110,7 @@ GuiConsoleReadUserSettings(IN OUT PGUI_CONSOLE_INFO TermInfo, } 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 @@ GuiConsoleShowConsoleProperties(PGUI_CONSOLE_DATA GuiData, 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 */ diff --git a/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c b/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c index 24526d51c13..e14dfdea4f2 100644 --- a/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c +++ b/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c @@ -59,6 +59,11 @@ GuiCopyFromTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer, 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 @@ GuiCopyFromTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer, 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)