I think there should be a single setting, pager-command, which the
pager uses for *all* command-line output if it defined.  The setting
defaults to an empty string, which means no pagination.  I don't think
you want to select some subset of commands to be paginated.  Do them
all, or do none of them.

This should not be a versionable setting since it has nothing to do
with the project and is merely a user display preference.

Implement it by hooking into the fossil_print() function (in printf.c)
which should be used for all output already.  (There may be exceptions
to this, but those will be bugs that need fixing.)  Probably you will
want to accumulate text in a buffer until you know you are going to
have more than 24 lines, and only invoke the pager if the number of
lines exceeds 24.

You will also need to hook the various prompt_*() routines to convince
them to flush the pager buffer.  I do not think any prompt_*() will
ever occur after more than 2 or 3 llines of output, so there should
never be a case where the pager has already started when the prompt_()
is run.

Let me just say that I really loath software, like the "man" command
on Ubuntu, that thinks it is doing me a favor by running a pager for
me automatically.  I haven't voluntarily used a pager since back in
the 80s when my terminal was a (real) VT100.  If output is long, I'll
scroll back or I will pipe into "open -f" which just works on Mac and
for which I have a reasonable work-a-like on Linux.  If I'm working
remote, I'll redirect to a file, then scp the file back to my desktop
and bring it up in an editor there.  I'm not alone in these habits.  I
say all this just to emphasize that the default value for the
pager-command should definitely be OFF.


On 3/23/17, Christophe Gouiran <bechris13...@gmail.com> wrote:
> Good morning,
>
> I would like to implement the feature given in the title.
> I'm inspired by what Git (by default ?) and Mercurial (with Pager
> <https://www.mercurial-scm.org/wiki/PagerExtension> extension activated)
> do.
>
> I'd like to avoid typing "fossil <command> | less" everytime I notice it
> produces an output which doesn't fit in a single screen.
>
> Find below my ideas (in no particular order).
>
> Settings :
>
>    1. Add a new boolean setting "Paginates commands" (it is true by
> default)
>    2. Add a new string setting "pager-command" (it is empty by default)
>    3. Add a new string setting "Commands to paginate" (default value to be
>    defined)
>
> If pager-command is empty then following pager command will be used:
>
>    1. "more" under Windows.
>    2. "less -FRSX" under any other OS.
>
> When Fossil writes something to its standard output, then it is sent
> through the pager if (and only if) all following conditions are met:
>
>    1. Fossil standard output is a real terminal.
>    2. "Paginates commands" setting is true.
>    3. Executed command is indicated in "Commands to paginate" setting.
>
> *Fossil standard error must not be paginated.*
>
>
> Now I'm waiting for your advices/improvements/feedbacks.
>
> For example:
>
>    1. Should the settings be versionnable ?
>    2. Which commands to be put by default in "Commands to paginate" ?
>
>
> Many thanks in advance for taking the time to participate.
>


-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to