Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,10 @@ Option | Description | Default
`--portrait` | Enable portrait mode | disabled
`--nofold` | Disable folding (ie. don't wrap to width) | disabled
`--spacing` | Set line spacing | `0`
`--rows` | Set TTY rows (`--cols` required too) | *no default*
`--cols` | Set TTY columns (`--rows` required too) | *no default*
`--flipx` | Mirror X axis (experimental / buggy) | disabled
`--flipy` | Mirror Y axis (experimental / buggy) | disabled


```sh
Expand Down
13 changes: 11 additions & 2 deletions papertty/papertty.py
Original file line number Diff line number Diff line change
Expand Up @@ -1185,8 +1185,12 @@ def scrub(settings, size):
@click.option('--portrait', default=False, is_flag=True, help='Use portrait orientation', show_default=True)
@click.option('--nofold', default=False, is_flag=True, help="Don't fold the input", show_default=True)
@click.option('--spacing', default='0', help='Line spacing for the text, "auto" to automatically determine a good value', show_default=True)
@click.option('--rows', 'ttyrows', default=None, help='Set TTY rows (--cols required too)')
@click.option('--cols', 'ttycols', default=None, help='Set TTY columns (--rows required too)')
@click.option('--flipx', default=False, is_flag=True, help='Flip X axis (EXPERIMENTAL/BROKEN)', show_default=False)
@click.option('--flipy', default=False, is_flag=True, help='Flip Y axis (EXPERIMENTAL/BROKEN)', show_default=False)
@click.pass_obj
def stdin(settings, font, fontsize, width, portrait, nofold, spacing):
def stdin(settings, font, fontsize, width, portrait, nofold, spacing, ttyrows, ttycols, flipx, flipy):
"""Display standard input and leave it on screen"""
settings.args['font'] = font
settings.args['fontsize'] = fontsize
Expand All @@ -1200,7 +1204,12 @@ def stdin(settings, font, fontsize, width, portrait, nofold, spacing):
font_width = ptty.font.getsize('M')[0]
max_width = int((ptty.driver.width - 8) / font_width) if portrait else int(ptty.driver.height / font_width)
text = ptty.fold(text, width=max_width)
ptty.showtext(text, fill=ptty.driver.black, portrait=portrait)
if ttyrows:
ptty.rows = int(ttyrows)
if ttycols:
ptty.cols = int(ttycols)
textargs = {'portrait': portrait, 'flipx': flipx, 'flipy': flipy}
ptty.showtext(text, fill=ptty.driver.black, **textargs)


@click.command()
Expand Down