Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label not display fully when resizing terminal. #2717

Closed
kacperpikacz opened this issue Jun 16, 2023 · 1 comment · Fixed by #2718
Closed

Label not display fully when resizing terminal. #2717

kacperpikacz opened this issue Jun 16, 2023 · 1 comment · Fixed by #2718

Comments

@kacperpikacz
Copy link

Screenshots
label

Desktop:

  • OS: Windows 10
  • TerminalGui Version: 1.12.1

To Reproduce

using System.Text;
using Terminal.Gui;

namespace Test
{
    public class Program
    {
        static readonly Label debugLabel = new ();
        static void Main()
        {
            Application.Init();
            var container = new View() { Id = "Container", X = Pos.Center(), Y = Pos.Center(), Width = 16, Height = 16 };
            var top = new FrameView() { Id = "Top", Width = Dim.Fill(), Height = 12 };
            var bottom = new FrameView() { Id = "Bottom", Y = Pos.Bottom(top), Width = Dim.Fill(), Height = 4 };
            var label = new Label() {
                Id = "Label",
                X = Pos.Center(),
                Y = Pos.Center(),
                Text = "1\n2\n3\n4\n5\n6\n7\n8\n9\n10"
            };
            top.Add(label);
            container.Add(top, bottom);
            Application.Top.Add(container, debugLabel);

            Application.RootMouseEvent += (me) => Top_Resized(null, top, bottom, label, me);
            Application.Top.Resized += (obj) => Top_Resized(obj, top, bottom, label);
            Application.Run();

            return;
        }

        private static void Top_Resized(Size? obj, View top, View bottom, View label, MouseEvent? me = null)
        {
            top.GetCurrentWidth(out int topWidth);
            top.GetCurrentHeight(out int topHeight);
            bottom.GetCurrentWidth(out int bottomWidth);
            bottom.GetCurrentHeight(out int bottomHeight);
            label.GetCurrentWidth(out int labelWidth);
            label.GetCurrentHeight(out int labelHeight);
                       
            var sb = new StringBuilder();
            sb.AppendLine("Mouse");
            sb.AppendLine("###############");
            sb.AppendLine($"X: {me?.X}, Y: {me?.Y}");
            sb.AppendLine($"Under cursor: {me?.View.Id}");
            sb.AppendLine();
            sb.AppendLine("Size");
            sb.AppendLine("###############");
            sb.AppendLine($"Top: [{topHeight}, {topHeight}]");
            sb.AppendLine($"Bottom: [{bottomHeight}, {bottomHeight}]");
            sb.AppendLine($"Label: [{labelHeight}, {labelHeight}]");

            debugLabel.Text = sb.ToString();
        }
    }
}
@BDisp
Copy link
Collaborator

BDisp commented Jun 16, 2023

Here after the fix:

label-fix

@tig tig closed this as completed in #2718 Jul 5, 2023
tig added a commit that referenced this issue Jul 5, 2023
* Fixes #2717. Label not display fully when resizing terminal.

* Fixes #2719. View Move and ViewToScreen shouldn't use Clipped parameter as true by default but only for cursor.

* Fixes #2720. TextFormatter.Draw shouldn't set the Driver.Clip.

* Add braces.

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants