Skip to content

Don't strip trailing newlines when writing to disk #91

@dannysmith

Description

@dannysmith

When writing long documents it's often nice to have the cursor/current line not right at the bottom of the window. Having removed the (very broken) typewriter mode from AE, the only way of achieving this is to add a bunch of newlines at the end of the doc... which is pretty common practice in loads of editors.

Astro Editor currently strips these training new lines when writing the file to disk, which Is every few seconds if autosave is on. We should not do this because:

  1. It prevents users doing the thing above.
  2. It feels janky and causes unexpected cursor movement etc.
  3. Most importantly... stripping trailing newlines is not a writer mode concern, it is a coder mode activity.

If users choose to strip trailing new lines before publishing they can do so in their code editor.

That said, we should ensure that at least one empty newline is Inserted at the end of the document when writing to disk, because that's just good practice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions