~ireas/rusty-man

637338cde57edf58aade880395981198c9c9bc38 — Robin Krahl 3 months ago 4950e8a master
Fix code formatting
2 files changed, 9 insertions(+), 9 deletions(-)

M src/viewer/tui/mod.rs
M src/viewer/utils.rs
M src/viewer/tui/mod.rs => src/viewer/tui/mod.rs +6 -8
@@ 7,7 7,9 @@ use std::convert;

use anyhow::Context as _;
use cursive::view::{Resizable as _, Scrollable as _};
use cursive::views::{Dialog, EditView, LinearLayout, OnEventView, PaddedView, Panel, SelectView, TextView};
use cursive::views::{
    Dialog, EditView, LinearLayout, OnEventView, PaddedView, Panel, SelectView, TextView,
};
use cursive::{event, theme, utils::markup};
use cursive_markup::MarkupView;



@@ 119,8 121,8 @@ impl<'s> TuiManRenderer<'s> {
    }

    fn into_view(self) -> impl cursive::View {
        use cursive::With as _;
        use cursive::view::scroll::Scroller as _;
        use cursive::With as _;

        let title = format!("{} {}", self.doc_ty.name(), self.doc_name);
        let scroll = self.layout.scrollable();


@@ 129,18 131,14 @@ impl<'s> TuiManRenderer<'s> {
            .on_pre_event_inner(event::Key::PageUp, |v, _| {
                let scroller = v.get_scroller_mut();
                if scroller.can_scroll_up() {
                    scroller.scroll_up(
                        scroller.last_outer_size().y.saturating_sub(1),
                    );
                    scroller.scroll_up(scroller.last_outer_size().y.saturating_sub(1));
                }
                Some(event::EventResult::Consumed(None))
            })
            .on_pre_event_inner(event::Key::PageDown, |v, _| {
                let scroller = v.get_scroller_mut();
                if scroller.can_scroll_down() {
                    scroller.scroll_down(
                        scroller.last_outer_size().y.saturating_sub(1),
                    );
                    scroller.scroll_down(scroller.last_outer_size().y.saturating_sub(1));
                }
                Some(event::EventResult::Consumed(None))
            });

M src/viewer/utils.rs => src/viewer/utils.rs +3 -1
@@ 177,7 177,9 @@ where
}

fn is_pre(ts: &RichString) -> bool {
    ts.tag.iter().any(|tag| matches!(tag, text_renderer::RichAnnotation::Preformat(_)))
    ts.tag
        .iter()
        .any(|tag| matches!(tag, text_renderer::RichAnnotation::Preformat(_)))
}

#[derive(Clone, Debug, Default)]