mirror of
				https://github.com/vim/vim.git
				synced 2025-10-30 09:47:20 -04:00 
			
		
		
		
	patch 9.0.1612: "skipcol" not reset when using multi-byte characters
Problem: "skipcol" not reset when using multi-byte characters. Solution: Compare with w_virtcol instead of w_cursor.col. (closes #12457)
This commit is contained in:
		
							
								
								
									
										12
									
								
								src/move.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/move.c
									
									
									
									
									
								
							| @@ -2414,10 +2414,14 @@ scroll_cursor_top(int min_scroll, int always) | |||||||
| 	} | 	} | ||||||
| 	check_topfill(curwin, FALSE); | 	check_topfill(curwin, FALSE); | ||||||
| #endif | #endif | ||||||
| 	// TODO: if the line doesn't fit may optimize w_skipcol | 	if (curwin->w_topline == curwin->w_cursor.lnum) | ||||||
| 	if (curwin->w_topline == curwin->w_cursor.lnum | 	{ | ||||||
| 		&& curwin->w_skipcol >= curwin->w_cursor.col) | 	    validate_virtcol(); | ||||||
| 	    reset_skipcol(); | 	    if (curwin->w_skipcol >= curwin->w_virtcol) | ||||||
|  | 		// TODO: if the line doesn't fit may optimize w_skipcol instead | ||||||
|  | 		// of making it zero | ||||||
|  | 		reset_skipcol(); | ||||||
|  | 	} | ||||||
| 	if (curwin->w_topline != old_topline | 	if (curwin->w_topline != old_topline | ||||||
| 		|| curwin->w_skipcol != old_skipcol | 		|| curwin->w_skipcol != old_skipcol | ||||||
| #ifdef FEAT_DIFF | #ifdef FEAT_DIFF | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								src/testdir/dumps/Test_smoothscroll_multi_1.dump
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/testdir/dumps/Test_smoothscroll_multi_1.dump
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | |ϛ+0&#ffffff0@34>ϛ@4 | ||||||
|  | @5| @34 | ||||||
|  | |2@35| @3 | ||||||
|  | |~+0#4040ff13&| @38 | ||||||
|  | |~| @38 | ||||||
|  | | +0#0000000&@21|1|,|7|1|-|3|6| @6|A|l@1|  | ||||||
| @@ -124,6 +124,21 @@ func Test_smoothscroll_CtrlE_CtrlY() | |||||||
|   call StopVimInTerminal(buf) |   call StopVimInTerminal(buf) | ||||||
| endfunc | endfunc | ||||||
|  |  | ||||||
|  | func Test_smoothscroll_multibyte() | ||||||
|  |   CheckScreendump | ||||||
|  |  | ||||||
|  |   let lines =<< trim END | ||||||
|  |       set scrolloff=0 smoothscroll | ||||||
|  |       call setline(1, [repeat('ϛ', 45), repeat('2', 36)]) | ||||||
|  |       exe "normal G35l\<C-E>k" | ||||||
|  |   END | ||||||
|  |   call writefile(lines, 'XSmoothMultibyte', 'D') | ||||||
|  |   let buf = RunVimInTerminal('-S XSmoothMultibyte', #{rows: 6, cols: 40}) | ||||||
|  |   call VerifyScreenDump(buf, 'Test_smoothscroll_multi_1', {}) | ||||||
|  |  | ||||||
|  |   call StopVimInTerminal(buf) | ||||||
|  | endfunc | ||||||
|  |  | ||||||
| func Test_smoothscroll_number() | func Test_smoothscroll_number() | ||||||
|   CheckScreendump |   CheckScreendump | ||||||
|  |  | ||||||
|   | |||||||
| @@ -695,6 +695,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 */ | ||||||
|  | /**/ | ||||||
|  |     1612, | ||||||
| /**/ | /**/ | ||||||
|     1611, |     1611, | ||||||
| /**/ | /**/ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user