diff options
author | Joe Wilm <joe@jwilm.com> | 2016-12-16 22:48:04 -0800 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-12-16 22:48:04 -0800 |
commit | bde4dacc791501440515c1a51ad2fcb0256cf04c (patch) | |
tree | 66bd6762c4ae11705d1a82ed72112a408e5ec2d5 /src | |
parent | 781572096ea67516a98872b1b3c5b1ffaea9bae0 (diff) | |
download | alacritty-bde4dacc791501440515c1a51ad2fcb0256cf04c.tar.gz alacritty-bde4dacc791501440515c1a51ad2fcb0256cf04c.zip |
Misc formatting fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/ansi.rs | 49 | ||||
-rw-r--r-- | src/config.rs | 8 | ||||
-rw-r--r-- | src/display.rs | 6 | ||||
-rw-r--r-- | src/event_loop.rs | 14 | ||||
-rw-r--r-- | src/grid.rs | 8 | ||||
-rw-r--r-- | src/meter.rs | 4 | ||||
-rw-r--r-- | src/renderer/mod.rs | 9 | ||||
-rw-r--r-- | src/term/mod.rs | 24 | ||||
-rw-r--r-- | src/util.rs | 5 |
9 files changed, 82 insertions, 45 deletions
diff --git a/src/ansi.rs b/src/ansi.rs index 1848b9ca..633a7e54 100644 --- a/src/ansi.rs +++ b/src/ansi.rs @@ -176,13 +176,14 @@ pub trait Handler { /// Erase `count` chars in current line following cursor /// - /// Erase means resetting to the default state (default colors, no content, no mode flags) + /// Erase means resetting to the default state (default colors, no content, + /// no mode flags) fn erase_chars(&mut self, Column) {} /// Delete `count` chars /// - /// Deleting a character is like the delete key on the keyboard - everything to the right of the - /// deleted things is shifted left. + /// Deleting a character is like the delete key on the keyboard - everything + /// to the right of the deleted things is shifted left. fn delete_chars(&mut self, Column) {} /// Move backward `count` tabs @@ -211,8 +212,9 @@ pub trait Handler { /// Reverse Index /// - /// Move the active position to the same horizontal position on the preceding line. If the - /// active position is at the top margin, a scroll down is performed + /// Move the active position to the same horizontal position on the + /// preceding line. If the active position is at the top margin, a scroll + /// down is performed fn reverse_index(&mut self) {} /// set a terminal attribute @@ -690,7 +692,13 @@ impl<'a, H, W> vte::Perform for Performer<'a, H, W> } #[inline] - fn esc_dispatch(&mut self, params: &[i64], intermediates: &[u8], _ignore: bool, byte: u8) { + fn esc_dispatch( + &mut self, + params: &[i64], + intermediates: &[u8], + _ignore: bool, + byte: u8 + ) { match byte { b'D' => self.handler.linefeed(), b'E' => self.handler.newline(), @@ -998,19 +1006,22 @@ mod tests { #[test] fn parse_zsh_startup() { static BYTES: &'static [u8] = &[ - 0x1b, 0x5b, 0x31, 0x6d, 0x1b, 0x5b, 0x37, 0x6d, 0x25, 0x1b, 0x5b, 0x32, 0x37, 0x6d, - 0x1b, 0x5b, 0x31, 0x6d, 0x1b, 0x5b, 0x30, 0x6d, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x0d, 0x20, 0x0d, 0x0d, 0x1b, 0x5b, 0x30, 0x6d, 0x1b, 0x5b, 0x32, - 0x37, 0x6d, 0x1b, 0x5b, 0x32, 0x34, 0x6d, 0x1b, 0x5b, 0x4a, 0x6a, 0x77, 0x69, 0x6c, - 0x6d, 0x40, 0x6a, 0x77, 0x69, 0x6c, 0x6d, 0x2d, 0x64, 0x65, 0x73, 0x6b, 0x20, 0x1b, - 0x5b, 0x30, 0x31, 0x3b, 0x33, 0x32, 0x6d, 0xe2, 0x9e, 0x9c, 0x20, 0x1b, 0x5b, 0x30, - 0x31, 0x3b, 0x33, 0x32, 0x6d, 0x20, 0x1b, 0x5b, 0x33, 0x36, 0x6d, 0x7e, 0x2f, 0x63, - 0x6f, 0x64, 0x65 + 0x1b, 0x5b, 0x31, 0x6d, 0x1b, 0x5b, 0x37, 0x6d, 0x25, 0x1b, 0x5b, + 0x32, 0x37, 0x6d, 0x1b, 0x5b, 0x31, 0x6d, 0x1b, 0x5b, 0x30, 0x6d, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x0d, 0x20, 0x0d, 0x0d, 0x1b, 0x5b, 0x30, 0x6d, 0x1b, + 0x5b, 0x32, 0x37, 0x6d, 0x1b, 0x5b, 0x32, 0x34, 0x6d, 0x1b, 0x5b, + 0x4a, 0x6a, 0x77, 0x69, 0x6c, 0x6d, 0x40, 0x6a, 0x77, 0x69, 0x6c, + 0x6d, 0x2d, 0x64, 0x65, 0x73, 0x6b, 0x20, 0x1b, 0x5b, 0x30, 0x31, + 0x3b, 0x33, 0x32, 0x6d, 0xe2, 0x9e, 0x9c, 0x20, 0x1b, 0x5b, 0x30, + 0x31, 0x3b, 0x33, 0x32, 0x6d, 0x20, 0x1b, 0x5b, 0x33, 0x36, 0x6d, + 0x7e, 0x2f, 0x63, 0x6f, 0x64, 0x65 ]; let mut handler = AttrHandler::default(); diff --git a/src/config.rs b/src/config.rs index a6d8150e..aca16a1d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -459,7 +459,10 @@ impl de::Deserialize for RawBinding { impl Visitor for RawBindingVisitor { type Value = RawBinding; - fn visit_map<V>(&mut self, mut visitor: V) -> ::std::result::Result<RawBinding, V::Error> + fn visit_map<V>( + &mut self, + mut visitor: V + ) -> ::std::result::Result<RawBinding, V::Error> where V: MapVisitor, { let mut mods: Option<::glutin::Mods> = None; @@ -1129,7 +1132,8 @@ impl Monitor { if op.contains(op::IGNORED) { if let Some(path) = path.as_ref() { if let Err(err) = watcher.watch(&path) { - err_println!("failed to establish watch on {:?}: {:?}", path, err); + err_println!("failed to establish watch on {:?}: {:?}", + path, err); } } } diff --git a/src/display.rs b/src/display.rs index b6c5f401..a6b6528d 100644 --- a/src/display.rs +++ b/src/display.rs @@ -176,7 +176,11 @@ impl Display { } /// Process pending resize events - pub fn handle_resize(&mut self, terminal: &mut MutexGuard<Term>, items: &mut [&mut OnResize]) { + pub fn handle_resize( + &mut self, + terminal: &mut MutexGuard<Term>, + items: &mut [&mut OnResize] + ) { // Resize events new_size and are handled outside the poll_events // iterator. This has the effect of coalescing multiple resize // events into one. diff --git a/src/event_loop.rs b/src/event_loop.rs index e8e323e4..44d71f94 100644 --- a/src/event_loop.rs +++ b/src/event_loop.rs @@ -174,7 +174,14 @@ impl<Io> EventLoop<Io> } #[inline] - fn pty_read<W: Write>(&mut self, state: &mut State, buf: &mut [u8], mut writer: Option<&mut W>) { + fn pty_read<W>( + &mut self, + state: &mut State, + buf: &mut [u8], + mut writer: Option<&mut W> + ) + where W: Write + { loop { match self.pty.read(&mut buf[..]) { Ok(0) => break, @@ -234,7 +241,10 @@ impl<Io> EventLoop<Io> } } - pub fn spawn(mut self, state: Option<State>) -> thread::JoinHandle<(EventLoop<Io>, State)> { + pub fn spawn( + mut self, + state: Option<State> + ) -> thread::JoinHandle<(EventLoop<Io>, State)> { thread::spawn_named("pty reader", move || { let mut state = state.unwrap_or_else(Default::default); let mut buf = [0u8; 4096]; diff --git a/src/grid.rs b/src/grid.rs index 7192b996..d8b701b9 100644 --- a/src/grid.rs +++ b/src/grid.rs @@ -331,9 +331,9 @@ row_index_range!(RangeTo<usize>); row_index_range!(RangeFrom<usize>); row_index_range!(RangeFull); -// ------------------------------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // Row ranges for Grid -// ------------------------------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- impl<T> Index<Range<index::Line>> for Grid<T> { type Output = [Row<T>]; @@ -383,9 +383,9 @@ impl<T> IndexMut<RangeFrom<index::Line>> for Grid<T> { } } -// ------------------------------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // Column ranges for Row -// ------------------------------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- impl<T> Index<Range<index::Column>> for Row<T> { type Output = [T]; diff --git a/src/meter.rs b/src/meter.rs index 2dc2ed21..58c92145 100644 --- a/src/meter.rs +++ b/src/meter.rs @@ -27,8 +27,8 @@ //! let _sampler = meter.sampler(); //! } //! -//! // Get the moving average. The meter tracks a fixed number of samles, and the average won't mean -//! // much until it's filled up at least once. +//! // Get the moving average. The meter tracks a fixed number of samles, and +//! // the average won't mean much until it's filled up at least once. //! println!("Average time: {}", meter.average()); use std::time::{Instant, Duration}; diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index d771b6dc..79cfd665 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -127,7 +127,9 @@ impl GlyphCache { // Load regular font let regular_desc = FontDesc::new(font.family(), font.style()); - let regular = rasterizer.load_font(®ular_desc, size).expect("regular font load ok"); + let regular = rasterizer + .load_font(®ular_desc, size) + .expect("regular font load ok"); // Load bold font let bold_style = font.bold_style().unwrap_or("Bold"); @@ -1192,8 +1194,9 @@ impl Atlas { /// Insert the glyph without checking for room /// - /// Internal function for use once atlas has been checked for space. GL errors could still occur - /// at this point if we were checking for them; hence, the Result. + /// Internal function for use once atlas has been checked for space. GL + /// errors could still occur at this point if we were checking for them; + /// hence, the Result. fn insert_inner(&mut self, glyph: &RasterizedGlyph, active_tex: &mut u32) diff --git a/src/term/mod.rs b/src/term/mod.rs index 1bed8134..777c3bce 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -343,8 +343,8 @@ impl Term { return; } - // Scroll up to keep cursor and as much context as possible in grid. This only runs when the - // lines decreases. + // Scroll up to keep cursor and as much context as possible in grid. + // This only runs when the lines decreases. self.scroll_region = Line(0)..self.grid.num_lines(); // Scroll up to keep cursor in terminal @@ -366,8 +366,9 @@ impl Term { self.cursor.col = limit(self.cursor.col, Column(0), num_cols); // Recreate tabs list - self.tabs = (Column(0)..self.grid.num_cols()).map(|i| (*i as usize) % TAB_SPACES == 0) - .collect::<Vec<bool>>(); + self.tabs = (Column(0)..self.grid.num_cols()) + .map(|i| (*i as usize) % TAB_SPACES == 0) + .collect::<Vec<bool>>(); self.tabs[0] = false; @@ -707,7 +708,8 @@ impl ansi::Handler for Term { ptr::copy(src, dst, n); } - // Clear last `count` cells in line. If deleting 1 char, need to delete 1 cell. + // Clear last `count` cells in line. If deleting 1 char, need to delete + // 1 cell. let template = self.empty_cell.clone(); let end = self.size_info.cols() - count; for c in &mut line[end..] { @@ -946,13 +948,13 @@ mod bench { /// Benchmark for the renderable cells iterator /// - /// The renderable cells iterator yields cells that require work to be displayed (that is, not a - /// an empty background cell). This benchmark measures how long it takes to process the whole - /// iterator. + /// The renderable cells iterator yields cells that require work to be + /// displayed (that is, not a an empty background cell). This benchmark + /// measures how long it takes to process the whole iterator. /// - /// When this benchmark was first added, it averaged ~78usec on my macbook pro. The total - /// render time for this grid is anywhere between ~1500 and ~2000usec (measured imprecisely with - /// the visual meter). + /// When this benchmark was first added, it averaged ~78usec on my macbook + /// pro. The total render time for this grid is anywhere between ~1500 and + /// ~2000usec (measured imprecisely with the visual meter). #[bench] fn render_iter(b: &mut test::Bencher) { // Need some realistic grid state; using one of the ref files. diff --git a/src/util.rs b/src/util.rs index eddb2a5a..0607ff61 100644 --- a/src/util.rs +++ b/src/util.rs @@ -21,7 +21,10 @@ pub mod thread { T: Send + 'static, S: Into<String> { - ::std::thread::Builder::new().name(name.into()).spawn(f).expect("thread spawn works") + ::std::thread::Builder::new() + .name(name.into()) + .spawn(f) + .expect("thread spawn works") } pub use ::std::thread::*; |