tealdeer-rs / tealdeer

A very fast implementation of tldr in Rust.
https://tealdeer-rs.github.io/tealdeer/
Apache License 2.0
4.17k stars 123 forks source link

Default pager scrolls to the bottom #361

Open tranzystorekk opened 6 months ago

tranzystorekk commented 6 months ago

When setting use_pager=true, the less -R default displays short tldr pages scrolled to the bottom:

obraz

This can be fixed with PAGER="less -R +g":

obraz

I'm not sure if modifying the default command is worth it, but setting the global PAGER also seems like an overkill, maybe a TEALDEER_PAGER variable would be a good middle ground?

niklasmohrin commented 6 months ago

Would using an alias work? In bash, you can run alias tldr="PAGER='less -R +g' tldr" in your .bashrc file, which is where I suppose you would want to set the value of TEALDEER_PAGER, if we would support that. Then, all following usages of tldr will have the PAGER variable set.

tranzystorekk commented 6 months ago

Alias is a viable workaround, but a proper TEALDEER_PAGER seems like a more user-forward way; similarly man has MANPAGER and bat has BAT_PAGER.

niklasmohrin commented 6 months ago

Fair enough. We are generally moving more towards config.toml over environment variables, so maybe an option there (next to use_pager) would be better

tranzystorekk commented 10 hours ago

With 1.7.0 fresh out of the gate, would we be interested in implementing either of the proposed here solutions?

niklasmohrin commented 9 hours ago

I am open for adding a setting to the config file. We can discuss the name of the setting can in the corresponding PR, so there is no need to come up with one in order to start working on the feature.

I am a bit hesitant about the environment variable still and would rather not include it for now. (I am thinking about whether or not we should refactor the configuration part of the codebase to have a unified scheme of config variable, environment variable, and CLI flag interaction, but haven't really decided or come up with something)