From ea3169961d63139584f7f08d60eefde356c67759 Mon Sep 17 00:00:00 2001 From: Jonathan Spira Date: Sun, 26 Apr 2020 18:00:57 -0400 Subject: [PATCH] Updated `Dialog` convencience methods: `test` and `info` to take `Into` (#449) * Updated dialog typed to allow for StyledString --- cursive-core/src/views/dialog.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cursive-core/src/views/dialog.rs b/cursive-core/src/views/dialog.rs index 2d868a2..eada861 100644 --- a/cursive-core/src/views/dialog.rs +++ b/cursive-core/src/views/dialog.rs @@ -8,7 +8,7 @@ use crate::views::{BoxedView, Button, DummyView, LastSizeView, TextView}; use crate::Cursive; use crate::Printer; use crate::Vec2; -use crate::With; +use crate::{utils::markup::StyledString, With}; use std::cell::Cell; use std::cmp::max; use unicode_width::UnicodeWidthStr; @@ -159,7 +159,7 @@ impl Dialog { /// let dialog = Dialog::text("Hello!") /// .button("Quit", |s| s.quit()); /// ``` - pub fn text>(text: S) -> Self { + pub fn text>(text: S) -> Self { Self::around(TextView::new(text)) } @@ -174,7 +174,7 @@ impl Dialog { /// /// let dialog = Dialog::info("Some very important information!"); /// ``` - pub fn info>(text: S) -> Self { + pub fn info>(text: S) -> Self { Dialog::text(text).dismiss_button("Ok") }