mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-12 20:23:35 +00:00
Adding disable/enable functionality to text_area
This commit is contained in:
parent
3588955f0b
commit
9df4b21a26
@ -107,6 +107,37 @@ impl TextArea {
|
|||||||
self.with(|s| s.set_content(content))
|
self.with(|s| s.set_content(content))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Disables this view.
|
||||||
|
///
|
||||||
|
/// A disabled view cannot be selected.
|
||||||
|
pub fn disable(&mut self) {
|
||||||
|
self.enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Disables this view.
|
||||||
|
///
|
||||||
|
/// Chainable variant.
|
||||||
|
pub fn disabled(self) -> Self {
|
||||||
|
self.with(Self::disable)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Re-enables this view.
|
||||||
|
pub fn enable(&mut self) {
|
||||||
|
self.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Re-enables this view.
|
||||||
|
///
|
||||||
|
/// Chainable variant.
|
||||||
|
pub fn enabled(self) -> Self {
|
||||||
|
self.with(Self::enable)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns `true` if this view is enabled.
|
||||||
|
pub fn is_enabled(&self) -> bool {
|
||||||
|
self.enabled
|
||||||
|
}
|
||||||
|
|
||||||
/// Finds the row containing the grapheme at the given offset
|
/// Finds the row containing the grapheme at the given offset
|
||||||
fn row_at(&self, offset: usize) -> usize {
|
fn row_at(&self, offset: usize) -> usize {
|
||||||
debug!("Offset: {}", offset);
|
debug!("Offset: {}", offset);
|
||||||
|
Loading…
Reference in New Issue
Block a user