vim7: paging of messages :)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

vim7: paging of messages :)

Mikołaj Machowski
Hello,

New paging of messages is life changing.

I wonder if it is possible to display more info like in less::

    lines 700-730/1400 50%

In Vim it could look like::

    -- More (700-730/1400) --

Percentage is too much.

Reasons: I am often outscrolling messages and have to repeat command to
check what is at the and. Any feedback about position would be welcome.

Hmm. Don't understand C much but I see Vim pager has similar problem to
less - it knows only that something is in queue (message.c) so at the
beginning it can only show something like::

    -- More (700-730) --

But in less I can jump to the end with G and know/load whole text, so
less can display whole info. Maybe something similar could be
implemented in Vim.

Hah. Attaching crude patch for 'G' for moving to the bottom and 'g' for
moving to the beginning.

It just uses limit of lines from :help limits to set scroll
(2147483647). Not elegant but works. Hmm. How big int can be?

Plus small bug (also in unpatched Vim): after hitting end of messages
special keys , Up, BackSpace are quitting paging instead of going up,
b/u/k are working. With attached patch 'ENTER' message isn't cleared in
addition.

TIA

m.

--
LaTeX + Vim = http://vim-latex.sourceforge.net/
Vim-list(s) Users Map: (last change 15 May)
 http://skawina.eu.org/mikolaj/vimlist
CLEWN - http://clewn.sf.net



message.diff (759 bytes) Download Attachment
messdoc.diff (541 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: vim7: paging of messages :)

Bram Moolenaar

Mikolaj Machowski wrote:

> New paging of messages is life changing.

I'm glad you like it.  It's one of those "why didn't I do this before?"
things.  The implementation was much simpler than I expected.

> I wonder if it is possible to display more info like in less::
>
>     lines 700-730/1400 50%
>
> In Vim it could look like::
>
>     -- More (700-730/1400) --
>
> Percentage is too much.

Because of the way it is implemented it's difficult to give a percentage
of what still is to be displayed.  The code doesn't know about what is
still coming, each command would have to predict it.  And when typing
":" at the prompt you can make the list longer.

We could display something about what has been displayed and how far you
have scrolled back.  But that might actually be confusing...
A scrollbar would be ideal, but that would make things a lot more
complicated.

> Reasons: I am often outscrolling messages and have to repeat command to
> check what is at the and. Any feedback about position would be welcome.

Yes, you easily type one <Space> too much, since you can't see the end
coming.  A solution to that might be something like a ":scrollback"
command.  I'll see if that is possible.

> But in less I can jump to the end with G and know/load whole text, so
> less can display whole info. Maybe something similar could be
> implemented in Vim.

It's possible to do this.  It would work like the 'more' option is off
for a moment.

> Hah. Attaching crude patch for 'G' for moving to the bottom and 'g' for
> moving to the beginning.

Thanks, I think it generally works well.  Also setting "lines_left"
works better for "G".

> It just uses limit of lines from :help limits to set scroll
> (2147483647). Not elegant but works. Hmm. How big int can be?

It's not important, nobody should display so many lines of messages.
You will run out of memory anyway :-).

> Plus small bug (also in unpatched Vim): after hitting end of messages
> special keys , Up, BackSpace are quitting paging instead of going up,
> b/u/k are working. With attached patch 'ENTER' message isn't cleared in
> addition.

The reason is that previously the hit-enter prompt allowed you to enter
the next command.  If we now grab these commands and use them to scroll
back it's not compatible.  I guessed using b/u/k would be OK, but didn't
want to grab too many characters.  Still, cursor-up is what many people
will want to use, and its the same as "k" otherwise.

--
BODY:        I'm not dead!
CART DRIVER: 'Ere.  He says he's not dead.
LARGE MAN:   Yes he is.
BODY:        I'm not!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html   ///
Reply | Threaded
Open this post in threaded view
|

Re: vim7: paging of messages :)

Mikołaj Machowski
Dnia czwartek 28 lipiec 2005 18:09, Bram Moolenaar napisa?:

> Mikolaj Machowski wrote:
> > New paging of messages is life changing.
>
> I'm glad you like it.  It's one of those "why didn't I do this before?"
> things.  The implementation was much simpler than I expected.
>
> > I wonder if it is possible to display more info like in less::
> >
> >     lines 700-730/1400 50%
> >
> > In Vim it could look like::
> >
> >     -- More (700-730/1400) --
> >
> > Percentage is too much.
>
> Because of the way it is implemented it's difficult to give a percentage
> of what still is to be displayed.  The code doesn't know about what is
> still coming, each command would have to predict it.  And when typing
> ":" at the prompt you can make the list longer.

Yes, but it is what less is doing. For beginning it shows only number of
first line and last line from the screen. Full info is only after
hitting bottom of the page when it has full knowledge about length of
document. For users it is easier because they have explicitly demand
quit from program. No danger of outscrolling.

> > Reasons: I am often outscrolling messages and have to repeat command
> > to check what is at the and. Any feedback about position would be
> > welcome.
>
> Yes, you easily type one <Space> too much, since you can't see the end
> coming.  A solution to that might be something like a ":scrollback"
> command.  I'll see if that is possible.

Another solution would be making quit from scrolling only with q, Esc,
: . But what about redir?

> > But in less I can jump to the end with G and know/load whole text, so
> > less can display whole info. Maybe something similar could be
> > implemented in Vim.
>
> It's possible to do this.  It would work like the 'more' option is off
> for a moment.
>
> > Hah. Attaching crude patch for 'G' for moving to the bottom and 'g'
> > for moving to the beginning.
>
> Thanks, I think it generally works well.  Also setting "lines_left"
> works better for "G".

Good. My knowledge of C was stressed to its limits.

> > It just uses limit of lines from :help limits to set scroll
> > (2147483647). Not elegant but works. Hmm. How big int can be?
>
> It's not important, nobody should display so many lines of messages.
> You will run out of memory anyway :-).

Ha! You promised it in limits! :)

Reply | Threaded
Open this post in threaded view
|

Re: vim7: paging of messages :)

Bram Moolenaar

Mikolaj Machowski wrote:

> > > Reasons: I am often outscrolling messages and have to repeat command
> > > to check what is at the and. Any feedback about position would be
> > > welcome.
> >
> > Yes, you easily type one <Space> too much, since you can't see the end
> > coming.  A solution to that might be something like a ":scrollback"
> > command.  I'll see if that is possible.
>
> Another solution would be making quit from scrolling only with q, Esc,
> : . But what about redir?

I don't like that <Space> doesn't work at the hit-enter prompt, I'm too
much used to typing <Space>.  I now implemented the "g<" command and it
works quite well.  Only problem is that it's not an obvious name.  I
tried using ":scrollback" first, but entering the command line is a
message by itself, it clears the previous message already.

> > > It just uses limit of lines from :help limits to set scroll
> > > (2147483647). Not elegant but works. Hmm. How big int can be?
> >
> > It's not important, nobody should display so many lines of messages.
> > You will run out of memory anyway :-).
>
> Ha! You promised it in limits! :)

OK, here is a challenge: try to produce a message with more than 999999
lines and find out what goes wrong. :-)

--
OLD WOMAN: Well, how did you become king, then?
ARTHUR: The Lady of the Lake, her arm clad in the purest shimmering samite,
        held Excalibur aloft from the bosom of the water to signify by Divine
        Providence ...  that I, Arthur, was to carry Excalibur ...  That is
        why I am your king!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html   ///
Reply | Threaded
Open this post in threaded view
|

Re: vim7: paging of messages :)

Mikołaj Machowski
Dnia pi?tek 29 lipiec 2005 21:15, Bram Moolenaar napisa?:
> I don't like that <Space> doesn't work at the hit-enter prompt, I'm too
> much used to typing <Space>.  I now implemented the "g<" command and it
> works quite well.  Only problem is that it's not an obvious name.  I
> tried using ":scrollback" first, but entering the command line is a
> message by itself, it clears the previous message already.

OK. Maybe put more help when pressing non-control letter. For example
first i presents SPACE... second change that to show info about g/G and
g<?

> > > > It just uses limit of lines from :help limits to set scroll
> > > > (2147483647). Not elegant but works. Hmm. How big int can be?
> > >
> > > It's not important, nobody should display so many lines of messages.
> > > You will run out of memory anyway :-).
> >
> > Ha! You promised it in limits! :)
>
> OK, here is a challenge: try to produce a message with more than 999999
> lines and find out what goes wrong. :-)

Hmm.
let i = 1
while i < 1000001  " 1 million 1
        put =i
        let i+=1
endwhile

No problems.

Something stronger:

let i = 1
while i < 10000000  " 10 millions
        put =i
        let i+=1
endwhile

Together 11 millions. My machine barely stands but Vim works. OK, didn't
try to write it (swap file over 100M) and Vim is still quitting after 10
minutes (:qa!), but I think this is nothing more RAM could not solve.

m.