From 49df948de25d28601469e9ca993f33530989ebd0 Mon Sep 17 00:00:00 2001 From: salmonik Date: Thu, 29 Oct 2026 22:55:49 +0100 Subject: v3.0.0: cursor-driven roulette felt with splits and corners; drop schema migrations; require 80x24 --- src/client/ui.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/client/ui.rs') 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 { /// Format remembered hosts so a 64-character fingerprint does not wrap on an /// 80-column terminal. +/// Smallest terminal every game fits in. Roulette's felt is 12 lines and the +/// controls are ~72 columns, so anything smaller would wrap or hide the board. +pub const MIN_COLUMNS: u16 = 80; +pub const MIN_ROWS: u16 = 24; + +/// Refuse to start when the terminal cannot show every game. +pub fn terminal_too_small(columns: u16, rows: u16) -> Option { + if columns >= MIN_COLUMNS && rows >= MIN_ROWS { + return None; + } + Some(format!( + "zagan.bet needs a terminal of at least {MIN_COLUMNS}x{MIN_ROWS} cells, \ + but this one is {columns}x{rows}.\n\ + Resize it and start again." + )) +} + /// Render remembered hosts. /// /// Two addresses that present the same certificate key are the same server, so -- cgit v1.2.3