fix: translate command line column from byte position to actual column
This commit is contained in:
		
							parent
							
								
									910331868e
								
							
						
					
					
						commit
						5afabeb7a5
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -4518,7 +4518,9 @@ pub const Editor = struct {
 | 
			
		|||
            return error.InvalidGotoColumnArgument;
 | 
			
		||||
        const root = self.buf_root() catch return;
 | 
			
		||||
        const primary = self.get_primary();
 | 
			
		||||
        try primary.cursor.move_to(root, primary.cursor.row, @intCast(if (column < 1) 0 else column - 1), self.metrics);
 | 
			
		||||
        column = if (column < 1) 0 else column - 1;
 | 
			
		||||
        column = try root.pos_to_width(primary.cursor.row, column, self.metrics);
 | 
			
		||||
        try primary.cursor.move_to(root, primary.cursor.row, column, self.metrics);
 | 
			
		||||
        self.clamp();
 | 
			
		||||
    }
 | 
			
		||||
    pub const goto_column_meta = .{ .arguments = &.{.integer} };
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue