nurpax / petmate

PETSCII editor with Electron/React/Redux
MIT License
179 stars 14 forks source link

Seq Export: Added option to strip out unnecessary blanks at end of the rows, replacing them with a Carriage Return. #157

Closed manuelvio closed 5 years ago

manuelvio commented 5 years ago

Trailing blanks characters aren't visible, yet they take up space and increase file size when exported as sequence, so with this option the user can choose to replace them with a single Carriage Return after the last visible char.

testopt

As an example, the above screen, when exported as seq file takes up 1024 bytes, because after the X square pattern rows are still filled with blank chars. Optimizing sequence strips out those blanks, trimming down file size to 134 bytes.

Another example with a visual representation of the optimization (dots = blanks char, arrows = CR)

Before: testopt_before

After: testopt_after

This option can be safely used with the other one that appends a CR to every row.

manuelvio commented 5 years ago

Uhm, I noticed there's still room for improvement, please hold on with this PR, I think I'm going to add a few commits more.

nurpax commented 5 years ago

Have at it, @manuelvio!

manuelvio commented 5 years ago

Ok, I added another bit of trimming logic, now the exported sequence should have less redundant data