class Rufo::Formatter

def do_align(elements, adjust_comments = true)

def do_align(elements, adjust_comments = true)
  lines = @output.lines
  elements.reject! { |l, c, indent, id, off, ignore| ignore == :ignore }
  # Chunk comments that are in consecutive lines
  chunks = chunk_while(elements) do |(l1, c1, i1, id1), (l2, c2, i2, id2)|
    l1 + 1 == l2 && i1 == i2 && id1 == id2
  end
  chunks.each do |comments|
    next if comments.size == 1
    max_column = comments.map { |l, c| c }.max
    comments.each do |(line, column, _, _, offset)|
      next if column == max_column
      split_index  = column
      split_index -= offset if offset
      target_line = lines[line]
      before = target_line[0...split_index]
      after  = target_line[split_index..-1]
      filler_size = max_column - column
      filler      = " " * filler_size
      if adjust_comments && (index = @line_to_comments_position_index[line])
        @comments_positions[index][1] += filler_size
      end
      lines[line] = "#{before}#{filler}#{after}"
    end
  end
  @output = lines.join
end