зеркало из
https://github.com/glebtv/tui-textarea.git
synced 2026-09-08 00:15:50 +03:00
implement Clone for TextArea and its dependencies
Этот коммит содержится в:
@@ -54,6 +54,7 @@ impl EditKind {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
pub struct Edit {
|
pub struct Edit {
|
||||||
kind: EditKind,
|
kind: EditKind,
|
||||||
cursor_before: (usize, usize),
|
cursor_before: (usize, usize),
|
||||||
@@ -92,6 +93,7 @@ impl Edit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
pub struct History {
|
pub struct History {
|
||||||
index: usize,
|
index: usize,
|
||||||
max_items: usize,
|
max_items: usize,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use tui::style::{Color, Style};
|
use tui::style::{Color, Style};
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
pub struct Search {
|
pub struct Search {
|
||||||
pub pat: Option<Regex>,
|
pub pat: Option<Regex>,
|
||||||
pub style: Style,
|
pub style: Style,
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ use tui::widgets::{Block, Widget};
|
|||||||
/// // Get lines as String.
|
/// // Get lines as String.
|
||||||
/// println!("Lines: {:?}", textarea.lines());
|
/// println!("Lines: {:?}", textarea.lines());
|
||||||
/// ```
|
/// ```
|
||||||
|
#[derive(Clone)]
|
||||||
pub struct TextArea<'a> {
|
pub struct TextArea<'a> {
|
||||||
lines: Vec<String>,
|
lines: Vec<String>,
|
||||||
block: Option<Block<'a>>,
|
block: Option<Block<'a>>,
|
||||||
|
|||||||
@@ -17,6 +17,13 @@ use tui::widgets::{Block, Paragraph, Widget};
|
|||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct ScrollTop(AtomicU32);
|
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 {
|
impl ScrollTop {
|
||||||
fn load(&self) -> (u16, u16) {
|
fn load(&self) -> (u16, u16) {
|
||||||
let u = self.0.load(Ordering::Relaxed);
|
let u = self.0.load(Ordering::Relaxed);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user