diff --git a/src/xwindows/xwin.rs b/src/xwindows/xwin.rs index 8790e0c45..97c3bf07d 100644 --- a/src/xwindows/xwin.rs +++ b/src/xwindows/xwin.rs @@ -17,8 +17,8 @@ use std::os::unix::io::{AsRawFd, RawFd}; use std::process::Child; use std::process::Command; use std::rc::Rc; -use termwiz::hyperlink::Hyperlink; use term::{self, KeyCode, KeyModifiers, MouseButton, MouseEvent, MouseEventKind}; +use termwiz::hyperlink::Hyperlink; use xcb; /// Holds the terminal state for a tab owned by this window diff --git a/term/src/line.rs b/term/src/line.rs index 9d82e22f1..3d46f1c85 100644 --- a/term/src/line.rs +++ b/term/src/line.rs @@ -1,6 +1,6 @@ -use termwiz::hyperlink::Rule; use std::ops::Range; use std::str; +use termwiz::hyperlink::Rule; use super::*; @@ -266,12 +266,10 @@ impl Line { // Clear any cells that have implicit hyperlinks for mut cell in &mut self.cells { let replace = match cell.attrs().hyperlink { - Some(ref link) if link.is_implicit() => { - Some(Cell::new_grapheme( - cell.str(), - cell.attrs().clone().set_hyperlink(None).clone(), - )) - } + Some(ref link) if link.is_implicit() => Some(Cell::new_grapheme( + cell.str(), + cell.attrs().clone().set_hyperlink(None).clone(), + )), _ => None, }; if let Some(replace) = replace { diff --git a/termwiz/src/escape/osc.rs b/termwiz/src/escape/osc.rs index d50865696..35a1abfe8 100644 --- a/termwiz/src/escape/osc.rs +++ b/termwiz/src/escape/osc.rs @@ -1,8 +1,8 @@ use base64; use failure::{self, Error}; +pub use hyperlink::Hyperlink; use num; use std::fmt::{Display, Error as FmtError, Formatter}; -pub use hyperlink::Hyperlink; #[derive(Debug, Clone, PartialEq, Eq)] pub enum OperatingSystemCommand { diff --git a/termwiz/src/hyperlink.rs b/termwiz/src/hyperlink.rs index 22ebb181e..6c4fb8de2 100644 --- a/termwiz/src/hyperlink.rs +++ b/termwiz/src/hyperlink.rs @@ -57,7 +57,7 @@ impl Hyperlink { Self { uri: uri.into(), params, - implicit:false, + implicit: false, } } @@ -65,7 +65,7 @@ impl Hyperlink { Self { uri: uri.into(), params, - implicit:false, + implicit: false, } } @@ -219,9 +219,7 @@ impl Rule { .into_iter() .map(|m| { let url = m.expand(); - let link = Rc::new(Hyperlink::new_implicit( - url - )); + let link = Rc::new(Hyperlink::new_implicit(url)); RuleMatch { link, range: m.range(), @@ -246,9 +244,7 @@ mod test { Rule::match_hyperlinks(" http://example.com", &rules), vec![RuleMatch { range: 2..20, - link: Rc::new(Hyperlink::new_implicit( - "http://example.com", - )), + link: Rc::new(Hyperlink::new_implicit("http://example.com")), }] ); @@ -258,15 +254,11 @@ mod test { // Longest match first RuleMatch { range: 18..34, - link: Rc::new(Hyperlink::new_implicit( - "mailto:woot@example.com", - )), + link: Rc::new(Hyperlink::new_implicit("mailto:woot@example.com")), }, RuleMatch { range: 2..17, - link: Rc::new(Hyperlink::new_implicit( - "mailto:foo@example.com", - )), + link: Rc::new(Hyperlink::new_implicit("mailto:foo@example.com")), }, ] ); diff --git a/termwiz/src/surface/change.rs b/termwiz/src/surface/change.rs index b6d7b5069..1f985e692 100644 --- a/termwiz/src/surface/change.rs +++ b/termwiz/src/surface/change.rs @@ -1,6 +1,6 @@ use cell::{AttributeChange, CellAttributes}; use color::ColorAttribute; -use surface::{CursorShape,Position}; +use surface::{CursorShape, Position}; /// `Change` describes an update operation to be applied to a `Surface`. /// Changes to the active attributes (color, style), moving the cursor diff --git a/termwiz/src/surface/line.rs b/termwiz/src/surface/line.rs index 117315eb9..ccbae259f 100644 --- a/termwiz/src/surface/line.rs +++ b/termwiz/src/surface/line.rs @@ -57,12 +57,10 @@ impl Line { } for mut cell in &mut self.cells { let replace = match cell.attrs().hyperlink { - Some(ref link) if link.is_implicit() => { - Some(Cell::new_grapheme( - cell.str(), - cell.attrs().clone().set_hyperlink(None).clone(), - )) - } + Some(ref link) if link.is_implicit() => Some(Cell::new_grapheme( + cell.str(), + cell.attrs().clone().set_hyperlink(None).clone(), + )), _ => None, }; if let Some(replace) = replace { @@ -71,7 +69,7 @@ impl Line { } self.bits &= !LineBits::HAS_IMPLICIT_HYPERLINKS; - self.bits |= LineBits::SCANNED_IMPLICIT_HYPERLINKS|LineBits::DIRTY; + self.bits |= LineBits::SCANNED_IMPLICIT_HYPERLINKS | LineBits::DIRTY; } /// If we're about to modify a cell obscured by a double-width diff --git a/termwiz/src/surface/mod.rs b/termwiz/src/surface/mod.rs index a74cf2ab6..b3e53323c 100644 --- a/termwiz/src/surface/mod.rs +++ b/termwiz/src/surface/mod.rs @@ -4,12 +4,11 @@ use std::borrow::Cow; use std::cmp::min; use unicode_segmentation::UnicodeSegmentation; -pub mod line; pub mod change; +pub mod line; -pub use self::line::Line; pub use self::change::Change; - +pub use self::line::Line; /// Position holds 0-based positioning information, where /// Absolute(0) is the start of the line or column,