Auto save & new line prevents undo from working
See original GitHub issue- Version: 1.41.0
- Commit: 9579eda04fdb3a9bba2750f15193e5fafe16b959
- Date: 2019-12-11T17:58:38.338Z
- Electron: 6.1.5
- Chrome: 76.0.3809.146
- Node.js: 12.4.0
- V8: 7.6.303.31-electron.0
- OS: Darwin x64 19.2.0
Steps to Reproduce:
- set
"files.trimFinalNewlines": true
and"files.autoSave": "afterDelay"
; edit: instead set"files.insertFinalNewline": true
to follow POSIX conventions - move the caret to the very end of the file
- insert a string at the very end of a file
- a new line is automatically added
- try to undo step 3 will remove the new line, which is then added again
Does this issue occur when all extensions are disabled?: Yes
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Prevent VSCode auto format on save from removing final ...
I am using the last feature of VSCode called formatOnSave, which is super cool. I have one tiny problem, the formatter tends to...
Read more >On save new line added to end of file. How stop this?
This bug is STILL present in Windows. I had both unchecked 'Remove trailing blank lines at the end of saved files' and 'Ensure...
Read more >Disable auto-save in a model-driven app - Microsoft Learn
Learn how to configure autosave for a model-driven app.
Read more >How do I remove linebreaks in Notepad++? - Super User
It will put in spaces automatically if necessary to prevent words from ... word of the current line and the first word of...
Read more >Understanding backup and autosave files in AutoCAD
Disabling automatic save prevents AutoCAD from automatically creating .sv$ files while working. In the event of a crash, there will be no ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I know this is as designed and is what I want, because very line has to have a
\n
at the end to be POSIX compatible i.e. work well under UNIXoid systems et cetera. I don’t mind seeing it rendered, also changing the setting to false doesn’t prevent the bug.The bug report is about Undo not working: It’s impossible to undo any input you do on that said last line, because “auto insert newline” is the last undo action and not “paste text” as it should be because it’s the actual last user action.
@quassy
"files.insertFinalNewline": true
means the file will be saved to disk with a\n
as the last character… No matter what the buffer contents are before the save, the file will be saved to disk with\n
as the last character (I think there is an exception for empty files, but otherwise,\n
is always added at the end of the buffer by a save participant. This is “as designed”.If you don’t like to see the extra new line, you could use
"editor.renderFinalNewline": false
…