diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-29 22:16:15 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-29 22:16:15 +0100 |
| commit | bc0de9955c375cf27d52c9934403964205afc182 (patch) | |
| tree | 42799fb426fb0ec164f44c92a63525003c582f35 /src/client/ui.rs | |
| parent | initial connection timeout set to 10s (diff) | |
| download | zagan-bet-bc0de9955c375cf27d52c9934403964205afc182.tar.gz zagan-bet-bc0de9955c375cf27d52c9934403964205afc182.zip | |
formatting
Diffstat (limited to '')
| -rw-r--r-- | src/client/ui.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/client/ui.rs b/src/client/ui.rs index 0fe78ae..4ab0759 100644 --- a/src/client/ui.rs +++ b/src/client/ui.rs | |||
| @@ -94,10 +94,7 @@ pub fn command_names() -> Vec<&'static str> { | |||
| 94 | pub fn help_lines() -> Vec<String> { | 94 | pub fn help_lines() -> Vec<String> { |
| 95 | let mut lines = vec!["Available commands:".to_string()]; | 95 | let mut lines = vec!["Available commands:".to_string()]; |
| 96 | for command in COMMANDS { | 96 | for command in COMMANDS { |
| 97 | lines.push(format!( | 97 | lines.push(format!(" {:<28} - {}", command.usage, command.description)); |
| 98 | " {:<28} - {}", | ||
| 99 | command.usage, command.description | ||
| 100 | )); | ||
| 101 | } | 98 | } |
| 102 | lines | 99 | lines |
| 103 | } | 100 | } |
| @@ -291,16 +288,12 @@ pub fn host_lines(hosts: &[(String, Option<String>)]) -> Vec<String> { | |||
| 291 | /// on the current line. `render()` has no trailing newline, so a 7-line board | 288 | /// on the current line. `render()` has no trailing newline, so a 7-line board |
| 292 | /// needs `MoveUp(6)`. | 289 | /// needs `MoveUp(6)`. |
| 293 | pub fn lines_to_move_up(previous_lines: usize) -> u16 { | 290 | pub fn lines_to_move_up(previous_lines: usize) -> u16 { |
| 294 | previous_lines | 291 | previous_lines.saturating_sub(1).min(u16::MAX as usize) as u16 |
| 295 | .saturating_sub(1) | ||
| 296 | .min(u16::MAX as usize) as u16 | ||
| 297 | } | 292 | } |
| 298 | 293 | ||
| 299 | /// Column (0-based) to move to after the given prompt and input text. | 294 | /// Column (0-based) to move to after the given prompt and input text. |
| 300 | pub fn input_cursor_column(prompt_len: usize, input_len: usize) -> u16 { | 295 | pub fn input_cursor_column(prompt_len: usize, input_len: usize) -> u16 { |
| 301 | prompt_len | 296 | prompt_len.saturating_add(input_len).min(u16::MAX as usize) as u16 |
| 302 | .saturating_add(input_len) | ||
| 303 | .min(u16::MAX as usize) as u16 | ||
| 304 | } | 297 | } |
| 305 | 298 | ||
| 306 | /// Number of terminal rows a block of logical lines occupies after wrapping. | 299 | /// Number of terminal rows a block of logical lines occupies after wrapping. |
