Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse empty files #150

Merged
merged 1 commit into from
Aug 1, 2024
Merged

Parse empty files #150

merged 1 commit into from
Aug 1, 2024

Conversation

jannis-baum
Copy link
Owner

Close #149

@jannis-baum
Copy link
Owner Author

jannis-baum commented Aug 1, 2024

One caveat here is of course that you have to save the file before you can open Vivify, on a new Vim buffer that is not saved yet this won't work because Vivify is organized in parallel to the file system

@tuurep
Copy link
Collaborator

tuurep commented Aug 1, 2024

Yes, exactly what I was after! Thanks!

Also tested with an extensionless file, and opens this:

image

Whereas before it would have asked me if I want to save file, because of this firefox setting I think:

image

And showing the empty text file is much better in my opinion

@jannis-baum
Copy link
Owner Author

Nice! Happy this was so easy for once hahahaha

Whereas before it would have asked me if I want to save file, because of this firefox setting I think:

Yeah files with shouldRender(...) == false will be sent as data which is necessary e.g. to render local images in Markdown files. And browsers will do the download when they get data.

@jannis-baum jannis-baum merged commit 55facfb into main Aug 1, 2024
6 checks passed
@jannis-baum jannis-baum deleted the issue/149-parse-empty-files branch August 1, 2024 18:22
@Tweekism
Copy link
Collaborator

Tweekism commented Aug 3, 2024

On Windows, this will be application/x-empty

Mental note for me for later...

@tuurep
Copy link
Collaborator

tuurep commented Aug 3, 2024

Btw this doesn't behave so well when you delete all contents in a file while previewing,

  • rather than empty buffer, shows last non-empty contents
  • if you save it as empty and re-view, still shows the last non-empty contents

But I'm not sure how much is related to:

Vivify is organized in parallel to the file system

Is it changing the file -type on the fly, if you know what I mean?

@jannis-baum
Copy link
Owner Author

@tuurep Ah okay, this is probably because the empty string resolves to "false" so it doesn't update it and then it still has the live content saved when you reopen it. I'll fix that later :)

@tuurep
Copy link
Collaborator

tuurep commented Aug 3, 2024

Nice, sounds like an easy problem 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parse empty files
3 participants