diff --git a/src/buffer.rs b/src/buffer.rs index 44d50d5..f004cf3 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -3,7 +3,7 @@ use std::ops::{Add, AddAssign, Neg, Range, Sub, SubAssign}; use crossterm::style::ContentStyle; use crate::styled::Styled; -use crate::widthdb::WidthDB; +use crate::widthdb::WidthDb; #[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] pub struct Size { @@ -362,7 +362,7 @@ impl Buffer { /// /// The initial x position is considered the first column for tab width /// calculations. - pub fn write(&mut self, widthdb: &mut WidthDB, pos: Pos, styled: &Styled) { + pub fn write(&mut self, widthdb: &mut WidthDb, pos: Pos, styled: &Styled) { let frame = self.current_frame(); let (xrange, yrange) = match frame.legal_ranges() { Some(ranges) => ranges, diff --git a/src/frame.rs b/src/frame.rs index 235c7dd..5bb4436 100644 --- a/src/frame.rs +++ b/src/frame.rs @@ -3,12 +3,12 @@ use crate::buffer::Buffer; pub use crate::buffer::{Pos, Size}; use crate::styled::Styled; -use crate::widthdb::WidthDB; +use crate::widthdb::WidthDb; use crate::wrap; #[derive(Debug, Default)] pub struct Frame { - pub(crate) widthdb: WidthDB, + pub(crate) widthdb: WidthDb, pub(crate) buffer: Buffer, } @@ -45,7 +45,7 @@ impl Frame { self.set_cursor(None); } - pub fn widthdb(&mut self) -> &mut WidthDB { + pub fn widthdb(&mut self) -> &mut WidthDb { &mut self.widthdb } diff --git a/src/widthdb.rs b/src/widthdb.rs index d926c26..585bc4f 100644 --- a/src/widthdb.rs +++ b/src/widthdb.rs @@ -12,14 +12,14 @@ use crate::wrap; /// Measures and stores the with (in terminal coordinates) of graphemes. #[derive(Debug)] -pub struct WidthDB { +pub struct WidthDb { pub(crate) active: bool, pub(crate) tab_width: u8, known: HashMap, requested: HashSet, } -impl Default for WidthDB { +impl Default for WidthDb { fn default() -> Self { Self { active: false, @@ -30,7 +30,7 @@ impl Default for WidthDB { } } -impl WidthDB { +impl WidthDb { /// Determine the width of a tab character starting at the specified column. fn tab_width_at_column(&self, col: usize) -> u8 { self.tab_width - (col % self.tab_width as usize) as u8 diff --git a/src/wrap.rs b/src/wrap.rs index 4ebed46..a0f4e0d 100644 --- a/src/wrap.rs +++ b/src/wrap.rs @@ -3,9 +3,9 @@ use unicode_linebreak::BreakOpportunity; use unicode_segmentation::UnicodeSegmentation; -use crate::widthdb::WidthDB; +use crate::widthdb::WidthDb; -pub fn wrap(widthdb: &mut WidthDB, text: &str, width: usize) -> Vec { +pub fn wrap(widthdb: &mut WidthDb, text: &str, width: usize) -> Vec { let mut breaks = vec![]; let mut break_options = unicode_linebreak::linebreaks(text).peekable();