cursive icon indicating copy to clipboard operation
cursive copied to clipboard

[BUG] ScrollView.show_scrollbars(false) only hides thumb, not entire bar

Open CHr15W3 opened this issue 9 months ago • 1 comments

Describe the bug Based on the description, I assumed that .show_scrollbars(false) would hide the entire scrollbar, however, when I try it only hides the thumb elements.

To Reproduce

struct MyWidget{
    pub size: Vec2
}

impl View for MyWidget {
    fn draw(&self, printer: &Printer) {
        printer.with_color(ColorStyle::new(ColorType::Palette(Primary), ColorType::Palette(Primary)), |p| {
            let size = self.size;
            for x in 0..size.x{
                for y in 0..size.y{
                    p.print((x, y), " ")
                }
            }
        })
    } 

    fn required_size(&mut self, _constraint: Vec2) -> Vec2 {
        self.size
    }
}
fn main() {
// [...]
    siv.add_fullscreen_layer(
        ScrollView::new(
            MyWidget::new()
                .with_size(Vec2::new(1000, 1000))
        )
        .show_scrollbars(false)
    );
//  [...]
}

This results in the entire terminal being filled with "white" except the rightmost column; the constraint for the required_size of the widget is also one less than the width of the terminal.

Expected behavior I would expect this option to not show the scrollbar, while also giving one more column to the content.

Screenshots

Image The contrast is not great. The darkest gray is the terminals background, the lighter gray is the scrollbar.

Environment

  • Operating system used: Fedora 41
  • Backend used: crossterm, but default has same behaviour
  • Current locale:
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
  • Cursive version: crates.io, 0.21.1, features=toml

CHr15W3 avatar Jun 22 '25 16:06 CHr15W3

Hi, and thanks for the report!

Indeed, there was an error in the layout logic with hidden scrollbars. It should be fixed on the latest commit.

gyscos avatar Sep 26 '25 15:09 gyscos