1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//! Additional [`Mode`]s for Duat
//!
//! This module adds some very important `Mode`s, not only for base
//! Duat configuration, but also in extending it with a lot of
//! functionality.
//!
//! Chief among the extensible modes in here is the [`Prompt`] and
//! [`IncSearch`] `Mode`s, which can leverage traits to do a wide
//! variety of things:
//!
//! ```rust
//! # duat_core::doc_duat!(duat);
//! # use duat_base::modes::IncSearcher;
//! use duat::prelude::*;
//!
//! #[derive(Clone, Copy)]
//! struct KeepMatching;
//!
//! impl IncSearcher for KeepMatching {
//! fn search(&mut self, pa: &mut Pass, pat: &str, handle: Handle<Buffer>) {
//! handle.edit_all(pa, |mut c| {
//! c.set_caret_on_start();
//! let range = c.range();
//! if c.search(pat).range(range).next().is_none() {
//! c.destroy();
//! }
//! });
//! }
//!
//! fn prompt(&self) -> Text {
//! txt!("[Prompt]keep matching")
//! }
//! }
//! ```
//!
//! The above [`IncSearcher`] will do the incremental search, and keep
//! only the [`Cursor`]s that matched at some point inside of their
//! selections.
//!
//! [`Mode`]: duat_core::mode::Mode
//! [`Cursor`]: duat_core::mode::Cursor
use Mutex;
use ;
pub use crateadd_prompt_hook;
pub use crate;
static CLIPBOARD: = new;
/// Copy the text of the [`Selection`]s in the [`Handle`]
///
/// This function does _not_ make use of the same clipboard as
/// [`duat_core::clipboard`]. That one acts in the same way as the
/// system's clipboard.
///
/// This clipboard is able to store any number of selections, which
/// can later be copied via [`paste_strings`]. If only one non empty
/// selection is copied, it will also be copied to the system's
/// clipboard.
///
/// [`Selection`]: duat_core::mode::Selection
/// Pastes the strings copied with [`copy_selections`]
///
/// If the system clipboard was updated since after the last call to
/// [`copy_selections`], this function will return a one element
/// [`Vec<String>`] with the new contents of the system clipboard,
/// instead of the selections taken via [`copy_selections`].