nurpax / petmate

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

BASIC exporter should export the active screen, not the first in the list #78

Closed Esshahn closed 6 years ago

Esshahn commented 6 years ago

It seem that the BASIC exporter always chooses the first screen to export when there are multiple ones. It would be better if it exports the current visible/selected one instead.

Otherwise one would need to delete all screens that are one the left side of the thumbnails to export the current screen.

Scenario below exports the first screen, not the second one with the white border

screenshot 2018-08-12 um 12 02 24

nurpax commented 6 years ago

It was intended to export the currently selected screen, so definitely a bug.

nurpax commented 6 years ago

OK, here's the bug:

const saveBASIC = (filename, fbs, options) => {
  try {
    let lines = []
    // Single screen export
    convertToBASIC(lines, fbs[options.selectedFramebufIndex], 0)

    let backgroundColor
    let borderColor
    if (fbs.length >= 1) {
      backgroundColor = fbs[0].backgroundColor
      borderColor = fbs[0].borderColor
    }

I think I originally exported all the frames and then later decided to export just one. And ehh brainfart^Wrefactored it to pick the wrong border/bg colors.

nurpax commented 6 years ago

Same bug in .asm export too. Fix incoming.