Hello Bram,
Today I used the :diffpatch command for the first time (after more than 7 happy
years with VIM :-), and I noticed that although the patch result window was in
'diff' mode, the folding was still done with markers, as specified by a
modeline
in my particular file. This is unexpected and inconsistent with the :diffsplit
command, which always sets 'diff' and 'foldmethod=diff', even when the file's
modeline (or a ftplugin) chooses another foldmethod.
Attached patch moves the setting of 'diff', 'scrollbind' and 'wrap' to the end
of the function, after the result buffer is named and autocommands have
executed. I think this is how it was intended.
Steps to reproduce:
cat > test.txt <<EOF
vim:fdm=marker
a test {{{1
}}}1
EOF
cp test.txt test.new
echo "a change" >> test.new
diff -c test.{txt,new} > test.txt.diff
vim -N -u NONE test.txt
:filetype on
:diffpatch test.txt.diff
:setlocal foldmethod?
" Prints 'marker', should be 'diff'.
-- regards, ingo
--
-- Ingo Karkat -- /^-- /^-- /^-- /^-- /^-- /^-- http://ingo-karkat.de/ --
--
Me? A skeptic? I trust you have proof.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---
Index: src/diff.c
===================================================================
--- src/diff.c (revision 1341)
+++ src/diff.c (working copy)
@@ -1018,10 +1018,6 @@
if (curwin != old_curwin) /* split must have worked */
{
- /* Set 'diff', 'scrollbind' on and 'wrap' off. */
- diff_win_options(curwin, TRUE);
- diff_win_options(old_curwin, TRUE);
-
if (newname != NULL)
{
/* do a ":file filename.new" on the patched buffer */
@@ -1034,6 +1030,10 @@
do_cmdline_cmd((char_u *)":doau filetypedetect BufRead");
#endif
}
+
+ /* Set 'diff', 'scrollbind' on and 'wrap' off. */
+ diff_win_options(curwin, TRUE);
+ diff_win_options(old_curwin, TRUE);
}
}