diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ef17a38..05540511 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ ## Bugfixes +- If the last line doesn't end with a newline character, don't add it if `--style=plain`, see #1438 (@Enselic) + ## Other ## Syntaxes diff --git a/src/printer.rs b/src/printer.rs index b240f83f..d588083e 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -460,7 +460,7 @@ impl<'a> Printer for InteractivePrinter<'a> { } } - if line.bytes().next_back() != Some(b'\n') { + if !self.config.style_components.plain() && line.bytes().next_back() != Some(b'\n') { writeln!(handle)?; } } else { diff --git a/tests/syntax-tests/highlighted/Plaintext/plaintext.txt b/tests/syntax-tests/highlighted/Plaintext/plaintext.txt index 807728e1..1f27a79f 100644 --- a/tests/syntax-tests/highlighted/Plaintext/plaintext.txt +++ b/tests/syntax-tests/highlighted/Plaintext/plaintext.txt @@ -175,4 +175,4 @@ \u{ad}␊ \u{ae}␊ ␊ -Here's·a·line·with·multiple·characters. +Here's·a·line·with·multiple·characters.␊ diff --git a/tests/syntax-tests/source/ActionScript/test.as b/tests/syntax-tests/source/ActionScript/test.as index 1f7a1936..f1828bbc 100644 --- a/tests/syntax-tests/source/ActionScript/test.as +++ b/tests/syntax-tests/source/ActionScript/test.as @@ -72,4 +72,4 @@ package TestSyntax { var sndChannel:SoundChannel = mySound.play(); } } -} \ No newline at end of file +} diff --git a/tests/syntax-tests/source/Batch/build.bat b/tests/syntax-tests/source/Batch/build.bat index 56a262e2..acf9f7cd 100644 --- a/tests/syntax-tests/source/Batch/build.bat +++ b/tests/syntax-tests/source/Batch/build.bat @@ -56,4 +56,4 @@ set LDLIBS= ^ @set "LINK_FILES=%LINK_FILES% %%~f" ) -lld-link.exe %LINK_FILES% -out:"%OUTPUT%" %LDFLAGS% %LDLIBS% \ No newline at end of file +lld-link.exe %LINK_FILES% -out:"%OUTPUT%" %LDFLAGS% %LDLIBS% diff --git a/tests/syntax-tests/source/Clojure/test.clj b/tests/syntax-tests/source/Clojure/test.clj index ea24e822..b4010da1 100644 --- a/tests/syntax-tests/source/Clojure/test.clj +++ b/tests/syntax-tests/source/Clojure/test.clj @@ -55,4 +55,4 @@ (println (factorial 5)) (log) (log "Message")) - \ No newline at end of file + diff --git a/tests/syntax-tests/source/Dockerfile/Dockerfile b/tests/syntax-tests/source/Dockerfile/Dockerfile index 54a3b2c8..b38bce26 100644 --- a/tests/syntax-tests/source/Dockerfile/Dockerfile +++ b/tests/syntax-tests/source/Dockerfile/Dockerfile @@ -16,4 +16,4 @@ EXPOSE 80/tcp VOLUME [/var/lib/mysql/data] -ENTRYPOINT ["/usr/bin/entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["/usr/bin/entrypoint.sh"] diff --git a/tests/syntax-tests/source/Git Attributes/example.gitattributes b/tests/syntax-tests/source/Git Attributes/example.gitattributes index 9b8e58b8..8b3502b7 100644 --- a/tests/syntax-tests/source/Git Attributes/example.gitattributes +++ b/tests/syntax-tests/source/Git Attributes/example.gitattributes @@ -13,4 +13,4 @@ *.patch -text .gitattributes linguist-language=gitattributes -.gitkeep export-ignore \ No newline at end of file +.gitkeep export-ignore diff --git a/tests/syntax-tests/source/Git Config/text.gitconfig b/tests/syntax-tests/source/Git Config/text.gitconfig index 45de0fe5..47224f0b 100644 --- a/tests/syntax-tests/source/Git Config/text.gitconfig +++ b/tests/syntax-tests/source/Git Config/text.gitconfig @@ -104,4 +104,4 @@ [user] email = f.nord@example.com name = Frank Nord - signingkey = AAAAAAAAAAAAAAAA \ No newline at end of file + signingkey = AAAAAAAAAAAAAAAA diff --git a/tests/syntax-tests/source/Hosts/hosts b/tests/syntax-tests/source/Hosts/hosts index d7d4307d..e9d24c2d 100644 --- a/tests/syntax-tests/source/Hosts/hosts +++ b/tests/syntax-tests/source/Hosts/hosts @@ -5,4 +5,4 @@ 192.160.0.200 try.sample.test try #another comment 216.58.223.238 google.com -::1 localhost.try ip6-localhost \ No newline at end of file +::1 localhost.try ip6-localhost diff --git a/tests/syntax-tests/source/Makefile/Makefile b/tests/syntax-tests/source/Makefile/Makefile index 7acc5b2d..87379733 100644 --- a/tests/syntax-tests/source/Makefile/Makefile +++ b/tests/syntax-tests/source/Makefile/Makefile @@ -382,4 +382,4 @@ install: all @ln -sf $(REDIS_SERVER_NAME) $(INSTALL_BIN)/$(REDIS_SENTINEL_NAME) uninstall: - rm -f $(INSTALL_BIN)/{$(REDIS_SERVER_NAME),$(REDIS_BENCHMARK_NAME),$(REDIS_CLI_NAME),$(REDIS_CHECK_RDB_NAME),$(REDIS_CHECK_AOF_NAME),$(REDIS_SENTINEL_NAME)} \ No newline at end of file + rm -f $(INSTALL_BIN)/{$(REDIS_SERVER_NAME),$(REDIS_BENCHMARK_NAME),$(REDIS_CLI_NAME),$(REDIS_CHECK_RDB_NAME),$(REDIS_CHECK_AOF_NAME),$(REDIS_SENTINEL_NAME)} diff --git a/tests/syntax-tests/source/PHP/test.php b/tests/syntax-tests/source/PHP/test.php index 26413597..1f0a581f 100644 --- a/tests/syntax-tests/source/PHP/test.php +++ b/tests/syntax-tests/source/PHP/test.php @@ -108,4 +108,4 @@ $doe->setName('John Doe'); $ending = 2 > 3 ? "yep" : "nah"; -?> \ No newline at end of file +?> diff --git a/tests/syntax-tests/source/Plaintext/plaintext.txt b/tests/syntax-tests/source/Plaintext/plaintext.txt index 42da1207..112ef7e9 100644 Binary files a/tests/syntax-tests/source/Plaintext/plaintext.txt and b/tests/syntax-tests/source/Plaintext/plaintext.txt differ diff --git a/tests/syntax-tests/source/PowerShell/test.ps1 b/tests/syntax-tests/source/PowerShell/test.ps1 index 434414df..315149a8 100755 Binary files a/tests/syntax-tests/source/PowerShell/test.ps1 and b/tests/syntax-tests/source/PowerShell/test.ps1 differ diff --git a/tests/syntax-tests/source/RequirementsTXT/requirements.txt b/tests/syntax-tests/source/RequirementsTXT/requirements.txt index 83a41dc8..83d71e0e 100644 --- a/tests/syntax-tests/source/RequirementsTXT/requirements.txt +++ b/tests/syntax-tests/source/RequirementsTXT/requirements.txt @@ -5,4 +5,4 @@ pywheels>=12.4 #a whitespace followed by comments Nuitka<0.6.8.4 wxPython>=1.0, <=2.1 -#this is another comment \ No newline at end of file +#this is another comment diff --git a/tests/syntax-tests/source/YAML/example.yaml b/tests/syntax-tests/source/YAML/example.yaml index 1b215705..d7b4c912 100644 --- a/tests/syntax-tests/source/YAML/example.yaml +++ b/tests/syntax-tests/source/YAML/example.yaml @@ -31,4 +31,4 @@ emails: - bob@example.com - bill@example.com supervisors: - - george@example.com \ No newline at end of file + - george@example.com diff --git a/tests/syntax-tests/source/reStructuredText/reference.rst b/tests/syntax-tests/source/reStructuredText/reference.rst index e07f54c4..5c42e540 100644 --- a/tests/syntax-tests/source/reStructuredText/reference.rst +++ b/tests/syntax-tests/source/reStructuredText/reference.rst @@ -317,4 +317,4 @@ blank lines before and after.) .. So this block is not "lost", - despite its indentation. \ No newline at end of file + despite its indentation.