diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-28 23:31:54 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-28 23:31:54 +0100 |
| commit | 7d18a268547734daf19a740b6533e9c1697baf1a (patch) | |
| tree | 789f519a19b053b8ad0ff41d2828fe22c06fb21a /src/bin | |
| parent | v1.2.0: show the symbol paytable on the slots board (diff) | |
| download | zagan-bet-7d18a268547734daf19a740b6533e9c1697baf1a.tar.gz zagan-bet-7d18a268547734daf19a740b6533e9c1697baf1a.zip | |
v1.2.1: track wrapped board lines and split the paytable
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/client/repl.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/bin/client/repl.rs b/src/bin/client/repl.rs index 58cb541..1ed3073 100644 --- a/src/bin/client/repl.rs +++ b/src/bin/client/repl.rs | |||
| @@ -17,6 +17,7 @@ use zagan_bet::client::core::{ClientCore, Effect, InteractiveCommand, Key}; | |||
| 17 | use zagan_bet::client::database; | 17 | use zagan_bet::client::database; |
| 18 | use zagan_bet::client::ui::{ | 18 | use zagan_bet::client::ui::{ |
| 19 | display_width, format_pong, host_lines, input_cursor_column, lines_to_move_up, | 19 | display_width, format_pong, host_lines, input_cursor_column, lines_to_move_up, |
| 20 | visual_line_count, | ||
| 20 | }; | 21 | }; |
| 21 | use zagan_bet::protocol::io_failure_message; | 22 | use zagan_bet::protocol::io_failure_message; |
| 22 | 23 | ||
| @@ -29,7 +30,7 @@ pub struct ClientState { | |||
| 29 | pub default_port: u16, | 30 | pub default_port: u16, |
| 30 | core: ClientCore, | 31 | core: ClientCore, |
| 31 | cleanup_done: Arc<Mutex<bool>>, | 32 | cleanup_done: Arc<Mutex<bool>>, |
| 32 | /// Number of terminal lines currently occupied by the game board. | 33 | /// Number of visual terminal lines currently occupied by the game board. |
| 33 | game_lines: usize, | 34 | game_lines: usize, |
| 34 | /// Text last drawn after the `> ` prompt, used to keep the command echo | 35 | /// Text last drawn after the `> ` prompt, used to keep the command echo |
| 35 | /// in the transcript before printing command output. | 36 | /// in the transcript before printing command output. |
| @@ -255,7 +256,10 @@ impl ClientState { | |||
| 255 | .collect(); | 256 | .collect(); |
| 256 | print!("{}", rendered.join("\r\n")); | 257 | print!("{}", rendered.join("\r\n")); |
| 257 | stdout().flush().unwrap(); | 258 | stdout().flush().unwrap(); |
| 258 | self.game_lines = lines.len().max(1); | 259 | let width = crossterm::terminal::size() |
| 260 | .map(|(columns, _)| columns as usize) | ||
| 261 | .unwrap_or(80); | ||
| 262 | self.game_lines = visual_line_count(lines, width).max(1); | ||
| 259 | } | 263 | } |
| 260 | 264 | ||
| 261 | fn clear_region(&mut self) { | 265 | fn clear_region(&mut self) { |
