When user types tab, translate it into spaces for consistency #656
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello, you wonderful Eve people!
As I started working on my first Eve project, I noticed something odd. Code blocks that looked fine in the browser IDE were saved to disk with odd indentation inconsistencies. Here's an example:
It turns out that when the editor automatically indents inside code blocks, it adds a soft tab of two spaces. But when the user hits the tab key, CodeMirror was adding a literal tab and displaying it with a width of two spaces. So when the code is saved to disk, some lines are indented two spaces (if they came from auto-indent) and some were indented with tabs (because I indented them)
Luckily there's a length conversation about soft tabs over in the CodeMirror issues and it had a pretty simple solution. I've ported that straight over here and assumed it should just live as a CodeMirror hack in those key options rather than getting into the
Editor
level. If you want this actually inEditor
, it looks like we'd have to add some more typings to expose the CM methods this uses.Thanks for Eve! Hope this is helpful.