Fix copy of text in text-mode screenbuffers, in case we are copying NULL chars.

svn path=/trunk/; revision=59434
This commit is contained in:
Hermès Bélusca-Maïto 2013-07-06 16:05:39 +00:00
parent 72badc4dd2
commit c3eb80aa84

View file

@ -83,7 +83,15 @@ GuiCopyFromTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer)
/* Copy only the characters, leave attributes alone */
for (xPos = 0; xPos < selWidth; xPos++)
{
dstPos[xPos] = ptr[xPos].Char.UnicodeChar;
/*
* 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;