diff --git a/cursive-core/src/view/scroll/core.rs b/cursive-core/src/view/scroll/core.rs index c5944b8c4..c8a4beb22 100644 --- a/cursive-core/src/view/scroll/core.rs +++ b/cursive-core/src/view/scroll/core.rs @@ -4,7 +4,7 @@ use crate::direction::Orientation; use crate::event::{AnyCb, Event, EventResult, Key, MouseButton, MouseEvent}; use crate::printer::Printer; use crate::rect::Rect; -use crate::theme::ColorStyle; +use crate::theme::{ColorStyle, PaletteColor}; use crate::view::{ScrollStrategy, Selector, SizeCache}; use crate::with::With; use crate::Vec2; @@ -141,18 +141,18 @@ impl Core { let lengths = self.scrollbar_thumb_lengths(); let offsets = self.scrollbar_thumb_offsets(lengths); - let line_c = XY::new("-", "|"); + let line_c = XY::new(("_", "▄"), ("|", "█")); let color = if printer.focused { - ColorStyle::highlight() + ColorStyle::new(PaletteColor::Highlight, PaletteColor::View) } else { - ColorStyle::highlight_inactive() + ColorStyle::new(PaletteColor::HighlightInactive, PaletteColor::View) }; XY::zip5(lengths, offsets, size, line_c, Orientation::pair()) .run_if( scrolling, - |(length, offset, size, c, orientation)| { + |(length, offset, size, (c, thumb_c), orientation)| { let start = printer .size .saturating_sub((1, 1)) @@ -160,16 +160,6 @@ impl Core { let offset = orientation.make_vec(offset, 0); printer.print_line(orientation, start, size, c); - - let thumb_c = if self - .thumb_grab - .map(|(o, _)| o == orientation) - .unwrap_or(false) - { - " " - } else { - "▒" - }; printer.with_color(color, |printer| { printer.print_line( orientation, @@ -183,7 +173,9 @@ impl Core { // Draw the X between the two scrollbars. if scrolling.both() { - printer.print(printer.size.saturating_sub((1, 1)), "╳"); + printer.with_color(color, |printer| { + printer.print(printer.size.saturating_sub((2, 1)), "▄█"); + }) } } diff --git a/cursive/Cargo.toml b/cursive/Cargo.toml index d163e54d6..beb9482af 100644 --- a/cursive/Cargo.toml +++ b/cursive/Cargo.toml @@ -57,7 +57,7 @@ atty = "0.2" [features] blt-backend = ["bear-lib-terminal"] -default = ["ncurses-backend"] +default = ["pancurses-backend"] ncurses-backend = ["ncurses", "maplit", "term_size"] pancurses-backend = ["pancurses", "maplit", "term_size"] termion-backend = ["termion"] diff --git a/cursive/src/backends/curses/pan.rs b/cursive/src/backends/curses/pan.rs index 5d80d1d7a..01329072b 100644 --- a/cursive/src/backends/curses/pan.rs +++ b/cursive/src/backends/curses/pan.rs @@ -308,7 +308,7 @@ impl Backend { let make_event = |event| Event::Mouse { offset: Vec2::zero(), - position: Vec2::new(mevent.x as usize, mevent.y as usize), + position: Vec2::new(mevent.x.max(0) as usize, mevent.y.max(0) as usize), event, };