mirror of
				https://github.com/vim/vim.git
				synced 2025-10-28 09:27:14 -04:00 
			
		
		
		
	patch 9.1.1753: defaults: 'diffopt' option value can be improved
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>
			
			
This commit is contained in:
		
				
					committed by
					
						 Christian Brabandt
						Christian Brabandt
					
				
			
			
				
	
			
			
			
						parent
						
							b49d695fbc
						
					
				
				
					commit
					976b365305
				
			| @@ -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 | 		  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'* | 						*'dip'* *'diffopt'* | ||||||
| 'diffopt' 'dip'		string	(default | 'diffopt' 'dip'		string	(default | ||||||
| 				 "internal,filler,closeoff,inline:simple") | 				 "internal,filler,closeoff,indent-heuristic,inline:char") | ||||||
| 			global | 			global | ||||||
| 			{not available when compiled without the |+diff| | 			{not available when compiled without the |+diff| | ||||||
| 			feature} | 			feature} | ||||||
|   | |||||||
| @@ -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 | 		  VIM REFERENCE MANUAL    by Bram Moolenaar | ||||||
| @@ -41670,6 +41670,8 @@ Default values: ~ | |||||||
| - the default value for 'showcmd' is always enabled when using non-compatible | - the default value for 'showcmd' is always enabled when using non-compatible | ||||||
|   mode (previously, it was off on UNIX systems) and consequently removed from |   mode (previously, it was off on UNIX systems) and consequently removed from | ||||||
|   |defaults.vim| |   |defaults.vim| | ||||||
|  | - Improve the diff experience by updating the 'diffopt' default value to | ||||||
|  |   "internal,filler,closeoff,indent-heuristic,inline:char". | ||||||
| 
 | 
 | ||||||
| Completion: ~ | Completion: ~ | ||||||
| - allow to complete directories from 'cdpath' for |:cd| and similar commands, | - allow to complete directories from 'cdpath' for |:cd| and similar commands, | ||||||
|   | |||||||
| @@ -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_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_INLINE_NONE | DIFF_INLINE_SIMPLE | DIFF_INLINE_CHAR | DIFF_INLINE_WORD) | ||||||
| #define ALL_INLINE_DIFF (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 | #define LBUFLEN 50		// length of line in diff file | ||||||
|  |  | ||||||
|   | |||||||
| @@ -896,7 +896,7 @@ static struct vimoption options[] = | |||||||
| 								     |P_NODUP, | 								     |P_NODUP, | ||||||
| #ifdef FEAT_DIFF | #ifdef FEAT_DIFF | ||||||
| 			    (char_u *)&p_dip, PV_NONE, did_set_diffopt, expand_set_diffopt, | 			    (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} | 								(char_u *)NULL} | ||||||
| #else | #else | ||||||
| 			    (char_u *)NULL, PV_NONE, NULL, NULL, | 			    (char_u *)NULL, PV_NONE, NULL, NULL, | ||||||
|   | |||||||
| @@ -17,4 +17,4 @@ | |||||||
| |~| @35||+1#0000000&|~+0#4040ff13&| @35 | |~| @35||+1#0000000&|~+0#4040ff13&| @35 | ||||||
| |~| @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 | |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 | ||||||
|   | |||||||
| @@ -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|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+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|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|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#5fd7ff255|a|r| @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 | |~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @35 | ||||||
| |~| @35||+1#0000000&|~+0#4040ff13&| @35 | |~| @35||+1#0000000&|~+0#4040ff13&| @35 | ||||||
| |~| @35||+1#0000000&|~+0#4040ff13&| @35 | |~| @35||+1#0000000&|~+0#4040ff13&| @35 | ||||||
|   | |||||||
| @@ -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|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|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|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|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#5fd7ff255|a|r| @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 | |~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @35 | ||||||
| |~| @35||+1#0000000&|~+0#4040ff13&| @35 | |~| @35||+1#0000000&|~+0#4040ff13&| @35 | ||||||
| |~| @35||+1#0000000&|~+0#4040ff13&| @35 | |~| @35||+1#0000000&|~+0#4040ff13&| @35 | ||||||
|   | |||||||
| @@ -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|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|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|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#5fd7ff255|a|r| @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 | |~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @35 | ||||||
| |~| @35||+1#0000000&|~+0#4040ff13&| @35 | |~| @35||+1#0000000&|~+0#4040ff13&| @35 | ||||||
| |~| @35||+1#0000000&|~+0#4040ff13&| @35 | |~| @35||+1#0000000&|~+0#4040ff13&| @35 | ||||||
|   | |||||||
							
								
								
									
										20
									
								
								src/testdir/dumps/Test_smooth_diff_change_line_3a.dump
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/testdir/dumps/Test_smooth_diff_change_line_3a.dump
									
									
									
									
									
										Normal file
									
								
							| @@ -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 | ||||||
| @@ -862,6 +862,7 @@ func Test_diff_nomodifiable() | |||||||
| endfunc | endfunc | ||||||
|  |  | ||||||
| func Test_diff_hlID() | func Test_diff_hlID() | ||||||
|  |   set diffopt=internal,filler | ||||||
|   new |   new | ||||||
|   call setline(1, [1, 2, 3, 'Yz', 'a dxxg',]) |   call setline(1, [1, 2, 3, 'Yz', 'a dxxg',]) | ||||||
|   diffthis |   diffthis | ||||||
| @@ -904,6 +905,7 @@ func Test_diff_hlID() | |||||||
|   call assert_equal(synIDattr(diff_hlID(3, 1), "name"), "") |   call assert_equal(synIDattr(diff_hlID(3, 1), "name"), "") | ||||||
|  |  | ||||||
|   %bwipe! |   %bwipe! | ||||||
|  |   set diffopt& | ||||||
| endfunc | endfunc | ||||||
|  |  | ||||||
| func Test_diff_filler() | func Test_diff_filler() | ||||||
| @@ -1079,18 +1081,18 @@ func Test_diff_screen() | |||||||
|   call term_sendkeys(buf, ":set diffopt+=algorithm:histogram\<cr>") |   call term_sendkeys(buf, ":set diffopt+=algorithm:histogram\<cr>") | ||||||
|   call VerifyScreenDump(buf, 'Test_diff_09', {}) |   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 term_sendkeys(buf, ":set diffopt&vim\<cr>") | ||||||
|   call WriteDiffFiles(buf, ['', '  def finalize(values)', '', '    values.each do |v|', '      v.finalize', '    end'], |   call WriteDiffFiles(buf, ['', '  def finalize(values)', '', '    values.each do |v|', '      v.finalize', '    end'], | ||||||
|       \ ['', '  def finalize(values)', '', '    values.each do |v|', '      v.prepare', '    end', '', |       \ ['', '  def finalize(values)', '', '    values.each do |v|', '      v.prepare', '    end', '', | ||||||
|       \ '    values.each do |v|', '      v.finalize', '    end']) |       \ '    values.each do |v|', '      v.finalize', '    end']) | ||||||
|   call term_sendkeys(buf, ":diffupdate!\<cr>") |   call term_sendkeys(buf, ":diffupdate!\<cr>") | ||||||
|   call term_sendkeys(buf, ":set diffopt+=internal\<cr>") |   call term_sendkeys(buf, ":set diffopt+=internal\<cr>:\<cr>") | ||||||
|   call VerifyScreenDump(buf, 'Test_diff_10', {}) |   call VerifyScreenDump(buf, 'Test_diff_11', {}) | ||||||
|  |  | ||||||
|   " Leave trailing : at commandline! |   " Leave trailing : at commandline! | ||||||
|   call term_sendkeys(buf, ":set diffopt+=indent-heuristic\<cr>:\<cr>") |   call term_sendkeys(buf, ":set diffopt-=indent-heuristic\<cr>:\<cr>") | ||||||
|   call VerifyScreenDump(buf, 'Test_diff_11', {}, 'one') |   call VerifyScreenDump(buf, 'Test_diff_10', {}, 'one') | ||||||
|   " shouldn't matter, if indent-algorithm comes before or after the algorithm |   " 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&\<cr>") | ||||||
|   call term_sendkeys(buf, ":set diffopt+=indent-heuristic,algorithm:patience\<cr>:\<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') |   call writefile(lines, 'Xprogram2.c', 'D') | ||||||
|  |  | ||||||
|   let lines =<< trim END |   let lines =<< trim END | ||||||
|  |     set diffopt=internal,filler | ||||||
| 	edit Xprogram1.c | 	edit Xprogram1.c | ||||||
| 	diffsplit Xprogram2.c | 	diffsplit Xprogram2.c | ||||||
|   END |   END | ||||||
| @@ -1473,6 +1476,7 @@ func Test_diff_rnu() | |||||||
|   CheckScreendump |   CheckScreendump | ||||||
|  |  | ||||||
|   let content =<< trim END |   let content =<< trim END | ||||||
|  |     set diffopt=internal,filler | ||||||
|     call setline(1, ['a', 'a', 'a', 'y', 'b', 'b', 'b', 'b', 'b']) |     call setline(1, ['a', 'a', 'a', 'y', 'b', 'b', 'b', 'b', 'b']) | ||||||
|     vnew |     vnew | ||||||
|     call setline(1, ['a', 'a', 'a', 'x', 'x', 'x', 'b', 'b', 'b', 'b', 'b']) |     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 | " Test for adding/removing lines inside diff chunks, between diff chunks | ||||||
| " and before diff chunks | " and before diff chunks | ||||||
| func Test_diff_modify_chunks() | func Test_diff_modify_chunks() | ||||||
|  |   set diffopt=internal,filler | ||||||
|   enew! |   enew! | ||||||
|   let w2_id = win_getid() |   let w2_id = win_getid() | ||||||
|   call setline(1, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']) |   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) |   call assert_equal(['', '', '', '', '', '', '', '', ''], hl) | ||||||
|  |  | ||||||
|   %bw! |   %bw! | ||||||
|  |   set diffopt& | ||||||
| endfunc | endfunc | ||||||
|  |  | ||||||
| func Test_diff_binary() | func Test_diff_binary() | ||||||
| @@ -2868,7 +2874,7 @@ func Test_linematch_diff() | |||||||
|   call delete('.Xdifile2.swp') |   call delete('.Xdifile2.swp') | ||||||
|   call WriteDiffFiles(0, [], []) |   call WriteDiffFiles(0, [], []) | ||||||
|   let buf = RunVimInTerminal('-d Xdifile1 Xdifile2', {}) |   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 autoread\<CR>\<c-w>w:set autoread\<CR>\<c-w>w") | ||||||
|  |  | ||||||
|   " enable linematch |   " enable linematch | ||||||
|   call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:30\<CR>") |   call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:30\<CR>") | ||||||
| @@ -2896,7 +2902,7 @@ func Test_linematch_diff_iwhite() | |||||||
|   call delete('.Xdifile2.swp') |   call delete('.Xdifile2.swp') | ||||||
|   call WriteDiffFiles(0, [], []) |   call WriteDiffFiles(0, [], []) | ||||||
|   let buf = RunVimInTerminal('-d Xdifile1 Xdifile2', {}) |   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 autoread\<CR>\<c-w>w:set autoread\<CR>\<c-w>w") | ||||||
|  |  | ||||||
|   " setup a diff with 2 files and set linematch:30, with ignore white |   " setup a diff with 2 files and set linematch:30, with ignore white | ||||||
|   call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:30\<CR>") |   call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:30\<CR>") | ||||||
| @@ -2923,7 +2929,7 @@ func Test_linematch_diff_grouping() | |||||||
|   call delete('.Xdifile2.swp') |   call delete('.Xdifile2.swp') | ||||||
|   call WriteDiffFiles(0, [], []) |   call WriteDiffFiles(0, [], []) | ||||||
|   let buf = RunVimInTerminal('-d Xdifile1 Xdifile2', {}) |   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 autoread\<CR>\<c-w>w:set autoread\<CR>\<c-w>w") | ||||||
|  |  | ||||||
|   " a diff that would result in multiple groups before grouping optimization |   " a diff that would result in multiple groups before grouping optimization | ||||||
|   call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:30\<CR>") |   call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:30\<CR>") | ||||||
| @@ -2961,7 +2967,7 @@ func Test_linematch_diff_scroll() | |||||||
|   call delete('.Xdifile2.swp') |   call delete('.Xdifile2.swp') | ||||||
|   call WriteDiffFiles(0, [], []) |   call WriteDiffFiles(0, [], []) | ||||||
|   let buf = RunVimInTerminal('-d Xdifile1 Xdifile2', {}) |   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 autoread\<CR>\<c-w>w:set autoread\<CR>\<c-w>w") | ||||||
|  |  | ||||||
|   " a diff that would result in multiple groups before grouping optimization |   " a diff that would result in multiple groups before grouping optimization | ||||||
|   call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:30\<CR>") |   call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:30\<CR>") | ||||||
| @@ -2992,7 +2998,7 @@ func Test_linematch_line_limit_exceeded() | |||||||
|   call delete('.Xdifile1.swp') |   call delete('.Xdifile1.swp') | ||||||
|   call delete('.Xdifile2.swp') |   call delete('.Xdifile2.swp') | ||||||
|   call WriteDiffFiles(0, [], []) |   call WriteDiffFiles(0, [], []) | ||||||
|   let buf = RunVimInTerminal('-d Xdifile1 Xdifile2', {}) |   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 autoread\<CR>\<c-w>w:set autoread\<CR>\<c-w>w") | ||||||
|  |  | ||||||
|   call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:10\<CR>") |   call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:10\<CR>") | ||||||
| @@ -3044,7 +3050,7 @@ func Test_linematch_3diffs() | |||||||
|   call delete('.Xdifile3.swp') |   call delete('.Xdifile3.swp') | ||||||
|   call WriteDiffFiles3(0, [], [], []) |   call WriteDiffFiles3(0, [], [], []) | ||||||
|   let buf = RunVimInTerminal('-d Xdifile1 Xdifile2 Xdifile3', {}) |   let buf = RunVimInTerminal('-d Xdifile1 Xdifile2 Xdifile3', {}) | ||||||
|   call term_sendkeys(buf, "1\<c-w>w:set autoread\<CR>") |   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, "2\<c-w>w:set autoread\<CR>") | ||||||
|   call term_sendkeys(buf, "3\<c-w>w:set autoread\<CR>") |   call term_sendkeys(buf, "3\<c-w>w:set autoread\<CR>") | ||||||
|   call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:30\<CR>") |   call term_sendkeys(buf, ":set diffopt=internal,filler,linematch:30\<CR>") | ||||||
| @@ -3079,7 +3085,7 @@ func Test_linematch_3diffs_sanity_check() | |||||||
| func Test_linematch_3diffs_sanity_check() | func Test_linematch_3diffs_sanity_check() | ||||||
|   CheckScreendump |   CheckScreendump | ||||||
|   call delete('.Xfile_linematch1.swp') |   call delete('.Xfile_linematch1.swp') | ||||||
|   call delete('.Xfile_linematch2.swp') |   call delete('.Xfile_linematch2.swp') | ||||||
|   call delete('.Xfile_linematch3.swp') |   call delete('.Xfile_linematch3.swp') | ||||||
|   let lines =<< trim END |   let lines =<< trim END | ||||||
|     set diffopt=internal,filler,linematch:60 |     set diffopt=internal,filler,linematch:60 | ||||||
|   | |||||||
| @@ -301,11 +301,43 @@ func Test_smoothscroll_diff_mode() | |||||||
|   call StopVimInTerminal(buf) |   call StopVimInTerminal(buf) | ||||||
| endfunc | 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() | func Test_smoothscroll_diff_change_line() | ||||||
|   CheckScreendump |   CheckScreendump | ||||||
|  |  | ||||||
|  |   " Uses the old diffopt default | ||||||
|   let lines =<< trim END |   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(1, repeat(' abc', &columns)) | ||||||
|     call setline(2, 'bar') |     call setline(2, 'bar') | ||||||
|     call setline(3, repeat(' abc', &columns)) |     call setline(3, repeat(' abc', &columns)) | ||||||
|   | |||||||
| @@ -724,6 +724,8 @@ static char *(features[]) = | |||||||
|  |  | ||||||
| static int included_patches[] = | static int included_patches[] = | ||||||
| {   /* Add new patch number below this line */ | {   /* Add new patch number below this line */ | ||||||
|  | /**/ | ||||||
|  |     1753, | ||||||
| /**/ | /**/ | ||||||
|     1752, |     1752, | ||||||
| /**/ | /**/ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user