Bug 12620 - Evaluating Console.CursorLeft is clearing the screen
Summary: Evaluating Console.CursorLeft is clearing the screen
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib (show other bugs)
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-06-10 07:14 UTC by donsyme
Modified: 2013-06-23 06:29 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Potential fix (466 bytes, patch)
2013-06-10 09:32 UTC, Andres G. Aragoneses
Details | Diff

Description donsyme 2013-06-10 07:14:14 UTC
- Repro:

    - Create file.fsx containing the following

        System.Console.WriteLine "BEFORE CursorLeft" 

        let x = System.Console.CursorLeft 

        System.Console.WriteLine "AFTER CursorLeft" 

    - Compile ("fsharpc file.fsx")

    - Run ("mono file.exe")

- Expected: Two lines of output
- Observed: The screen clears after the first WriteLine.

This is the cause of https://github.com/fsharp/fsharp/issues/140. We're running Mono on Ubuntu, accessing it via an SSH connection from Windows (not sure if that matters).

"stty" reports the following terminal settings, perhaps this is relevant.

speed 38400 baud; line = 0;
erase = ^H;
-brkint -imaxbel
-echoe -echok -echoctl -echoke
Comment 1 Andres G. Aragoneses 2013-06-10 09:32:30 UTC
Created attachment 4092 [details]
Potential fix

Can you test this patch?
Comment 2 donsyme 2013-06-10 12:58:51 UTC
That didn't fix it - but it did change the problem so that the "clear screen" now occurs earlier. Also, it changed a bunch of Mono tools (mcs and others I think) so that they also cleared the screen.
Comment 3 donsyme 2013-06-10 14:27:56 UTC
This line looks likely to be the one causing the "clear"

https://github.com/mono/mono/blob/master/mcs/class/corlib/System/TermInfoDriver.cs#L257

and this is the place where "noGetPosition" is becoming true:

https://github.com/mono/mono/blob/master/mcs/class/corlib/System/TermInfoDriver.cs#L492

if that helps

Note You need to log in before you can comment on or make changes to this bug.