diff options
Diffstat (limited to '')
| -rw-r--r-- | src/client/ui.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/client/ui.rs b/src/client/ui.rs index 9d65087..6161166 100644 --- a/src/client/ui.rs +++ b/src/client/ui.rs | |||
| @@ -244,6 +244,23 @@ pub fn first_contact_lines(addr: &str, fingerprint: &str) -> Vec<String> { | |||
| 244 | 244 | ||
| 245 | /// Format remembered hosts so a 64-character fingerprint does not wrap on an | 245 | /// Format remembered hosts so a 64-character fingerprint does not wrap on an |
| 246 | /// 80-column terminal. | 246 | /// 80-column terminal. |
| 247 | /// Smallest terminal every game fits in. Roulette's felt is 12 lines and the | ||
| 248 | /// controls are ~72 columns, so anything smaller would wrap or hide the board. | ||
| 249 | pub const MIN_COLUMNS: u16 = 80; | ||
| 250 | pub const MIN_ROWS: u16 = 24; | ||
| 251 | |||
| 252 | /// Refuse to start when the terminal cannot show every game. | ||
| 253 | pub fn terminal_too_small(columns: u16, rows: u16) -> Option<String> { | ||
| 254 | if columns >= MIN_COLUMNS && rows >= MIN_ROWS { | ||
| 255 | return None; | ||
| 256 | } | ||
| 257 | Some(format!( | ||
| 258 | "zagan.bet needs a terminal of at least {MIN_COLUMNS}x{MIN_ROWS} cells, \ | ||
| 259 | but this one is {columns}x{rows}.\n\ | ||
| 260 | Resize it and start again." | ||
| 261 | )) | ||
| 262 | } | ||
| 263 | |||
| 247 | /// Render remembered hosts. | 264 | /// Render remembered hosts. |
| 248 | /// | 265 | /// |
| 249 | /// Two addresses that present the same certificate key are the same server, so | 266 | /// Two addresses that present the same certificate key are the same server, so |
