diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 0000000..372dc95 --- /dev/null +++ b/.typos.toml @@ -0,0 +1,2 @@ +[default.extend-words] +ratatui = "ratatui" diff --git a/src/cursor.rs b/src/cursor.rs index b54c636..5333b64 100644 --- a/src/cursor.rs +++ b/src/cursor.rs @@ -373,7 +373,7 @@ impl CursorMove { #[cfg(test)] mod tests { - // Seaparate tests for tui-rs support + // Separate tests for tui-rs support #[test] fn in_viewport() { use crate::ratatui::buffer::Buffer; diff --git a/src/scroll.rs b/src/scroll.rs index 23f301f..6dc7ce5 100644 --- a/src/scroll.rs +++ b/src/scroll.rs @@ -1,6 +1,7 @@ use crate::widget::Viewport; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; + /// Specify how to scroll the textarea. /// /// This type is marked as `#[non_exhaustive]` since more variations may be supported in the future. Note that the cursor will @@ -188,7 +189,7 @@ impl From<(i16, i16)> for Scrolling { mod tests { use super::*; - // Seaparate tests for tui-rs support + // Separate tests for tui-rs support #[test] fn delta() { use crate::ratatui::buffer::Buffer; diff --git a/src/textarea.rs b/src/textarea.rs index 6c216f2..dbd588f 100644 --- a/src/textarea.rs +++ b/src/textarea.rs @@ -1648,7 +1648,7 @@ impl<'a> TextArea<'a> { /// ``` #[deprecated( since = "0.5.3", - note = "calling this method is no longer neccessary on rendering a textarea. pass &TextArea reference to `Frame::render_widget` method call directly" + note = "calling this method is no longer necessary on rendering a textarea. pass &TextArea reference to `Frame::render_widget` method call directly" )] pub fn widget(&'a self) -> impl Widget + 'a { self @@ -2362,7 +2362,7 @@ impl<'a> TextArea<'a> { mod tests { use super::*; - // Seaparate tests for tui-rs support + // Separate tests for tui-rs support #[test] fn scroll() { use crate::ratatui::buffer::Buffer; diff --git a/src/widget.rs b/src/widget.rs index 6afd884..7ea9f7f 100644 --- a/src/widget.rs +++ b/src/widget.rs @@ -115,9 +115,9 @@ impl<'a> TextArea<'a> { fn scroll_top_col(&self, prev_top: u16, width: u16) -> u16 { let mut cursor = self.cursor().1 as u16; + // Adjust the cursor position due to the width of line number. if self.line_number_style().is_some() { - // Adjust the cursor position due to the width of line number. `+ 2` for margins - let lnum = num_digits(self.lines().len()) as u16 + 2; + let lnum = num_digits(self.lines().len()) as u16 + 2; // `+ 2` for margins if cursor <= lnum { cursor *= 2; // Smoothly slide the line number into the screen on scrolling left } else { @@ -155,7 +155,7 @@ impl Widget for &TextArea<'_> { if let Some(b) = self.block() { text_area = b.inner(area); // ratatui does not need `clone()` call because `Block` implements `WidgetRef` and `&T` implements `Widget` - // where `T: Widget`. So `b.render` internally calls `b.render_ref` and it doesn't move out `self`. + // where `T: WidgetRef`. So `b.render` internally calls `b.render_ref` and it doesn't move out `self`. #[cfg(feature = "tuirs")] let b = b.clone(); b.render(area, buf) diff --git a/tests/cursor.rs b/tests/cursor.rs index 3b921f2..4a88ac0 100644 --- a/tests/cursor.rs +++ b/tests/cursor.rs @@ -286,7 +286,7 @@ fn word_end() { for (lines, positions) in [ ( &[ - "aaa !!! bbb", // Consective punctuations are a word + "aaa !!! bbb", // Consecutive punctuations are a word ][..], &[(0, 2), (0, 6), (0, 10)][..], ),