SUMMARY: vi search results positioning

From: Stephen Campbell <steve_at_avalon.dartmouth.edu>
Date: Fri, 27 Jan 1995 10:28:23 -0500

My original query was:

> Here's a little annoyance I've observed under the last several releases of
> OSF/1 up to and including 2.1. In vi(1), if I search downwards in a file,
> vi redraws the screen so that the found line is in the middle of the screen.
> If I search upwards, vi redraws the screen so that the found line is at the
> top of the screen. I would rather it always positioned the found line in the
> middle of the screen (assuming of course that there are enough lines above
> and below the found line). Is there a way to make vi do that?

"Dr. Tom Blinn, 603-881-0646" <tpb_at_zk3.dec.com> was kind enough to spend some
time testing vi on his similar machine. Here is a portion of his reply:

----------------
I'm not sure WHAT rule vi is using.. When I search forward, SOMETIMES the
found line winds up in the middle of the screen, and SOMETIMES it winds up
at the TOP. And when I tried it before (on a different file than just now
but it really did happen), the pattern I was searching for kept coming up
centered when I did the backward search, but on the file I was just doing
that didn't happen for the pattern I was searching for. So, as Dave Barry
would say, I'm not just making this up.. I really did think that what I was
seeing was different from what you were seeing, but it's not as simple as it
might seem. There are circumstances under which it puts the found line at
the top, and other circumstances where it puts it in the middle, and it's
not clear what the rules really are for the redrawing. But the module in
which this stuff gets done is over 1000 lines, and we haven't mucked with it
at all as far as I can tell.

Weird..

Of course, vi is just one of a family of programs -- same executable but
different names:

doctor[1212]> ls -l /usr/bin | fgrep 303104
-rwxr-xr-t 5 bin bin 303104 Feb 21 1994 edit
-rwxr-xr-t 5 bin bin 303104 Feb 21 1994 ex
-rwxr-xr-t 5 bin bin 303104 Feb 21 1994 vedit
-rwxr-xr-t 5 bin bin 303104 Feb 21 1994 vi
-rwxr-xr-t 5 bin bin 303104 Feb 21 1994 view

I've spent some time trying to figure out just what it might be doing, but
it's incredibly bizarre code. It looks like IBM was the contributor of the
version of vi that's in DEC OSF/1, having derived it from UCBerkeley code.
So if there are bugs, they probably introduced them.

Sorry I can't really say why it's not working the way you want. One way to
get compatible behavior would be to 'mx' the ULTRIX version and use it. Or
you could report this to us through the normal problem reporting vehicles
(by calling the CSC) and ask that it be fixed.

I wonder if there's any POSIX standard for how this should behave -- if it
were a standards violation, there'd be some energy focused on fixing it, but
it's not likely to be viewed as very high priority.

----------------

rduta_at_macross.umsl.edu (MD) suggested alternative versions of vi:

Well the problem might be that you are using stock vi. You might want to
consider getting one of the clones, such as "elvis", "vim", "nvim", all
of which are good substitues, and also offer extra features. Vim for
example offers multiple windws, through curses, which comes in really
handy if you are on a x-term where you can just open another window.

anyway that's my $.02 on the subject. I personally use vim, but i
plan to switch to nvim, when i get a chance..

------------------

I have installed vim and find it solves the original problem and also has some
nice new features. Vim is available from comp.sources.misc archives and from
the usual ftp sites.
                                                                Steve
Received on Fri Jan 27 1995 - 10:29:57 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:45 NZDT