Author: hbelusca
Date: Sat Jul  6 16:05:39 2013
New Revision: 59434

URL: http://svn.reactos.org/svn/reactos?rev=59434&view=rev
Log:
[CONSRV]
Fix copy of text in text-mode screenbuffers, in case we are copying NULL chars.

Modified:
    trunk/reactos/win32ss/user/consrv/frontends/gui/text.c

Modified: trunk/reactos/win32ss/user/consrv/frontends/gui/text.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/frontends/gui/text.c?rev=59434&r1=59433&r2=59434&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/consrv/frontends/gui/text.c      [iso-8859-1] 
(original)
+++ trunk/reactos/win32ss/user/consrv/frontends/gui/text.c      [iso-8859-1] 
Sat Jul  6 16:05:39 2013
@@ -83,7 +83,15 @@
         /* 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;
 


Reply via email to