1
0
зеркало из https://github.com/glebtv/tui-textarea.git synced 2026-08-28 11:36:17 +03:00
Этот коммит содержится в:
rhysd
2024-08-02 23:07:17 +09:00
родитель ef28d09ae8
Коммит e5500dfa61
6 изменённых файлов: 11 добавлений и 8 удалений

2
.typos.toml Обычный файл
Просмотреть файл

@@ -0,0 +1,2 @@
[default.extend-words]
ratatui = "ratatui"

Просмотреть файл

@@ -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;

Просмотреть файл

@@ -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;

Просмотреть файл

@@ -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;

Просмотреть файл

@@ -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)

Просмотреть файл

@@ -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)][..],
),