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

"Style" lost with "quit if one screen" option used #684

Open
morenathan opened this issue Jan 17, 2025 · 3 comments
Open

"Style" lost with "quit if one screen" option used #684

morenathan opened this issue Jan 17, 2025 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@morenathan
Copy link

Name : ov-git
Version : 1:0.37.0.r68.gb82e1b1-1
System : Archlinux (linux 6.12.9-arch1-1)

When using "-F" colorization features don't work. For example if I do this:
df -h | ov -F -C
the colored line feature is dropped.

How should it work?

IMO you're asking for output to get alternate line colored so it should be, regardless of how the view is showed. It's important to note that -F is an option from ov itself, at least from --help, and is standard for more less-style apps.

Thanks for all the efforts!

@noborus noborus self-assigned this Jan 18, 2025
@noborus
Copy link
Owner

noborus commented Jan 18, 2025

Thank you for your feedback and for bringing this issue to our attention.

Currently, the -F option in ov is designed to exit immediately if the content fits on one screen, without displaying the ov interface. As a result, the colorization feature provided by the -C option does not take effect.

I understand that you would like the colorization to be applied even when using the -F option. However, there are a couple of challenges that prevent this from being implemented immediately:

  1. Since ov does not display its interface when the -F option is used, the colorization process, which is part of the interface rendering, does not occur.
  2. There is currently no mechanism in place to retain the colorized styles (color settings) when ov exits immediately.

As a workaround, you can try the following approaches:

  1. Do not use the -F option: This will allow ov to display the content with the specified colors. You can then manually exit ov when you are done viewing the content.
  2. Set the environment variable TCELL_ALTSCREEN=disable: This will prevent ov from clearing the screen upon exit. By doing this, you can start ov without the -F option and use the q key (not Q which outputs the screen and quits) to exit. This approach may provide behavior closer to what you are looking for.
export TCELL_ALTSCREEN=disable
df -h | ov -C

@noborus noborus added the enhancement New feature or request label Jan 18, 2025
@morenathan
Copy link
Author

Thank you for your assistance. I've always liked the idea of ov but it's this type of thing that always kept me away. My alias has always included "-F" because sometimes there are files that don't need the interaction and that saves time.

I'm not too familiar with the console colorization schemes, but why can't the codes used to write the ascii colorization stick around? I suppose the only problem would be if it was in a pipe but many applications are capable of handling that. For example bat.

I will give your suggestion a try and see if it's compatable with how I use the console. 👍🏻 Thanks for the input!

@noborus
Copy link
Owner

noborus commented Jan 23, 2025

Thank you.
The terminal pager needs to be managed separately from the ANSI escape sequences in order to colorize and cancel colors by operation after startup (in the case of ov, colorization is done in the tcell style).

This is a big difference from other filter programs.

To keep it after termination, it needs to be converted to ANSI escape sequences, merged, and reproduced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants