diff options
author | Nathan Lilienthal <nathan@nixpulvis.com> | 2019-01-06 19:06:57 -0500 |
---|---|---|
committer | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-01-07 00:06:57 +0000 |
commit | 04707cbba630e3e4ad6b4200bef8ae7888c49e3b (patch) | |
tree | bd04f4964d4c4ad67cd565b38172b488172acfcc /src/term | |
parent | dfc30eeef5eb6df9f658e62875e5cde93173e37b (diff) | |
download | alacritty-04707cbba630e3e4ad6b4200bef8ae7888c49e3b.tar.gz alacritty-04707cbba630e3e4ad6b4200bef8ae7888c49e3b.zip |
Normalize Log Message Strings
The general style for errors, warnings and info messages is to start
with a capitalized letter and end without a period. The main exception
is when dealing with nouns that are clearer with special case handling,
e.g. "macOS failed to work" or "ioctl is borked".
Diffstat (limited to 'src/term')
-rw-r--r-- | src/term/mod.rs | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs index dadfaf78..a35a5df0 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -1167,7 +1167,7 @@ impl Term { /// Resize terminal to new dimensions pub fn resize(&mut self, size : &SizeInfo) { - debug!("Term::resize"); + debug!("Resizing terminal"); // Bounds check; lots of math assumes width and height are > 0 if size.width as usize <= 2 * self.size_info.padding_x as usize || @@ -1224,7 +1224,7 @@ impl Term { } } - debug!("num_cols, num_lines = {}, {}", num_cols, num_lines); + debug!("New num_cols is {} and num_lines is {}", num_cols, num_lines); // Resize grids to new size self.grid.resize(num_lines, num_cols, &Cell::default()); @@ -1276,7 +1276,7 @@ impl Term { /// Expects origin to be in scroll range. #[inline] fn scroll_down_relative(&mut self, origin: Line, mut lines: Line) { - trace!("scroll_down_relative: origin={}, lines={}", origin, lines); + trace!("Scrolling down relative: origin={}, lines={}", origin, lines); lines = min(lines, self.scroll_region.end - self.scroll_region.start); lines = min(lines, self.scroll_region.end - origin); @@ -1290,7 +1290,7 @@ impl Term { /// Expects origin to be in scroll range. #[inline] fn scroll_up_relative(&mut self, origin: Line, lines: Line) { - trace!("scroll_up_relative: origin={}, lines={}", origin, lines); + trace!("Scrolling up relative: origin={}, lines={}", origin, lines); let lines = min(lines, self.scroll_region.end - self.scroll_region.start); // Scroll from origin to bottom less number of lines @@ -1354,7 +1354,7 @@ impl ansi::Handler for Term { return; } - trace!("wrapping"); + trace!("Wrapping input"); { let location = Point { @@ -1434,7 +1434,7 @@ impl ansi::Handler for Term { #[inline] fn dectest(&mut self) { - trace!("dectest"); + trace!("Dectesting"); let mut template = self.cursor.template; template.c = 'E'; @@ -1444,7 +1444,7 @@ impl ansi::Handler for Term { #[inline] fn goto(&mut self, line: Line, col: Column) { - trace!("goto: line={}, col={}", line, col); + trace!("Going to: line={}, col={}", line, col); let (y_offset, max_y) = if self.mode.contains(mode::TermMode::ORIGIN) { (self.scroll_region.start, self.scroll_region.end - 1) } else { @@ -1458,13 +1458,13 @@ impl ansi::Handler for Term { #[inline] fn goto_line(&mut self, line: Line) { - trace!("goto_line: {}", line); + trace!("Going to line: {}", line); self.goto(line, self.cursor.point.col) } #[inline] fn goto_col(&mut self, col: Column) { - trace!("goto_col: {}", col); + trace!("Going to column: {}", col); self.goto(self.cursor.point.line, col) } @@ -1497,28 +1497,28 @@ impl ansi::Handler for Term { #[inline] fn move_up(&mut self, lines: Line) { - trace!("move_up: {}", lines); + trace!("Moving up: {}", lines); let move_to = Line(self.cursor.point.line.0.saturating_sub(lines.0)); self.goto(move_to, self.cursor.point.col) } #[inline] fn move_down(&mut self, lines: Line) { - trace!("move_down: {}", lines); + trace!("Moving down: {}", lines); let move_to = self.cursor.point.line + lines; self.goto(move_to, self.cursor.point.col) } #[inline] fn move_forward(&mut self, cols: Column) { - trace!("move_forward: {}", cols); + trace!("Moving forward: {}", cols); self.cursor.point.col = min(self.cursor.point.col + cols, self.grid.num_cols() - 1); self.input_needs_wrap = false; } #[inline] fn move_backward(&mut self, cols: Column) { - trace!("move_backward: {}", cols); + trace!("Moving backward: {}", cols); self.cursor.point.col -= min(self.cursor.point.col, cols); self.input_needs_wrap = false; } @@ -1530,7 +1530,7 @@ impl ansi::Handler for Term { #[inline] fn device_status<W: io::Write>(&mut self, writer: &mut W, arg: usize) { - trace!("device status: {}", arg); + trace!("Reporting device status: {}", arg); match arg { 5 => { let _ = writer.write_all(b"\x1b[0n"); @@ -1545,21 +1545,21 @@ impl ansi::Handler for Term { #[inline] fn move_down_and_cr(&mut self, lines: Line) { - trace!("move_down_and_cr: {}", lines); + trace!("Moving down and cr: {}", lines); let move_to = self.cursor.point.line + lines; self.goto(move_to, Column(0)) } #[inline] fn move_up_and_cr(&mut self, lines: Line) { - trace!("move_up_and_cr: {}", lines); + trace!("Moving up and cr: {}", lines); let move_to = Line(self.cursor.point.line.0.saturating_sub(lines.0)); self.goto(move_to, Column(0)) } #[inline] fn put_tab(&mut self, mut count: i64) { - trace!("put_tab: {}", count); + trace!("Putting tab: {}", count); while self.cursor.point.col < self.grid.num_cols() && count != 0 { count -= 1; @@ -1587,7 +1587,7 @@ impl ansi::Handler for Term { /// Backspace `count` characters #[inline] fn backspace(&mut self) { - trace!("backspace"); + trace!("Backspace"); if self.cursor.point.col > Column(0) { self.cursor.point.col -= 1; self.input_needs_wrap = false; @@ -1597,7 +1597,7 @@ impl ansi::Handler for Term { /// Carriage return #[inline] fn carriage_return(&mut self) { - trace!("carriage_return"); + trace!("Carriage return"); self.cursor.point.col = Column(0); self.input_needs_wrap = false; } @@ -1605,7 +1605,7 @@ impl ansi::Handler for Term { /// Linefeed #[inline] fn linefeed(&mut self) { - trace!("linefeed"); + trace!("Linefeed"); let next = self.cursor.point.line + 1; if next == self.scroll_region.end { self.scroll_up(Line(1)); @@ -1617,14 +1617,14 @@ impl ansi::Handler for Term { /// Set current position as a tabstop #[inline] fn bell(&mut self) { - trace!("bell"); + trace!("Bell"); self.visual_bell.ring(); self.next_is_urgent = Some(true); } #[inline] fn substitute(&mut self) { - trace!("[unimplemented] substitute"); + trace!("[unimplemented] Substitute"); } /// Run LF/NL @@ -1660,7 +1660,7 @@ impl ansi::Handler for Term { #[inline] fn set_horizontal_tabstop(&mut self) { - trace!("set_horizontal_tabstop"); + trace!("Setting horizontal tabstop"); let column = self.cursor.point.col; self.tabs[column] = true; } @@ -1679,7 +1679,7 @@ impl ansi::Handler for Term { #[inline] fn insert_blank_lines(&mut self, lines: Line) { - trace!("insert_blank_lines: {}", lines); + trace!("Inserting blank {} lines", lines); if self.scroll_region.contains_(self.cursor.point.line) { let origin = self.cursor.point.line; self.scroll_down_relative(origin, lines); @@ -1688,7 +1688,7 @@ impl ansi::Handler for Term { #[inline] fn delete_lines(&mut self, lines: Line) { - trace!("delete_lines: {}", lines); + trace!("Deleting {} lines", lines); if self.scroll_region.contains_(self.cursor.point.line) { let origin = self.cursor.point.line; self.scroll_up_relative(origin, lines); @@ -1697,7 +1697,7 @@ impl ansi::Handler for Term { #[inline] fn erase_chars(&mut self, count: Column) { - trace!("erase_chars: {}, {}", count, self.cursor.point.col); + trace!("Erasing chars: count={}, col={}", count, self.cursor.point.col); let start = self.cursor.point.col; let end = min(start + count, self.grid.num_cols() - 1); @@ -1737,7 +1737,7 @@ impl ansi::Handler for Term { #[inline] fn move_backward_tabs(&mut self, count: i64) { - trace!("move_backward_tabs: {}", count); + trace!("Moving backward {} tabs", count); for _ in 0..count { let mut col = self.cursor.point.col; @@ -1753,12 +1753,12 @@ impl ansi::Handler for Term { #[inline] fn move_forward_tabs(&mut self, count: i64) { - trace!("[unimplemented] move_forward_tabs: {}", count); + trace!("[unimplemented] Moving forward {} tabs", count); } #[inline] fn save_cursor_position(&mut self) { - trace!("CursorSave"); + trace!("Saving cursor position"); let cursor = if self.alt { &mut self.cursor_save_alt } else { @@ -1770,7 +1770,7 @@ impl ansi::Handler for Term { #[inline] fn restore_cursor_position(&mut self) { - trace!("CursorRestore"); + trace!("Restoring cursor position"); let source = if self.alt { &self.cursor_save_alt } else { @@ -1784,7 +1784,7 @@ impl ansi::Handler for Term { #[inline] fn clear_line(&mut self, mode: ansi::LineClearMode) { - trace!("clear_line: {:?}", mode); + trace!("Clearing line: {:?}", mode); let mut template = self.cursor.template; template.flags ^= template.flags; @@ -1815,7 +1815,7 @@ impl ansi::Handler for Term { /// Set the indexed color value #[inline] fn set_color(&mut self, index: usize, color: Rgb) { - trace!("set_color[{}] = {:?}", index, color); + trace!("Setting color[{}] = {:?}", index, color); self.colors[index] = color; self.color_modified[index] = true; } @@ -1823,7 +1823,7 @@ impl ansi::Handler for Term { /// Reset the indexed color to original value #[inline] fn reset_color(&mut self, index: usize) { - trace!("reset_color[{}]", index); + trace!("Reseting color[{}]", index); self.colors[index] = self.original_colors[index]; self.color_modified[index] = false; } @@ -1835,13 +1835,13 @@ impl ansi::Handler for Term { Clipboard::new() .and_then(|mut clipboard| clipboard.store_primary(string)) .unwrap_or_else(|err| { - warn!("Error storing selection to clipboard. {}", err); + warn!("Error storing selection to clipboard: {}", err); }); } #[inline] fn clear_screen(&mut self, mode: ansi::ClearMode) { - trace!("clear_screen: {:?}", mode); + trace!("Clearing screen: {:?}", mode); let mut template = self.cursor.template; template.flags ^= template.flags; @@ -1881,7 +1881,7 @@ impl ansi::Handler for Term { #[inline] fn clear_tabs(&mut self, mode: ansi::TabulationClearMode) { - trace!("clear_tabs: {:?}", mode); + trace!("Clearing tabs: {:?}", mode); match mode { ansi::TabulationClearMode::Current => { let column = self.cursor.point.col; @@ -1916,7 +1916,7 @@ impl ansi::Handler for Term { #[inline] fn reverse_index(&mut self) { - trace!("reverse_index"); + trace!("Reversing index"); // if cursor is at the top if self.cursor.point.line == self.scroll_region.start { self.scroll_down(Line(1)); @@ -1928,7 +1928,7 @@ impl ansi::Handler for Term { /// set a terminal attribute #[inline] fn terminal_attribute(&mut self, attr: Attr) { - trace!("Set Attribute: {:?}", attr); + trace!("Setting attribute: {:?}", attr); match attr { Attr::Foreground(color) => self.cursor.template.fg = color, Attr::Background(color) => self.cursor.template.bg = color, @@ -1959,7 +1959,7 @@ impl ansi::Handler for Term { #[inline] fn set_mode(&mut self, mode: ansi::Mode) { - trace!("set_mode: {:?}", mode); + trace!("Setting mode: {:?}", mode); match mode { ansi::Mode::SwapScreenAndSetRestoreCursor => { self.mode.insert(mode::TermMode::ALT_SCREEN); @@ -1991,15 +1991,15 @@ impl ansi::Handler for Term { ansi::Mode::Origin => self.mode.insert(mode::TermMode::ORIGIN), ansi::Mode::DECCOLM => self.deccolm(), ansi::Mode::Insert => self.mode.insert(mode::TermMode::INSERT), // heh - _ => { - trace!(".. ignoring set_mode"); + ansi::Mode::BlinkingCursor => { + trace!("... unimplemented mode"); } } } #[inline] fn unset_mode(&mut self,mode: ansi::Mode) { - trace!("unset_mode: {:?}", mode); + trace!("Unsetting mode: {:?}", mode); match mode { ansi::Mode::SwapScreenAndSetRestoreCursor => { self.mode.remove(mode::TermMode::ALT_SCREEN); @@ -2031,15 +2031,15 @@ impl ansi::Handler for Term { ansi::Mode::Origin => self.mode.remove(mode::TermMode::ORIGIN), ansi::Mode::DECCOLM => self.deccolm(), ansi::Mode::Insert => self.mode.remove(mode::TermMode::INSERT), - _ => { - trace!(".. ignoring unset_mode"); + ansi::Mode::BlinkingCursor => { + trace!("... unimplemented mode"); } } } #[inline] fn set_scrolling_region(&mut self, region: Range<Line>) { - trace!("set scroll region: {:?}", region); + trace!("Setting scrolling region: {:?}", region); self.scroll_region.start = min(region.start, self.grid.num_lines()); self.scroll_region.end = min(region.end, self.grid.num_lines()); self.goto(Line(0), Column(0)); @@ -2047,31 +2047,31 @@ impl ansi::Handler for Term { #[inline] fn set_keypad_application_mode(&mut self) { - trace!("set mode::TermMode::APP_KEYPAD"); + trace!("Setting keypad application mode"); self.mode.insert(mode::TermMode::APP_KEYPAD); } #[inline] fn unset_keypad_application_mode(&mut self) { - trace!("unset mode::TermMode::APP_KEYPAD"); + trace!("Unsetting keypad application mode"); self.mode.remove(mode::TermMode::APP_KEYPAD); } #[inline] fn configure_charset(&mut self, index: CharsetIndex, charset: StandardCharset) { - trace!("designate {:?} character set as {:?}", index, charset); + trace!("Configuring charset {:?} as {:?}", index, charset); self.cursor.charsets[index] = charset; } #[inline] fn set_active_charset(&mut self, index: CharsetIndex) { - trace!("Activate {:?} character set", index); + trace!("Setting active charset {:?}", index); self.active_charset = index; } #[inline] fn set_cursor_style(&mut self, style: Option<CursorStyle>) { - trace!("set_cursor_style {:?}", style); + trace!("Setting cursor style {:?}", style); self.cursor_style = style; } } |