Linux Application.Top renders only after scaling terminal window
See original GitHub issueDescription
I’m trying to run my application on Debian, but my Application.Top
renders only after i resize my terminal window. This works just fine on Windows.
I can write to the terminal with System.Console
just fine on Debian before attempting to call Application.Run()
.
But unlike on Windows, where the Application.Top
is rendered immediately after Application.Run()
is called, The terminal window stays blank on Debian until the terminal window is resized.
Program entrypoint
static void Main(string[] args)
{
Application.QuitKey = Key.Esc;
Application.Init();
_iWnd = new AppWindow("SubTopic",_padding);
Application.Top.Resized += Top_Resized;
Application.Top.Add(_iWnd._top);
Application.Run(Application.Top);
Application.Shutdown();
}
The class AppWindow
is called just to add padding to the window drawn using a struct.
AppWindow class constructor:
public AppWindow(string title,Padding _pad) {
Colors.Base.Normal = Application.Driver.MakeAttribute(Color.White, Color.Black);
_padding = _pad;
_top = new Toplevel()
{
X = 0,
Y = 0,
Width = Dim.Fill(),
Height = Dim.Fill(),
};
_window = new Window()
{
LayoutStyle = LayoutStyle.Absolute,
CanFocus = false,
ColorScheme = Colors.Base,
Title = title,
X = _pad.Left,
Y = _pad.Top,
Width = Dim.Fill(_pad.Right),
Height = Dim.Fill(_pad.Bottom),
};
//Resize();
_top.Add(_window);
_window.Add(_labels);
Resize();
}
And the class also includes a function to add labels to the window according to the display size when initialized:
public void Resize()
{
int winHeight;
_window.GetCurrentHeight(out winHeight);
if (winHeight == 0) return;
_labels = new Label[winHeight-1];
Debug.WriteLine($" Labels:{_labels.Length}");
for (int y = 1; y < _labels.Length; y += 4)
{
_labels[y] = new Label("┤"+y) { ColorScheme = Colors.Base, X = _padding.Left, Y = y + _padding.Top, };
}
_top.Clear();
_top.Add(_labels);
}
The Resize
mehod is called whenever Application.Top.Resized
is invoked.
The same issue persists even with a minimal Window application setup.
Build info Target Framework: .NET7.0 Deployment mode: Self-contained Target Runtime: Linux-x86
Target OS/Shell info OS: Debian GNU/Linux 11 (WSL2) Codename: Bullseye Shell: Tested on : Bash, ZSH, TMUX
Issue Analytics
- State:
- Created 3 months ago
- Comments:5
Top GitHub Comments
@JesFo , I was playing with this and the problem isn’t TMUX, but with some others Linux terminal. You have to use both events (Resize and Loaded). First of all I have to write this command (
export TERM=xterm-256color
) on TMUX to have the colors. With the code bellow I could have it always working on load and resizing:Closing as won’t fix: Use Loaded instead.