On 2011-04-14, Bram Moolenaar wrote: > Gary Johnson wrote: > > > > > I recently noticed an odd behavior of the DiffOrig command. If > > > > 'encoding' is "utf-8", 'fileencoding' is "latin1", and the file I'm > > > > editing contains characters whose encoding is different between > > > > utf-8 and latin1, DiffOrig will display the lines containing those > > > > characters in unfolded regions as though the lines are different, > > > > but the lines are not highlighted as they would be if they contained > > > > actual differences. > > > > > > > > At that point, ":windo set enc? fenc?" shows the following: > > > > > > > > encoding=utf-8 > > > > fileencoding= > > > > encoding=utf-8 > > > > fileencoding=latin1 > > > > > > > > I think the solution to this is to change the DiffOrig command to > > > > add the ++edit option to the :read command, as follows. > > > > > > > > command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | > > > > diffthis > > > > \ | wincmd p | diffthis > > > > > > > > It seems to be working for me, but I wanted to check that I wasn't > > > > missing something before making a patch for both affected files. > > > > > > I can't reproduce the problem, the scratch buffer also has > > > 'fileencoding' set to "latin1". Can you explain the steps from the very > > > start? > > > > Sure. I noticed this running Vim 7.3.154 in terminal mode on a > > system running Fedora 11. I was editing my ~/.vimrc file which > > includes comments with the names of two contributors to the Vim > > list, Henrik Öhman and Jürgen Krämer. The file uses latin1 > > encoding. When I execute > > > > $ vim ~/.vimrc > > :DiffOrig > > > > I see two buffers side by side with the top 488 lines folded, an > > unfolded region of 13 lines centered on Henrik's name, 37 folded > > lines, an unfolded region of 13 lines centered on Jürgen's name, and > > the bottom 480 lines folded. > > > > If I add ++edit to my DiffOrig command and repeat the experiment, > > all lines of both buffers are folded. > > > > I just repeated the experiment with a clean configuration, i.e., > > as > > > > vim -N -u NONE -i NONE -c 'so difforig.vim' .vimrc > > :DiffOrig > > :windo set enc? fenc? > > > > where difforig.vim contains this one line: > > > > command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis | > > wincmd p | diffthis > > > > The appearance of the two buffers is the same as before and the > > results of the windo command are as I originally reported: > > > > encoding=utf-8 > > fileencoding encoding=utf-8 > > fileencoding=latin1 > > OK. I don't know why I didn't see it the first time, must have done > somethign wrong. I'll fix the help file. Any other file that needs to > be corrected?
Yes. $VIMRUNTIME/vimrc_example.vim. Thanks very much. Regards, Gary -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
