ITADN

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

#826OpenCHr15W3 创建于 2025-06-22
bug
C
CHr15W3commented
**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](https://github.com/user-attachments/assets/4127e30c-60c8-4200-96f3-f8f6a18f10b1) 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
1 条评论