mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-11 13:51:01 -05:00
c61a912f62
Now, only cells that have been used are cleared. This is achieved by using a "occupied" memo on the Row itself. The value, `occ`, is updated wherever the Row is accessed mutably, and it's cleared to zero in Row::reset. The tests for grid scroll_up and scroll_down were updated to include a test on the value `occ` and slightly refactored, but are otherwise equivalent to the previous implementation of those tests. Because of the change to the `Row` struct, the ref tests were updated so Deserialization keeps working as expected.
34 lines
654 B
Ruby
Executable file
34 lines
654 B
Ruby
Executable file
#!/usr/bin/env ruby
|
|
|
|
require 'json'
|
|
|
|
Dir.glob('./tests/ref/**/grid.json').each do |path|
|
|
puts "Migrating #{path}"
|
|
|
|
# Read contents
|
|
s = File.open(path) { |f| f.read }
|
|
|
|
# Parse
|
|
grid = JSON.parse(s)
|
|
|
|
# Normalize Storage serialization
|
|
if grid['raw'].is_a? Array
|
|
grid['raw'] = {
|
|
'inner' => grid['raw'][0],
|
|
'zero' => grid['raw'][1],
|
|
'visible_lines' => grid['raw'][2]
|
|
}
|
|
end
|
|
|
|
# Migrate Row serialization
|
|
grid['raw']['inner'].map! do |row|
|
|
if row.is_a? Hash
|
|
row
|
|
else
|
|
{ inner: row, occ: row.length }
|
|
end
|
|
end
|
|
|
|
# Write updated grid
|
|
File.open(path, 'w') { |f| f << JSON.generate(grid) }
|
|
end
|