зеркало из
https://github.com/glebtv/tui-textarea.git
synced 2026-09-03 22:35:50 +03:00
allow any string types for setting placeholder text
Этот коммит содержится в:
@@ -38,7 +38,7 @@ fn main() -> io::Result<()> {
|
||||
// set placeholder
|
||||
|
||||
textarea.set_placeholder_style(Style::default());
|
||||
textarea.set_placeholder("prompt message".to_string());
|
||||
textarea.set_placeholder("prompt message");
|
||||
loop {
|
||||
term.draw(|f| {
|
||||
f.render_widget(textarea.widget(), area);
|
||||
|
||||
@@ -36,7 +36,7 @@ fn main() -> io::Result<()> {
|
||||
};
|
||||
textarea.set_style(Style::default().fg(Color::Yellow));
|
||||
textarea.set_placeholder_style(Style::default());
|
||||
textarea.set_placeholder("prompt message".to_string());
|
||||
textarea.set_placeholder("prompt message");
|
||||
loop {
|
||||
term.draw(|f| {
|
||||
f.render_widget(textarea.widget(), area);
|
||||
|
||||
@@ -1239,8 +1239,8 @@ impl<'a> TextArea<'a> {
|
||||
}
|
||||
|
||||
/// sets the placeholder text
|
||||
pub fn set_placeholder(&mut self, placeholder: String) {
|
||||
self.placeholder = placeholder;
|
||||
pub fn set_placeholder(&mut self, placeholder: impl Into<String>) {
|
||||
self.placeholder = placeholder.into();
|
||||
}
|
||||
|
||||
pub fn set_placeholder_style(&mut self, style: Style) {
|
||||
|
||||
Ссылка в новой задаче
Block a user