[CentOS] Semi-OT: very weird vi behaviour

Wed Apr 27 16:07:34 UTC 2016
Jon LaBadie <jcu at labadie.us>

On Wed, Apr 27, 2016 at 09:39:10AM -0400, m.roth at 5-cent.us wrote:
> This is weird. As in, *deeply* weird.
> 
> I ssh as root from one box to another (there are keys involved), and I go
> to vi a file, such as
> # line 1 #
> # line 2 #
> # line 3
> # line 4
> 
> And what I see in vi is
> # line 3
> # line 4
> 
> BUT, if I scroll the cursor over each line with the arrow key... I see all
> four lines. I've also looked at another file, and same thing. Just checked
> it out on the server I ssh'd in from, and no problem.  And now, I just
> ssh'd in from another windows, same way... and the weirdness isn't there.
> 
> Anyone have any clues as to what's going on with that one session?

That sounds like a file generated from different OS's that have
different end of line terminators.  For example a line like this:

  # line 1 #\r# line 3\n       (\r == CR, \n == NL)

might display as just "# line 3" because the cursor returned to the
beginning of the line at the "\r".

Jon
-- 
Jon H. LaBadie                 jon at jgcomp.com
 11226 South Shore Rd.          (703) 787-0688 (H)
 Reston, VA  20190              (703) 935-6720 (C)