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)

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


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 12620 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

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