mb21 / panwriter

Markdown editor with pandoc integration and paginated preview.
https://PanWriter.com
GNU General Public License v3.0
1.04k stars 51 forks source link

Assigning Font overwrote my File Content #74

Closed eleanorkonik closed 2 years ago

eleanorkonik commented 2 years ago

I opened up a markdown file with panwriter, tried to assign a font using the file menu, and then when I went back to the file, its only content was what looked like a yaml header — my actual file content was gone.

Did I do something wrong?

mb21 commented 2 years ago

No, that would definitely be a bug in PanWriter. Which version are you using? Please make sure it's the latest one.

eleanorkonik commented 2 years ago

I had literally just downloaded it off of github for the first time yesterday, so I'm pretty sure it was the latest, but I'll double check the actual version number when I'm back at my desk. I'm on windows, if it matters.

eleanorkonik commented 2 years ago

I confirmed I'm on panwriter 0.8.1 with a fresh download from yesterday. I confirmed the behavior happened to me again when I went to add a font to it. I pasted original content of the file back over the weird YAML thing.

I went to make a gif and it worked fine 🤦

So I was like "that's weird" and opened up a new file, clicked the left mouseover button that lets you change fonts and stuff, didn't change the font and went back to the file itself. It was suddenly empty.

panwrite-bug

Based on this behavior it seems like it only happens if you go to that menu if you haven't changed anything in that file yet? Maybe panwriter thinks the file is empty because I haven't interacted with the contents yet to have them loaded?

mb21 commented 2 years ago

Thanks for the excellent bug report! You were spot-on. I've pushed a commit that should fix this.

Some more testing before I make a release never hurts though... are you able/willing to try it? if so, see https://github.com/mb21/panwriter#develop

eleanorkonik commented 2 years ago

Oh gosh 😅 Yarn (?) and actually using git are over my head I'm sorry 🙈

mb21 commented 2 years ago

no problem, I did a pre-release: https://github.com/mb21/panwriter/releases/tag/v0.8.2-rc.1 but I didn't have time to test at all yet...

eleanorkonik commented 2 years ago

I installed the pre-release but maybe I did it wrong because I can't get a carrot and I can't "x" out of the file anymore (or close from the bottom menu). I'm on Windows 10 for what it's worth.

mb21 commented 2 years ago

Oops, yes. I'll try to take a look next week...

mb21 commented 2 years ago

okay, pushed rc.2 which seems to work for me after a quick test: https://github.com/mb21/panwriter/releases/tag/v0.8.2-rc.2

eleanorkonik commented 2 years ago

rc.2 lets me change the font / yaml fine and loads now, but when I try to click the print/PDF button nothing happened until I clickd around a bunch — for some reason, once I tried out all the views, clicing print/PDF worked again. I was able to repro this by closing panwriter, opening it again, trying to print (nothing happened) then changing view from edit to split, tried to print again, and I correctly got the dialog.

mb21 commented 2 years ago

hm.... can you describe the exact steps where clicking on the print button doesn't do anything? for me the following works for example:

  1. open PanWriter
  2. open file
  3. click on "Split View" button
  4. click on Print/PDF button

is it reproducable? or only when you do it quickly or something?

eleanorkonik commented 2 years ago

print-doesn0t-work

It's consistently reproducable.

  1. open PanWriter
  2. navigate to file-> open recent
  3. navigate to file-> print/pdf

nothing happens.

  1. navigate to split view button
  2. click on print/pdf button

I get the modal.

Being required to click split view before being able to print a file seems unintuitive to me, but maybe it's intended?

mb21 commented 2 years ago

ah, of course. File -> Print doesn't work until the preview is shown, because what it actually does it print the preview... and PanWriter isn't rendering the preview unless it's shown. So we could either:

  1. always render the preview (even if it's never shown, potentially impacting performance/UI-responsiveness)
  2. rename the menu entry to File -> Print preview and grey it out until preview is shown.
  3. Somehow render the preview when Print is clicked... but I would have to check whether that's easy to implement in the code...

So currently tending towards 2.)

eleanorkonik commented 2 years ago

Greying it out if it can't work makes the most sense I think!

mb21 commented 2 years ago

I remember now why I didn't grey it out previously – because the information whether a preview is shown or not is not readily available in that part of the code where the menu is rendered. But I added a warning now, so that when you click it, it will at least tell you why it's not working:

To print, please open a preview view first (e.g. View -> Show Split View)

Unless there are other bugs, I'll try to make a release shortly...

mb21 commented 2 years ago

released! https://github.com/mb21/panwriter/releases/tag/v0.8.2