1
0
зеркало из https://github.com/glebtv/tui-textarea.git synced 2026-09-03 14:26:17 +03:00

implement Clone for TextArea and its dependencies

Этот коммит содержится в:
rhysd
2022-07-12 22:56:06 +09:00
родитель 9032320a7e
Коммит 421691d602
4 изменённых файлов: 11 добавлений и 0 удалений

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

@@ -54,6 +54,7 @@ impl EditKind {
}
}
#[derive(Clone)]
pub struct Edit {
kind: EditKind,
cursor_before: (usize, usize),
@@ -92,6 +93,7 @@ impl Edit {
}
}
#[derive(Clone)]
pub struct History {
index: usize,
max_items: usize,

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

@@ -1,6 +1,7 @@
use regex::Regex;
use tui::style::{Color, Style};
#[derive(Clone)]
pub struct Search {
pub pat: Option<Regex>,
pub style: Style,

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

@@ -31,6 +31,7 @@ use tui::widgets::{Block, Widget};
/// // Get lines as String.
/// println!("Lines: {:?}", textarea.lines());
/// ```
#[derive(Clone)]
pub struct TextArea<'a> {
lines: Vec<String>,
block: Option<Block<'a>>,

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

@@ -17,6 +17,13 @@ use tui::widgets::{Block, Paragraph, Widget};
#[derive(Default)]
pub struct ScrollTop(AtomicU32);
impl Clone for ScrollTop {
fn clone(&self) -> Self {
let u = self.0.load(Ordering::Relaxed);
ScrollTop(AtomicU32::new(u))
}
}
impl ScrollTop {
fn load(&self) -> (u16, u16) {
let u = self.0.load(Ordering::Relaxed);