diff options
| author | jgmdev <jgmdev@gmail.com> | 2023-06-02 01:08:33 -0400 |
|---|---|---|
| committer | jgmdev <jgmdev@gmail.com> | 2023-06-02 01:08:46 -0400 |
| commit | ce8cfca1b06d2f043dec8dfcd69ce0cead6b5636 (patch) | |
| tree | eb912e9e9192af0f47d48ee8d707fe41720a811c /plugins/editorconfig | |
| parent | 754d2958a8b29858da198f0766667215935d1a0c (diff) | |
| download | pragtical-plugins-ce8cfca1b06d2f043dec8dfcd69ce0cead6b5636.tar.gz pragtical-plugins-ce8cfca1b06d2f043dec8dfcd69ce0cead6b5636.zip | |
editorconfig: fix issue with final new lines
Diffstat (limited to 'plugins/editorconfig')
| -rw-r--r-- | plugins/editorconfig/init.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/editorconfig/init.lua b/plugins/editorconfig/init.lua index 804a02a..b1d3ed7 100644 --- a/plugins/editorconfig/init.lua +++ b/plugins/editorconfig/init.lua @@ -400,10 +400,10 @@ function Doc:save(...) trim_trailing_whitespace(self) end - local lc = #self.lines local handle_new_line = handle_final_new_line(self) -- remove the unnecesary visible \n\n or the disabled \n + local lc = #self.lines if handle_new_line then self.lines[lc] = self.lines[lc]:gsub("\n$", "") end @@ -411,6 +411,7 @@ function Doc:save(...) doc_save(self, ...) -- restore the visible \n\n or disabled \n + lc = #self.lines if handle_new_line then self.lines[lc] = self.lines[lc] .. "\n" end |
