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

termwiz layouts #2543

Open
groves opened this issue Sep 22, 2022 · 1 comment
Open

termwiz layouts #2543

groves opened this issue Sep 22, 2022 · 1 comment
Labels
bug Something isn't working termwiz

Comments

@groves
Copy link
Contributor

groves commented Sep 22, 2022

What Operating System(s) are you seeing this problem on?

Linux Wayland

Which Wayland compositor or X11 Window manager(s) are you using?

No response

WezTerm version

a0afe9c

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

I copied the termwiz widget layout from widget_nested.rs into my project. With that I have a containing widget with vertical child orientation containing two children, one with 100% text height and another with a fixed height of 1 and a valign of bottom. With that setup, the 100% text height widget gets the full height of the container and the 1 height widget draws on top of the final line of the 100% text height widget.

I added a test to check on the issue here: groves@ac6edf9. With that, I get this layout result:

   LaidOutWidget {
        widget: WidgetId(
            16,
        ),
        rect: Rect {
            x: 0,
            y: 0,
            width: 100,
            height: 100,
        },
    },
    LaidOutWidget {
        widget: WidgetId(
            17,
        ),
        rect: Rect {
            x: 0,
            y: 0,
            width: 100,
            height: 100,
        },
    },
    LaidOutWidget {
        widget: WidgetId(
            18,
        ),
        rect: Rect {
            x: 0,
            y: 99,
            width: 100,
            height: 1,
        },
    }

You can see that widget id 17 gets a height of 100 but widget id 18 starts at y 99, 1 line into 17's space. I'd expect 17's height to be 99.

If I remove the set_valign, it works. I don't think the valign is necessary here, so that's a fine workaround for me. I don't think using a bottom valign should break this though, so I figured I'd report it.

I tried messing with the cassowary weights in update_widget_constraint, but I couldn't get this to balance out. I can dig into the layout constraints more, just figured I'd ask if there's an obvious fix I'm not seeing.

To Reproduce

Run groves@ac6edf9 or add this at line 85 in widgets_nested.rs:

            let dims = args.surface.dimensions();
            args.surface
                .add_change(format!("🤷 main surface size is {:?}", dims)); 

That'll print the size in the text input widget and you can see that it's the whole height of the terminal, not the height minus one.

Configuration

no config

Expected Behavior

Height of the 100% height widget to be 1 less than the container height.

Logs

No response

Anything else?

No response

@groves groves added the bug Something isn't working label Sep 22, 2022
@wez wez added the termwiz label Sep 23, 2022
@inferiorhumanorgans
Copy link

inferiorhumanorgans commented May 12, 2024

A quick look suggests that the solver is not taking into account fixed height children and that it's creating overlap even if the more flexible widget didn't get the entire height.

Adding a constraint so that the child top is below the current top edge seems to do the trick for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working termwiz
Projects
None yet
Development

No branches or pull requests

3 participants