зеркало из
https://github.com/glebtv/tui-textarea.git
synced 2026-09-08 00:15:50 +03:00
remove Ctrl+V shortcut for paste
Этот коммит содержится в:
@@ -112,7 +112,7 @@ Default key mappings are as follows:
|
|||||||
| `Alt+D`, `Alt+Delete` | Delete one word next to cursor |
|
| `Alt+D`, `Alt+Delete` | Delete one word next to cursor |
|
||||||
| `Ctrl+U` | Undo |
|
| `Ctrl+U` | Undo |
|
||||||
| `Ctrl+R` | Redo |
|
| `Ctrl+R` | Redo |
|
||||||
| `Ctrl+Y`, `Ctrl+V` | Paste yanked text |
|
| `Ctrl+Y` | Paste yanked text |
|
||||||
| `Ctrl+F`, `→` | Move cursor forward by one character |
|
| `Ctrl+F`, `→` | Move cursor forward by one character |
|
||||||
| `Ctrl+B`, `←` | Move cursor backward by one character |
|
| `Ctrl+B`, `←` | Move cursor backward by one character |
|
||||||
| `Ctrl+P`, `↑` | Move cursor up by one line |
|
| `Ctrl+P`, `↑` | Move cursor up by one line |
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ use tui::style::{Modifier, Style};
|
|||||||
use tui::text::{Span, Spans, Text};
|
use tui::text::{Span, Spans, Text};
|
||||||
use tui::widgets::{Block, Paragraph, Widget};
|
use tui::widgets::{Block, Paragraph, Widget};
|
||||||
|
|
||||||
fn spaces(size: usize) -> &'static str {
|
fn spaces(size: u8) -> &'static str {
|
||||||
const SPACES: &str = " ";
|
const SPACES: &str = " ";
|
||||||
&SPACES[..size]
|
&SPACES[..size as usize]
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A type to manage state of textarea.
|
/// A type to manage state of textarea.
|
||||||
@@ -433,7 +433,7 @@ impl<'a> TextArea<'a> {
|
|||||||
alt: false,
|
alt: false,
|
||||||
} => self.redo(),
|
} => self.redo(),
|
||||||
Input {
|
Input {
|
||||||
key: Key::Char('y' | 'v'),
|
key: Key::Char('y'),
|
||||||
ctrl: true,
|
ctrl: true,
|
||||||
alt: false,
|
alt: false,
|
||||||
} => self.paste(),
|
} => self.paste(),
|
||||||
@@ -618,7 +618,7 @@ impl<'a> TextArea<'a> {
|
|||||||
if self.tab_len == 0 {
|
if self.tab_len == 0 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let len = self.tab_len as usize - self.cursor.1 % self.tab_len as usize;
|
let len = self.tab_len - (self.cursor.1 % self.tab_len as usize) as u8;
|
||||||
self.insert_str(spaces(len))
|
self.insert_str(spaces(len))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -932,8 +932,8 @@ impl<'a> TextArea<'a> {
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn widget(&'a self) -> impl Widget + 'a {
|
pub fn widget(&'a self) -> impl Widget + 'a {
|
||||||
fn num_digits(i: usize) -> usize {
|
fn num_digits(i: usize) -> u8 {
|
||||||
f64::log10(i as f64) as usize + 1
|
f64::log10(i as f64) as u8 + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut lines = Vec::with_capacity(self.lines.len());
|
let mut lines = Vec::with_capacity(self.lines.len());
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user