зеркало из
https://github.com/glebtv/tui-textarea.git
synced 2026-09-03 14:26:17 +03:00
add TextArea::is_empty()
Этот коммит содержится в:
@@ -1071,6 +1071,20 @@ impl<'a> TextArea<'a> {
|
||||
pub fn cursor(&self) -> (usize, usize) {
|
||||
self.cursor
|
||||
}
|
||||
|
||||
/// Check if the textarea has a empty content.
|
||||
/// ```
|
||||
/// use tui_textarea::TextArea;
|
||||
///
|
||||
/// let textarea = TextArea::default();
|
||||
/// assert!(textarea.is_empty());
|
||||
///
|
||||
/// let textarea = TextArea::from(["hello"]);
|
||||
/// assert!(!textarea.is_empty());
|
||||
/// ```
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.lines == [""]
|
||||
}
|
||||
}
|
||||
|
||||
struct Renderer<'a> {
|
||||
|
||||
Ссылка в новой задаче
Block a user