1
0
зеркало из https://github.com/glebtv/tui-textarea.git synced 2026-09-03 14:26:17 +03:00
Этот коммит содержится в:
achristmascarl
2024-08-06 12:33:10 -04:00
родитель 60943f8b14
Коммит 23dfde75bd

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

@@ -2003,6 +2003,26 @@ impl<'a> TextArea<'a> {
self.cursor
}
/// Get the current selection start position. 0-base character-wise (row, col) selection start position.
/// ```
/// use tui_textarea::TextArea;
///
/// let mut textarea = TextArea::default();
/// assert_eq!(textarea.selection_start(), None);
/// textarea.insert_char('a');
/// textarea.insert_newline();
/// textarea.insert_char('b');
///
/// textarea.start_selection();
/// assert_eq!(textarea.selection_start(), Some((0, 0)));
/// textarea.move_cursor(CursorMove::Forward);
/// assert_eq!(textarea.selection_start(), Some((0, 0)));
/// ```
pub fn selection_start(&self) -> Option<(usize, usize)> {
self.selection_start
}
/// Set text alignment. When [`Alignment::Center`] or [`Alignment::Right`] is set, line number is automatically
/// disabled because those alignments don't work well with line numbers.
/// ```