On 2011-04-13, 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
Here is the output of "vim --version" with the "Compiled by" line
obfuscated.
$ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Apr 6 2011 09:34:53)
Included patches: 1-154
Compiled by [email protected]
Normal version with GTK2 GUI. Features included (+) or not (-):
-arabic +autocmd +balloon_eval +browse +builtin_terms +byte_offset +cindent
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con_gui +diff
+digraphs +dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi
+file_in_path +find_in_path +float +folding -footer +fork() +gettext
-hangul_input +iconv +insert_expand +jumplist -keymap -langmap +libcall
+linebreak +lispindent +listcmds +localmap -lua +menu +mksession +modify_fname
+mouse +mouseshape -mouse_dec +mouse_gpm -mouse_jsbterm -mouse_netterm
-mouse_sysmouse +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg
-osfiletype +path_extra -perl +persistent_undo +postscript +printer -profile
-python -python3 +quickfix +reltime -rightleft -ruby +scrollbind +signs
+smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
+toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup +X11 -xfontset +xim
+xsmp_interact +xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/home/gajohnso/src/vim-hg/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK
-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0
-I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2
-I/usr/include/libpng12 -g -O2 -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-x11-2.0
-lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0
-lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0
-lgmodule-2.0 -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm
-ltinfo -lelf -lnsl -lselinux -lacl -lattr -lgpm
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