mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 17:37:22 +03:00
start text box with cursor at the end of prefilled
This commit is contained in:
parent
551a8ef63a
commit
8202698daa
@ -13,10 +13,11 @@ pub struct TextBox {
|
||||
|
||||
impl TextBox {
|
||||
pub fn new(prompt: &str, prefilled: Option<String>) -> TextBox {
|
||||
let line = prefilled.unwrap_or_else(String::new);
|
||||
TextBox {
|
||||
prompt: prompt.to_string(),
|
||||
line: prefilled.unwrap_or_else(String::new),
|
||||
cursor_x: 0,
|
||||
cursor_x: line.len(),
|
||||
line,
|
||||
shift_pressed: false,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user