Skip to content

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Aug 2, 2024
1 parent ef28d09 commit e5500df
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[default.extend-words]
ratatui = "ratatui"
2 changes: 1 addition & 1 deletion src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/scroll.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/textarea.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)][..],
),
Expand Down

0 comments on commit e5500df

Please sign in to comment.