linebender / linebender/druid

Labels drawn inside a Split widget overflow their containers

Open
#442 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug widget
Dominant language
Rust
Stars
9.7k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

I have some code that creates a split layout:

```
fn ui_builder() -> impl Widget {
Split::horizontal(
Flex::column().with_child(Label::new("Sidebar goes here").center(), 1.),
Flex::column().with_child(Label::new("Task goes here").center(), 1.),
)
.draggable(true)
}
```

If I drag the split handle so that the left side of the `Split` is smaller than the width of the `Label` it contains, the label text overflows its container and into the right side of the split. This is what it looks like:

Screen Shot 2020-01-02 at 5 53 57 PM

I can reproduce the same issue by manually setting the size of the `Split`:

```
fn ui_builder() -> impl Widget {
Split::horizontal(
Flex::column().with_child(Label::new("Sidebar goes here").center(), 1.),
Flex::column().with_child(Label::new("Task goes here").center(), 1.),
)
.draggable(true)
.split_point(0.2)
}
```

If I use a `Button` instead of a `Label` as a child, the button resizes itself to fit inside the `Split` as expect. But the text inside the button overflows the `Split` container as well as the button. Here's the code to reproduce the issue:

```
fn ui_builder() -> impl Widget {
Split::horizontal(
Flex::column().with_child(Button::new("Button goes here", Button::noop).center(), 1.),
Flex::column().with_child(Label::new("Task goes here").center(), 1.),
)
.draggable(true)
.split_point(0.2)
}
```

Here's is what it produces:

Screen Shot 2020-01-02 at 6 00 57 PM

The issue occurs on the current `master` branch. I haven't had a chance to test it on `0.4`.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the overflow with the Split, Label, and Button examples in the issue, first narrowing the investigation to the widget layout and rendering paths for those components. Verify the behavior while dragging and with split_point(0.2); the issue is done when child text remains within its Split container at narrow sizes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.