Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: option to fit vertically instead of horizontally #30

Closed
merwok opened this issue Sep 1, 2017 · 5 comments
Closed

Feature: option to fit vertically instead of horizontally #30

merwok opened this issue Sep 1, 2017 · 5 comments

Comments

@merwok
Copy link

merwok commented Sep 1, 2017

Hello and thanks for this very nice program!

It seems like big images are resized to fit the width of the console, but I would prefer to see the whole image without scrolling. Could you add a way to control this?

Alternatively, an option (or changing the default behaviour) to fit horizontally or vertically depending on the picture (i.e. use the most screen without overflowing) would also work for me.

@posva
Copy link
Owner

posva commented Sep 1, 2017

I remember I didn't add it because there wasn't a consistent way of getting the height of the terminal, only the width.
I don't know if the situation has changed but I'm open to contributions if it has

@merwok
Copy link
Author

merwok commented Sep 1, 2017

Do you need the height in lines or pixels?

For lines, maybe some inspiration could be taken from Python. There is a function in the standard library that checks for the COLUMNS and LINES environment variables (ref http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html#tag_002_003 ), or calls an ioctl: python/cpython@bcf2b59#diff-a6f29e907cbb5fffd44d453bcd7b77d5R128

I supposes that calling stty size in a sub-process would make the program too slow?

@merwok
Copy link
Author

merwok commented Sep 1, 2017

I see that the code does use an ioctl to get the columns! Could also return the lines.

I haven’t done much C but this could be a fun thing to write. I’m not available in the next weeks, so someone else feel free to take this!

@merwok
Copy link
Author

merwok commented Sep 16, 2017

Writing terminal_lines is easy but the command-line interface is harder, especially in the interaction of -w and the new flag. Could you define behaviour that you would accept?

  1. Change code from width to height, keep default to fit terminal
  2. Keep -w flag, add another flag for height (with value 0 to ask to fit height), error if both are given
  3. Something else?

(Value 0 to mean “do your best” inspired by make -j 0 meaning “use all processors”)

@posva
Copy link
Owner

posva commented Sep 16, 2017

I want to keep the default behaviour to fit horizontally because it makes up for more pixels and we can always scroll. 0 to make it fit vertically sounds nice to me 👍

@posva posva closed this as completed in 5adb42c Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants