Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I started work on a test program to show how you could divide the console into an output area and an input area, where the input area is moved down as the output area expands with more output. It's not perfect yet, but you may be able to develop it into the answer you're looking for:</p> <pre><code> static int outCol, outRow, outHeight = 10; static void Main(string[] args) { bool quit = false; System.DateTime dt = DateTime.Now; do { if (Console.KeyAvailable) { if (Console.ReadKey(false).Key == ConsoleKey.Escape) quit = true; } System.Threading.Thread.Sleep(0); if (DateTime.Now.Subtract(dt).TotalSeconds &gt; .1) { dt = DateTime.Now; WriteOut(dt.ToString(" ss.ff"), false); } } while (!quit); } static void WriteOut(string msg, bool appendNewLine) { int inCol, inRow; inCol = Console.CursorLeft; inRow = Console.CursorTop; int outLines = getMsgRowCount(outCol, msg) + (appendNewLine?1:0); int outBottom = outRow + outLines; if (outBottom &gt; outHeight) outBottom = outHeight; if (inRow &lt;= outBottom) { int scrollCount = outBottom - inRow + 1; Console.MoveBufferArea(0, inRow, Console.BufferWidth, 1, 0, inRow + scrollCount); inRow += scrollCount; } if (outRow + outLines &gt; outHeight) { int scrollCount = outRow + outLines - outHeight; Console.MoveBufferArea(0, scrollCount, Console.BufferWidth, outHeight - scrollCount, 0, 0); outRow -= scrollCount; Console.SetCursorPosition(outCol, outRow); } Console.SetCursorPosition(outCol, outRow); if (appendNewLine) Console.WriteLine(msg); else Console.Write(msg); outCol = Console.CursorLeft; outRow = Console.CursorTop; Console.SetCursorPosition(inCol, inRow); } static int getMsgRowCount(int startCol, string msg) { string[] lines = msg.Split('\n'); int result = 0; foreach (string line in lines) { result += (startCol + line.Length) / Console.BufferWidth; startCol = 0; } return result + lines.Length - 1; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload