mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	folds: Do not auto-update folds for some foldmethods. #5426
This commit is contained in:
		 Shougo Matsushita
					Shougo Matsushita
				
			
				
					committed by
					
						 Justin M. Keyes
						Justin M. Keyes
					
				
			
			
				
	
			
			
			 Justin M. Keyes
						Justin M. Keyes
					
				
			
						parent
						
							6a6f188d2a
						
					
				
				
					commit
					9d4fcec7c6
				
			| @@ -462,8 +462,7 @@ static void insert_enter(InsertState *s) | ||||
|     o_lnum = curwin->w_cursor.lnum; | ||||
|   } | ||||
|  | ||||
|   foldUpdateAll(curwin); | ||||
|   foldOpenCursor(); | ||||
|   foldUpdateAfterInsert(); | ||||
|   if (s->cmdchar != 'r' && s->cmdchar != 'v') { | ||||
|     apply_autocmds(EVENT_INSERTLEAVE, NULL, NULL, false, curbuf); | ||||
|   } | ||||
|   | ||||
| @@ -788,6 +788,19 @@ void foldUpdate(win_T *wp, linenr_T top, linenr_T bot) | ||||
|   } | ||||
| } | ||||
|  | ||||
| /// Updates folds when leaving insert-mode. | ||||
| void foldUpdateAfterInsert(void) | ||||
| { | ||||
|   if (foldmethodIsManual(curwin)  // foldmethod=manual: No need to update. | ||||
|       // These foldmethods are too slow, do not auto-update on insert-leave. | ||||
|       || foldmethodIsSyntax(curwin) || foldmethodIsExpr(curwin)) { | ||||
|     return; | ||||
|   } | ||||
|  | ||||
|   foldUpdateAll(curwin); | ||||
|   foldOpenCursor(); | ||||
| } | ||||
|  | ||||
| /* foldUpdateAll() {{{2 */ | ||||
| /* | ||||
|  * Update all lines in a window for folding. | ||||
|   | ||||
| @@ -5925,8 +5925,7 @@ static void nv_replace(cmdarg_T *cap) | ||||
|     set_last_insert(cap->nchar); | ||||
|   } | ||||
|  | ||||
|   foldUpdateAll(curwin); | ||||
|   foldOpenCursor(); | ||||
|   foldUpdateAfterInsert(); | ||||
| } | ||||
|  | ||||
| /* | ||||
|   | ||||
		Reference in New Issue
	
	Block a user