Swap preview box dimensions to landscape in A4 mode

The printed page is rotated 90 degrees before hitting the printer in
A4 mode, so the live-preview box should reflect that same landscape
swap instead of sizing itself to the printer's raw portrait grid.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
master
Amir Alexander Abdelbaki 2026-07-16 15:48:41 +02:00
parent 2163397ff1
commit deaf867091
1 changed files with 6 additions and 0 deletions

View File

@ -192,6 +192,12 @@ def box_dims_for(term_rows, term_cols, cfg=None):
if cfg is None or not cfg.real_viewfinder: if cfg is None or not cfg.real_viewfinder:
return max_rows, max_cols return max_rows, max_cols
target_cols, target_rows = output_target_dims(cfg, max_cols - 2, max_rows - 2) target_cols, target_rows = output_target_dims(cfg, max_cols - 2, max_rows - 2)
if cfg.printer_a4 and target_rows is not None:
# The printed page is rotated 90 degrees before it reaches the
# printer (see prepare_print_frame), so the box shown on screen
# should reflect that same landscape swap rather than the
# printer's raw portrait character grid.
target_cols, target_rows = target_rows, target_cols
rows = max_rows if target_rows is None else max(min(target_rows + 2, max_rows), 3) rows = max_rows if target_rows is None else max(min(target_rows + 2, max_rows), 3)
cols = max(min(target_cols + 2, max_cols), 10) cols = max(min(target_cols + 2, max_cols), 10)
return rows, cols return rows, cols