mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	api: return error when starting a slice out of bounds.
This commit is contained in:
		 Nick Hynes
					Nick Hynes
				
			
				
					committed by
					
						 Justin M. Keyes
						Justin M. Keyes
					
				
			
			
				
	
			
			
			 Justin M. Keyes
						Justin M. Keyes
					
				
			
						parent
						
							90b4276d67
						
					
				
				
					commit
					7475c1c0f7
				
			| @@ -179,6 +179,11 @@ void buffer_set_line_slice(Buffer buffer, | |||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   if (!inbounds(buf, start)) { | ||||||
|  |     api_set_error(err, Validation, _("Index out of bounds")); | ||||||
|  |     return; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   start = normalize_index(buf, start) + (include_start ? 0 : 1); |   start = normalize_index(buf, start) + (include_start ? 0 : 1); | ||||||
|   include_end = include_end || (end >= buf->b_ml.ml_line_count); |   include_end = include_end || (end >= buf->b_ml.ml_line_count); | ||||||
|   end = normalize_index(buf, end) + (include_end ? 1 : 0); |   end = normalize_index(buf, end) + (include_end ? 1 : 0); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user