MCPcopy Create free account
hub / github.com/TheRedDeveloper/ply-engine / display_text

Function display_text

src/text_input.rs:1821–1830  ·  view source on GitHub ↗

Build the display text for rendering. Returns the string that should be measured/drawn.

(text: &str, placeholder: &str, is_password: bool)

Source from the content-addressed store, hash-verified

1819/// Build the display text for rendering.
1820/// Returns the string that should be measured/drawn.
1821pub 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.

Calls 1

is_emptyMethod · 0.80

Tested by

no test coverage detected