Build the display text for rendering. Returns the string that should be measured/drawn.
(text: &str, placeholder: &str, is_password: bool)
| 1819 | /// Build the display text for rendering. |
| 1820 | /// Returns the string that should be measured/drawn. |
| 1821 | pub fn display_text(text: &str, placeholder: &str, is_password: bool) -> String { |
| 1822 | if text.is_empty() { |
| 1823 | return placeholder.to_string(); |
| 1824 | } |
| 1825 | if is_password { |
| 1826 | "•".repeat(text.chars().count()) |
| 1827 | } else { |
| 1828 | text.to_string() |
| 1829 | } |
| 1830 | } |
| 1831 | |
| 1832 | /// When text-styling is enabled, the raw string contains markup like `{red|...}` and |
| 1833 | /// escape sequences like `\{`. The user-visible "visual" positions ignore all markup. |
no test coverage detected