force page width

This commit is contained in:
q
2025-11-27 15:09:33 +02:00
parent 290221b0ea
commit 73fef8cd2b

View File

@@ -19,8 +19,8 @@
"""Markslider: a slideshow engine based on markdown."""
__author__ = "Ville Rantanen <ville.q.rantanen@gmail.com>"
__version__ = "1.3.2"
__author__ = "q <q@moonq.org>"
__version__ = "1.3.3"
import sys, os, argparse, re, datetime
from argparse import ArgumentParser
@@ -558,6 +558,20 @@ Keyboard shortcuts:
default=True,
help="Disable line wrapping. Cuts long lines.",
)
content.add_argument(
"--width",
action="store", type=int,
dest="width",
default=None,
help="Force width of page (for --center)",
)
content.add_argument(
"--height",
action="store", type=int,
dest="height",
default=None,
help="Force height of page (for --center)",
)
parser.add_argument("files", type=str, nargs="+", help="File(s) to show")
opts = parser.parse_args()
@@ -577,10 +591,17 @@ def page_print(reader, opts, offset):
# clear page
bc.clear()
if opts.center: # Placeholder for 80x25 center alignment
if opts.width:
align_width = opts.width
else:
align_width = reader.get_max_width()
align_x_offset = int(scrsize[1] / 2 - align_width / 2)
align_pad = " " * align_x_offset
align_y_offset = int(scrsize[0] / 2 - reader.get_max_height() / 2)
if opts.height:
align_height = opts.height
else:
align_height = reader.get_max_height()
align_y_offset = int(scrsize[0] / 2 - align_height / 2)
bc.down_line(align_y_offset)
else:
align_pad = ""