Andrew/Ivy,
                I found UEFI spec says below for 
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString():

The OutputString() function writes a string to the output device. This is the 
most basic output mechanism on an output device. The String is displayed at the 
current cursor location on the output device(s) and the cursor is advanced 
according to the rules listed in Table 92.
                Print the character at the current cursor position and move the 
cursor right one column. If this moves the cursor past the right edge of the 
display, then the line should wrap to the beginning of the next line. This is 
equivalent to inserting a CR and an LF. Note that if the cursor is at the 
bottom of the display, and the line wraps, then the display will be scrolled 
one line.

                So my understanding is that if cursor is at the last row and 
past the right edge of the display, then the display will be scrolled one line, 
scrolling one line display does not depend on where is the next character on 
screen, but depend on current cursor position. The current GraphicsConsole 
OutputString comply with UEFI spec. In the Ivy's case, cursor column has 
exceeded the max column, so display is expected to be scrolled.

Thanks
Elvin
From: Andrew Fish [mailto:af...@apple.com]
Sent: Wednesday, October 30, 2013 9:23 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] OuputString at the last column of the last row

And this code follows the definition in the UEFI spec so it is correct.

Thanks,

Andrew Fish

On Oct 30, 2013, at 2:53 AM, Ivy Yang 
<ivy_y...@phoenix.com<mailto:ivy_y...@phoenix.com>> wrote:


Hi,
GraphicsConsoleConOutOutputString() prints mCrLfString (CR and LF) if the 
CursorColumn is at or beyond the end of the line *after* printing

if (This->Mode->CursorColumn >= (INT32) MaxColumn) {
        FlushCursor (This);
        This->OutputString (This, mCrLfString);
        FlushCursor (This);
}

This would cause the whole screen scrolling up one row when it is printing the 
last column of the last row.
} else if (*WString == CHAR_LINEFEED) {
     //
      // If the cursor is at the bottom of the display, then scroll the display 
one
      // row, and do not update the cursor position. Otherwise, move the cursor
      // down one row.
      //
      if (This->Mode->CursorRow == (INT32) (MaxRow - 1)) {
        if (GraphicsOutput != NULL) {
          //
          // Scroll Screen Up One Row
          //
          GraphicsOutput->Blt (
                    GraphicsOutput,
                    NULL,
                    EfiBltVideoToVideo,
                    DeltaX,
                    DeltaY + EFI_GLYPH_HEIGHT,
                    DeltaX,
                    DeltaY,
                    Width,
                    Height,
                    Delta
                    );
.....}

This works fine in Shell but would mess up the whole display if the application 
does not expect to be scrolled, for example, in a form browser.

However, if the scroll can be done before printing, both Shell and form browser 
can work just fine if the latter does not print beyond the last column of the 
last row.

Index: GraphicsConsole.c
===================================================================
--- GraphicsConsole.c  (revision 14817)
+++ GraphicsConsole.c      (working copy)
@@ -1068,6 +1068,16 @@
       WString++;
     } else {
+      if (This->Mode->CursorColumn > (INT32) MaxColumn) {
+        This->Mode->CursorColumn -= 2;
+        This->OutputString (This, SpaceStr);
+      }
+
+      if (This->Mode->CursorColumn >= (INT32) MaxColumn) {
+        FlushCursor (This);
+        This->OutputString (This, mCrLfString);
+        FlushCursor (This);
+      }
       //
       // Print the character at the current cursor position and move the cursor
       // right one column. If this moves the cursor past the right edge of the
@@ -1119,16 +1129,7 @@
       //
       WString += Count;
       This->Mode->CursorColumn += (INT32) Index;
-      if (This->Mode->CursorColumn > (INT32) MaxColumn) {
-        This->Mode->CursorColumn -= 2;
-        This->OutputString (This, SpaceStr);
-      }
-      if (This->Mode->CursorColumn >= (INT32) MaxColumn) {
-        FlushCursor (This);
-        This->OutputString (This, mCrLfString);
-        FlushCursor (This);
-      }
     }
   }


Thanks,
Ivy

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to