From f34e869ad6df283c7ccd5c7783f30fb2d1913ffd Mon Sep 17 00:00:00 2001 From: BDisp Date: Sun, 12 Jul 2020 13:59:06 +0100 Subject: [PATCH] Also fixed the position and unicode on StatusBar. --- Terminal.Gui/Core/Toplevel.cs | 1 + Terminal.Gui/Views/StatusBar.cs | 10 +++++----- UICatalog/Scenarios/Unicode.cs | 7 +++++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Terminal.Gui/Core/Toplevel.cs b/Terminal.Gui/Core/Toplevel.cs index 882cf1f65..3419c5b1a 100644 --- a/Terminal.Gui/Core/Toplevel.cs +++ b/Terminal.Gui/Core/Toplevel.cs @@ -286,6 +286,7 @@ namespace Terminal.Gui { internal void PositionToplevels () { + PositionToplevel (this); foreach (var top in Subviews) { if (top is Toplevel) { PositionToplevel ((Toplevel)top); diff --git a/Terminal.Gui/Views/StatusBar.cs b/Terminal.Gui/Views/StatusBar.cs index 76dbf0e3a..797697e3c 100644 --- a/Terminal.Gui/Views/StatusBar.cs +++ b/Terminal.Gui/Views/StatusBar.cs @@ -88,7 +88,7 @@ namespace Terminal.Gui { CanFocus = false; ColorScheme = Colors.Menu; X = 0; - Y = Driver.Rows - 1; + Y = SuperView != null ? SuperView.Frame.Height - 1 : Pos.AnchorEnd (1); Width = Dim.Fill (); Height = 1; @@ -100,8 +100,8 @@ namespace Terminal.Gui { return delegate { X = 0; Height = 1; - if (SuperView == null || SuperView == Application.Top) { - Y = Driver.Rows - 1; + if (SuperView == null || SuperView is Toplevel) { + Y = SuperView.Frame.Height - 1; } else { //Y = Pos.Bottom (SuperView); } @@ -125,7 +125,7 @@ namespace Terminal.Gui { //} Move (0, 0); - Driver.SetAttribute (ColorScheme.Normal); + Driver.SetAttribute (Colors.Menu.Normal); for (int i = 0; i < Frame.Width; i++) Driver.AddRune (' '); @@ -134,7 +134,7 @@ namespace Terminal.Gui { Driver.SetAttribute (scheme); for (int i = 0; i < Items.Length; i++) { var title = Items [i].Title; - for (int n = 0; n < title.Length; n++) { + for (int n = 0; n < title.RuneCount; n++) { if (title [n] == '~') { scheme = ToggleScheme (scheme); continue; diff --git a/UICatalog/Scenarios/Unicode.cs b/UICatalog/Scenarios/Unicode.cs index a1f53e5bb..d30a7a695 100644 --- a/UICatalog/Scenarios/Unicode.cs +++ b/UICatalog/Scenarios/Unicode.cs @@ -36,6 +36,13 @@ namespace UICatalog { }); Top.Add (menu); + var statusBar = new StatusBar (new StatusItem [] { + new StatusItem (Key.ControlQ, "~^Q~ Выход", () => Application.RequestStop()), + new StatusItem (Key.Unknown, "~F2~ Создать", null), + new StatusItem(Key.Unknown, "~F3~ Со_хранить", null), + }); + Top.Add (statusBar); + var label = new Label ("Label:") { X = 0, Y = 1 }; Win.Add (label); var testlabel = new Label (gitString) { X = 20, Y = Pos.Y (label), Width = Dim.Percent (50), };