]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1753: defaults: 'diffopt' option value can be improved v9.1.1753
authorYee Cheng Chin <ychin.git@gmail.com>
Thu, 11 Sep 2025 19:02:21 +0000 (15:02 -0400)
committerChristian Brabandt <cb@256bit.org>
Thu, 11 Sep 2025 19:02:21 +0000 (15:02 -0400)
Problem:  defaults: 'diffopt' option value can be improved
Solution: Update diffopt defaults to include "indent-heuristic" and
          "inline:char" (Yee Cheng Chin)

The default diff options have not been updated much despite new
functionality having been added to Vim.

- indent-heurstic: This has been enabled by default in Git since
  33de716387 in 2017. Given that Vim uses xdiff from Git, it makes sense
  to track the default configuration from Git.

- inline:char: This turns on character-wise inline highlighting which is
  generally much better than the default inline:simple. It has been
  implemented since #16881 and we have not seen reports of any issues
  with it, and it has received good feedbacks.

closes: #18255

Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
12 files changed:
runtime/doc/options.txt
runtime/doc/version9.txt
src/diff.c
src/optiondefs.h
src/testdir/dumps/Test_diff_10.dump
src/testdir/dumps/Test_diff_with_cursorline_01.dump
src/testdir/dumps/Test_diff_with_cursorline_02.dump
src/testdir/dumps/Test_diff_with_cursorline_03.dump
src/testdir/dumps/Test_smooth_diff_change_line_3a.dump [new file with mode: 0644]
src/testdir/test_diffmode.vim
src/testdir/test_scroll_opt.vim
src/version.c

index f318a8b59c8574c4ca5530d3ba52e3b331e75209..6d6f341bcb725f29b943b4493d35f8d94416f4b5 100644 (file)
@@ -1,4 +1,4 @@
-*options.txt*  For Vim version 9.1.  Last change: 2025 Sep 10
+*options.txt*  For Vim version 9.1.  Last change: 2025 Sep 11
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -3067,7 +3067,7 @@ A jump table for the options with a short description can be found at |Q_op|.
 
                                                *'dip'* *'diffopt'*
 'diffopt' 'dip'                string  (default
-                                "internal,filler,closeoff,inline:simple")
+                                "internal,filler,closeoff,indent-heuristic,inline:char")
                        global
                        {not available when compiled without the |+diff|
                        feature}
index c7f725badac0637da22e73ddc1d4a3cc9939ffd4..72f9a42ba4aafc96763aa1ace7a43f82ec4cf620 100644 (file)
@@ -1,4 +1,4 @@
-*version9.txt*  For Vim version 9.1.  Last change: 2025 Sep 10
+*version9.txt*  For Vim version 9.1.  Last change: 2025 Sep 11
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -41670,6 +41670,8 @@ Default values: ~
 - the default value for 'showcmd' is always enabled when using non-compatible
   mode (previously, it was off on UNIX systems) and consequently removed from
   |defaults.vim|
+- Improve the diff experience by updating the 'diffopt' default value to
+  "internal,filler,closeoff,indent-heuristic,inline:char".
 
 Completion: ~
 - allow to complete directories from 'cdpath' for |:cd| and similar commands,
index 13afade25c8127e7a7cb2653428c67b1e19b5ed5..1a60ee7aee3d324cdf00ae2903b9ad07dc5d8b01 100644 (file)
@@ -46,9 +46,9 @@ static int diff_need_update = FALSE; // ex_diffupdate needs to be called
 #define ALL_WHITE_DIFF (DIFF_IWHITE | DIFF_IWHITEALL | DIFF_IWHITEEOL)
 #define ALL_INLINE (DIFF_INLINE_NONE | DIFF_INLINE_SIMPLE | DIFF_INLINE_CHAR | DIFF_INLINE_WORD)
 #define ALL_INLINE_DIFF (DIFF_INLINE_CHAR | DIFF_INLINE_WORD)
-static int     diff_flags = DIFF_INTERNAL | DIFF_FILLER | DIFF_CLOSE_OFF;
+static int     diff_flags = DIFF_INTERNAL | DIFF_FILLER | DIFF_CLOSE_OFF | DIFF_INLINE_CHAR;
 
-static long diff_algorithm = 0;
+static long diff_algorithm = XDF_INDENT_HEURISTIC;
 
 #define LBUFLEN 50             // length of line in diff file
 
index ea49e80b2665559f002cb0b279bf40a2c506db2d..ed3c35ccb9dbbdc254afbb47efa694de4e2ea261 100644 (file)
@@ -896,7 +896,7 @@ static struct vimoption options[] =
                                                                     |P_NODUP,
 #ifdef FEAT_DIFF
                            (char_u *)&p_dip, PV_NONE, did_set_diffopt, expand_set_diffopt,
-                           {(char_u *)"internal,filler,closeoff,inline:simple",
+                           {(char_u *)"internal,filler,closeoff,indent-heuristic,inline:char",
                                                                (char_u *)NULL}
 #else
                            (char_u *)NULL, PV_NONE, NULL, NULL,
index 8bc91fb8bacdf4205957559da86d7e7d91660a77..6942f9354b0f4ad1e5b7c0cddb7cf7df4545ae5d 100644 (file)
@@ -17,4 +17,4 @@
 |~| @35||+1#0000000&|~+0#4040ff13&| @35
 |~| @35||+1#0000000&|~+0#4040ff13&| @35
 |X+3#0000000&|d|i|f|i|l|e|1| @10|1|,|0|-|1| @9|A|l@1| |X+1&&|d|i|f|i|l|e|2| @10|1|,|0|-|1| @9|A|l@1
-|:+0&&|s|e|t| |d|i|f@1|o|p|t|+|=|i|n|t|e|r|n|a|l| @52
+|:+0&&| @73
index d43c9caa56a8d563b4e50084c5b9c27cd157bfbf..31d8b2a189f13f2404ec6acfc01b48cc56b6fe40 100644 (file)
@@ -1,8 +1,8 @@
 | +0#0000e05#a8a8a8255@1|b+8#ffffff16#ff404010|e@1| @31||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34
 | +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31||+1&&| +0#0000e05#a8a8a8255@1>f+8#ffffff16#ff404010|o@1| @31
 | +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31
-| +0#0000e05#a8a8a8255@1|b+2#0000000#ff404010|a|z| +0&#ffd7ff255@31||+1&#ffffff0| +0#0000e05#a8a8a8255@1|f+2#0000000#ff404010|o@1| +0&#ffd7ff255@31
-| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|b+0#0000000#5fd7ff255|a|r| @31
+| +0#0000e05#a8a8a8255@1|b+0#0000000#ffd7ff255|a|z+2&#ff404010| +0&#ffd7ff255@31||+1&#ffffff0| +0#0000e05#a8a8a8255@1|f+2#0000000#ff404010|o@1| +0&#ffd7ff255@31
+| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|b+0#0000000#ffd7ff255|a|r+2&#ff404010| +0&#ffd7ff255@31
 |~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @35
 |~| @35||+1#0000000&|~+0#4040ff13&| @35
 |~| @35||+1#0000000&|~+0#4040ff13&| @35
index 477e3678a2089ed4b9096e33d8fee4325b9c7d60..9aef7d1fa3b216f1e7c4e488ff01000f017186a6 100644 (file)
@@ -1,8 +1,8 @@
 | +0#0000e05#a8a8a8255@1|b+0#0000000#5fd7ff255|e@1| @31||+1&#ffffff0| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34
 | +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31
 | +0#0000e05#a8a8a8255@1|f+8#ffffff16#ff404010|o@1| @31||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1>f+8#ffffff16#ff404010|o@1| @31
-| +0#0000e05#a8a8a8255@1|b+2#0000000#ff404010|a|z| +0&#ffd7ff255@31||+1&#ffffff0| +0#0000e05#a8a8a8255@1|f+2#0000000#ff404010|o@1| +0&#ffd7ff255@31
-| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|b+0#0000000#5fd7ff255|a|r| @31
+| +0#0000e05#a8a8a8255@1|b+0#0000000#ffd7ff255|a|z+2&#ff404010| +0&#ffd7ff255@31||+1&#ffffff0| +0#0000e05#a8a8a8255@1|f+2#0000000#ff404010|o@1| +0&#ffd7ff255@31
+| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|b+0#0000000#ffd7ff255|a|r+2&#ff404010| +0&#ffd7ff255@31
 |~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @35
 |~| @35||+1#0000000&|~+0#4040ff13&| @35
 |~| @35||+1#0000000&|~+0#4040ff13&| @35
index efef1c15b013078b5f189903663b8693a01aa57f..5bc9e13167381927fcf6adebb9e959c9d432efa1 100644 (file)
@@ -1,8 +1,8 @@
 | +0#0000e05#a8a8a8255@1|b+0#0000000#5fd7ff255|e@1| @31||+1&#ffffff0| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34
 | +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31
 | +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31
-| +0#0000e05#a8a8a8255@1|b+10#ffffff16#ff404010|a|z| +8&&@31||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1>f+10#ffffff16#ff404010|o@1| +8&&@31
-| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|b+0#0000000#5fd7ff255|a|r| @31
+| +0#0000e05#a8a8a8255@1|b+8#ffffff16#ff404010|a|z+10&&| +8&&@31||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1>f+10#ffffff16#ff404010|o@1| +8&&@31
+| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|b+0#0000000#ffd7ff255|a|r+2&#ff404010| +0&#ffd7ff255@31
 |~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @35
 |~| @35||+1#0000000&|~+0#4040ff13&| @35
 |~| @35||+1#0000000&|~+0#4040ff13&| @35
diff --git a/src/testdir/dumps/Test_smooth_diff_change_line_3a.dump b/src/testdir/dumps/Test_smooth_diff_change_line_3a.dump
new file mode 100644 (file)
index 0000000..d13141e
--- /dev/null
@@ -0,0 +1,20 @@
+|<+0#4040ff13#ffffff0@2| +0#0000000&|a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a||+1&&|<+0#4040ff13&@2| +0#0000000&|a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a
+| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| ||+1&&| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| 
+| +0#0000e05#a8a8a8255@1|a+0#0000000#ffffff0|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c||+1&&| +0#0000e05#a8a8a8255@1|a+0#0000000#ffffff0|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0|a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| @14||+1&&| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0|a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| @14
+| +0#0000e05#a8a8a8255@1|f+2#0000000#ff404010|o@1| +0&#ffd7ff255@31||+1&#ffffff0| +0#0000e05#a8a8a8255@1|b+2#0000000#ff404010|a|r|b+0&#ffd7ff255|a>r| @28
+| +0#0000e05#a8a8a8255@1|b+0#0000000#ffd7ff255|a|r| @31||+1&#ffffff0| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0|a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b||+1&&| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0|a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b
+| +0#0000e05#a8a8a8255@1|c+0#0000000#ffffff0| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a||+1&&| +0#0000e05#a8a8a8255@1|c+0#0000000#ffffff0| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a
+| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| ||+1&&| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| 
+| +0#0000e05#a8a8a8255@1|a+0#0000000#ffffff0|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c||+1&&| +0#0000e05#a8a8a8255@1|a+0#0000000#ffffff0|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0|a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b||+1&&| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0|a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b
+| +0#0000e05#a8a8a8255@1|c+0#0000000#ffffff0| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a||+1&&| +0#0000e05#a8a8a8255@1|c+0#0000000#ffffff0| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a
+| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| ||+1&&| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| 
+| +0#0000e05#a8a8a8255@1|a+0#0000000#ffffff0|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c||+1&&| +0#0000e05#a8a8a8255@1|a+0#0000000#ffffff0|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0|a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| @14||+1&&| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0|a|b|c| |a|b|c| |a|b|c| |a|b|c| |a|b|c| @14
+|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @35
+|~| @35||+1#0000000&|~+0#4040ff13&| @35
+|~| @35||+1#0000000&|~+0#4040ff13&| @35
+|[+1#0000000&|N|o| |N|a|m|e|]| |[|+|]| @5|2|,|4| @11|A|l@1| |[+3&&|N|o| |N|a|m|e|]| |[|+|]| @5|2|,|6| @11|A|l@1
+| +0&&@74
index 5ea7a7c8a0db6d13745924f1ef668eecd94a7b8c..42f9463b31bb35f1abae250bf530c38b22e1f53c 100644 (file)
@@ -862,6 +862,7 @@ func Test_diff_nomodifiable()
 endfunc
 
 func Test_diff_hlID()
+  set diffopt=internal,filler
   new
   call setline(1, [1, 2, 3, 'Yz', 'a dxxg',])
   diffthis
@@ -904,6 +905,7 @@ func Test_diff_hlID()
   call assert_equal(synIDattr(diff_hlID(3, 1), "name"), "")
 
   %bwipe!
+  set diffopt&
 endfunc
 
 func Test_diff_filler()
@@ -1079,18 +1081,18 @@ func Test_diff_screen()
   call term_sendkeys(buf, ":set diffopt+=algorithm:histogram\<cr>")
   call VerifyScreenDump(buf, 'Test_diff_09', {})
 
-  " Test 10-11: normal/indent-heuristic
+  " Test 10-11: with/without indent-heuristic
   call term_sendkeys(buf, ":set diffopt&vim\<cr>")
   call WriteDiffFiles(buf, ['', '  def finalize(values)', '', '    values.each do |v|', '      v.finalize', '    end'],
       \ ['', '  def finalize(values)', '', '    values.each do |v|', '      v.prepare', '    end', '',
       \ '    values.each do |v|', '      v.finalize', '    end'])
   call term_sendkeys(buf, ":diffupdate!\<cr>")
-  call term_sendkeys(buf, ":set diffopt+=internal\<cr>")
-  call VerifyScreenDump(buf, 'Test_diff_10', {})
+  call term_sendkeys(buf, ":set diffopt+=internal\<cr>:\<cr>")
+  call VerifyScreenDump(buf, 'Test_diff_11', {})
 
   " Leave trailing : at commandline!
-  call term_sendkeys(buf, ":set diffopt+=indent-heuristic\<cr>:\<cr>")
-  call VerifyScreenDump(buf, 'Test_diff_11', {}, 'one')
+  call term_sendkeys(buf, ":set diffopt-=indent-heuristic\<cr>:\<cr>")
+  call VerifyScreenDump(buf, 'Test_diff_10', {}, 'one')
   " shouldn't matter, if indent-algorithm comes before or after the algorithm
   call term_sendkeys(buf, ":set diffopt&\<cr>")
   call term_sendkeys(buf, ":set diffopt+=indent-heuristic,algorithm:patience\<cr>:\<cr>")
@@ -1331,6 +1333,7 @@ func Test_diff_with_syntax()
   call writefile(lines, 'Xprogram2.c', 'D')
 
   let lines =<< trim END
+    set diffopt=internal,filler
        edit Xprogram1.c
        diffsplit Xprogram2.c
   END
@@ -1473,6 +1476,7 @@ func Test_diff_rnu()
   CheckScreendump
 
   let content =<< trim END
+    set diffopt=internal,filler
     call setline(1, ['a', 'a', 'a', 'y', 'b', 'b', 'b', 'b', 'b'])
     vnew
     call setline(1, ['a', 'a', 'a', 'x', 'x', 'x', 'b', 'b', 'b', 'b', 'b'])
@@ -1560,6 +1564,7 @@ endfunc
 " Test for adding/removing lines inside diff chunks, between diff chunks
 " and before diff chunks
 func Test_diff_modify_chunks()
+  set diffopt=internal,filler
   enew!
   let w2_id = win_getid()
   call setline(1, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'])
@@ -1639,6 +1644,7 @@ func Test_diff_modify_chunks()
   call assert_equal(['', '', '', '', '', '', '', '', ''], hl)
 
   %bw!
+  set diffopt&
 endfunc
 
 func Test_diff_binary()
@@ -2868,7 +2874,7 @@ func Test_linematch_diff()
   call term_sendkeys(buf, ":set autoread\<CR>\<c-w>w:set autoread\<CR>\<c-w>w")
 
   " enable linematch
-  call term_sendkeys(buf, ":set diffopt+=linematch:30\<CR>")
+  call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:30\<CR>")
   call WriteDiffFiles(buf, ['// abc d?',
       \ '// d?',
       \ '// d?' ],
@@ -2896,7 +2902,7 @@ func Test_linematch_diff_iwhite()
   call term_sendkeys(buf, ":set autoread\<CR>\<c-w>w:set autoread\<CR>\<c-w>w")
 
   " setup a diff with 2 files and set linematch:30, with ignore white
-  call term_sendkeys(buf, ":set diffopt+=linematch:30\<CR>")
+  call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:30\<CR>")
   call WriteDiffFiles(buf, ['void testFunction () {',
       \ '  for (int i = 0; i < 10; i++) {',
       \ '    for (int j = 0; j < 10; j++) {',
@@ -2923,7 +2929,7 @@ func Test_linematch_diff_grouping()
   call term_sendkeys(buf, ":set autoread\<CR>\<c-w>w:set autoread\<CR>\<c-w>w")
 
   " a diff that would result in multiple groups before grouping optimization
-  call term_sendkeys(buf, ":set diffopt+=linematch:30\<CR>")
+  call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:30\<CR>")
   call WriteDiffFiles(buf, ['!A',
       \ '!B',
       \ '!C' ],
@@ -2961,7 +2967,7 @@ func Test_linematch_diff_scroll()
   call term_sendkeys(buf, ":set autoread\<CR>\<c-w>w:set autoread\<CR>\<c-w>w")
 
   " a diff that would result in multiple groups before grouping optimization
-  call term_sendkeys(buf, ":set diffopt+=linematch:30\<CR>")
+  call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:30\<CR>")
   call WriteDiffFiles(buf, ['!A',
       \ '!B',
       \ '!C' ],
@@ -2992,7 +2998,7 @@ func Test_linematch_line_limit_exceeded()
   let buf = RunVimInTerminal('-d Xdifile1 Xdifile2', {})
   call term_sendkeys(buf, ":set autoread\<CR>\<c-w>w:set autoread\<CR>\<c-w>w")
 
-  call term_sendkeys(buf, ":set diffopt+=linematch:10\<CR>")
+  call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:10\<CR>")
   " a diff block will not be aligned with linematch because it's contents
   " exceed 10 lines
   call WriteDiffFiles(buf,
@@ -3044,7 +3050,7 @@ func Test_linematch_3diffs()
   call term_sendkeys(buf, "1\<c-w>w:set autoread\<CR>")
   call term_sendkeys(buf, "2\<c-w>w:set autoread\<CR>")
   call term_sendkeys(buf, "3\<c-w>w:set autoread\<CR>")
-  call term_sendkeys(buf, ":set diffopt+=linematch:30\<CR>")
+  call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:30\<CR>")
   call WriteDiffFiles3(buf,
         \ ["",
         \ "  common line",
@@ -3079,7 +3085,7 @@ func Test_linematch_3diffs_sanity_check()
   call delete('.Xfile_linematch2.swp')
   call delete('.Xfile_linematch3.swp')
   let lines =<< trim END
-    set diffopt+=linematch:60
+    set diffopt=internal,filler,linematch:60
     call feedkeys("Aq\<esc>")
     call feedkeys("GAklm\<esc>")
     call feedkeys("o")
index 4e29976176e5084bb4f7905bbb24f5d97b8ef4de..81415e1c62af965d3742e93770a7c380b6c76a54 100644 (file)
@@ -301,11 +301,43 @@ func Test_smoothscroll_diff_mode()
   call StopVimInTerminal(buf)
 endfunc
 
+func Test_smoothscroll_diff_change_line_default()
+  CheckScreendump
+
+  " Uses the new diffopt default with indent-heuristic and inline:char
+  let lines =<< trim END
+    set diffopt=internal,filler,closeoff,indent-heuristic,inline:char,followwrap smoothscroll
+    call setline(1, repeat(' abc', &columns))
+    call setline(2, 'bar')
+    call setline(3, repeat(' abc', &columns))
+    vnew
+    call setline(1, repeat(' abc', &columns))
+    call setline(2, 'foo')
+    call setline(3, 'bar')
+    call setline(4, repeat(' abc', &columns))
+    windo exe "normal! 2gg5\<C-E>"
+    windo diffthis
+  END
+  call writefile(lines, 'XSmoothDiffChangeLine', 'D')
+  let buf = RunVimInTerminal('-S XSmoothDiffChangeLine', #{rows: 20, columns: 55})
+
+  call VerifyScreenDump(buf, 'Test_smooth_diff_change_line_1', {})
+  call term_sendkeys(buf, "Abar")
+  call VerifyScreenDump(buf, 'Test_smooth_diff_change_line_2', {})
+  call term_sendkeys(buf, "\<Esc>")
+  call VerifyScreenDump(buf, 'Test_smooth_diff_change_line_3a', {})
+  call term_sendkeys(buf, "yyp")
+  call VerifyScreenDump(buf, 'Test_smooth_diff_change_line_4', {})
+
+  call StopVimInTerminal(buf)
+endfunc
+
 func Test_smoothscroll_diff_change_line()
   CheckScreendump
 
+  " Uses the old diffopt default
   let lines =<< trim END
-    set diffopt+=followwrap smoothscroll
+    set diffopt=internal,filler,closeoff,followwrap,inline:simple smoothscroll
     call setline(1, repeat(' abc', &columns))
     call setline(2, 'bar')
     call setline(3, repeat(' abc', &columns))
index 7c186513b374e35a54de4e1fb21148d1be2f6b80..3dbb664c33234f4fcf44e2cf672fb1face2b0d57 100644 (file)
@@ -724,6 +724,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1753,
 /**/
     1752,
 /**/