Search code examples
c#user-interface.net-5terminal.gui

Terminal.Gui when leaving charracter are still generated on Linux


I wrote a small Console program using .NET 5 and the Terminal.Gui library from Miguel de Icaza.

When I run it on Windows, everything works well. I published it as an autonomous single file for Linux and I run it on an Ubuntu 20.04 LTS as a WSL 1 in Windows 10. Once again it works well, but on Linux when I quit the program using top.Running = false; the screen is not cleared (not really a problem) but every mouse move create caracters on the console which is more annoying.

Animated gif showing the trouble

Does anybody solve this trouble.


Solution

  • If found the solution on the [GitHub Terminal.Gui project issues][1] I just add Application.Shutdown(); to my main. So It becomes :

    static int Main(string[] args)
    {
      int rc = 0;
      try
      {
        Application.Run<AppGui>();
        Application.Shutdown();
      }
      catch (Exception e)
      {
        Console.WriteLine(e.Message);
        rc = -1;
      }
    
      if (rc > 0)
        return AppGui.rc;
      else
        return rc;
    }
    

    The Application.Driver.End() proposed do not solve completely the problem there were still garbages when I click on the mouse buttons (right click past was no longer working). [1]: https://github.com/migueldeicaza/gui.cs/issues/281