fix: make unindent_cursor work correctly in indent_mode tabs
This commit is contained in:
		
							parent
							
								
									ed1fe30e74
								
							
						
					
					
						commit
						666d30df3b
					
				
					 1 changed files with 5 additions and 5 deletions
				
			
		|  | @ -3725,16 +3725,16 @@ pub const Editor = struct { | ||||||
|         const off = first % self.indent_size; |         const off = first % self.indent_size; | ||||||
|         const cols = if (off == 0) self.indent_size else off; |         const cols = if (off == 0) self.indent_size else off; | ||||||
|         const sel = cursel.enable_selection(root, self.metrics) catch return error.Stop; |         const sel = cursel.enable_selection(root, self.metrics) catch return error.Stop; | ||||||
|         sel.begin.move_begin(); |         try sel.begin.move_to(root, sel.begin.row, first, self.metrics); | ||||||
|         try sel.end.move_to(root, sel.end.row, cols, self.metrics); |         try sel.end.move_to(root, sel.end.row, first - cols, self.metrics); | ||||||
|         var saved = false; |         var saved = false; | ||||||
|         if (cursor_protect) |cp| if (cp.row == cursor.row and cp.col < cols) { |         if (cursor_protect) |cp| if (cp.row == cursor.row and cp.col < first and cp.col >= first - cols) { | ||||||
|             cp.col = cols + 1; |             cp.col = first + 1; | ||||||
|             saved = true; |             saved = true; | ||||||
|         }; |         }; | ||||||
|         newroot = try self.delete_selection(root, &cursel, allocator); |         newroot = try self.delete_selection(root, &cursel, allocator); | ||||||
|         if (cursor_protect) |cp| if (saved) { |         if (cursor_protect) |cp| if (saved) { | ||||||
|             try cp.move_to(root, cp.row, 0, self.metrics); |             try cp.move_to(root, cp.row, first - cols, self.metrics); | ||||||
|             cp.clamp_to_buffer(newroot, self.metrics); |             cp.clamp_to_buffer(newroot, self.metrics); | ||||||
|         }; |         }; | ||||||
|         return newroot; |         return newroot; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue