mirror of
https://github.com/sharkdp/bat.git
synced 2025-04-13 14:20:36 +01:00
Don't add artificial newline to last line if --style=plain
This fixes #1438. Note however, that using a pager such as less will add a newline itself. So to actually not print a newline for such files, you need to either disable paging: bat --style=plain --paging=never no-newline-at-end-of-file.txt or use a "pager" that does not add a newline: bat --style=plain --pager=cat no-newline-at-end-of-file.txt Note that we also update syntax tests file since a bunch of them had missing newlines on the last lines.
This commit is contained in:
parent
c3fc1b88fe
commit
68d525cd8b
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
## Bugfixes
|
## Bugfixes
|
||||||
|
|
||||||
|
- If the last line doesn't end with a newline character, don't add it if `--style=plain`, see #1438 (@Enselic)
|
||||||
|
|
||||||
## Other
|
## Other
|
||||||
|
|
||||||
## Syntaxes
|
## Syntaxes
|
||||||
|
@ -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)?;
|
writeln!(handle)?;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -175,4 +175,4 @@
|
|||||||
[38;2;117;113;94m\u{ad}[0m[38;2;249;38;114m␊[0m
|
[38;2;117;113;94m\u{ad}[0m[38;2;249;38;114m␊[0m
|
||||||
[38;2;117;113;94m\u{ae}[0m[38;2;249;38;114m␊[0m
|
[38;2;117;113;94m\u{ae}[0m[38;2;249;38;114m␊[0m
|
||||||
[38;2;249;38;114m␊[0m
|
[38;2;249;38;114m␊[0m
|
||||||
[38;2;248;248;242mHere's[0m[38;2;102;217;239m·[0m[38;2;248;248;242ma[0m[38;2;102;217;239m·[0m[38;2;248;248;242mline[0m[38;2;102;217;239m·[0m[38;2;248;248;242mwith[0m[38;2;102;217;239m·[0m[38;2;248;248;242mmultiple[0m[38;2;102;217;239m·[0m[38;2;248;248;242mcharacters.[0m
|
[38;2;248;248;242mHere's[0m[38;2;102;217;239m·[0m[38;2;248;248;242ma[0m[38;2;102;217;239m·[0m[38;2;248;248;242mline[0m[38;2;102;217;239m·[0m[38;2;248;248;242mwith[0m[38;2;102;217;239m·[0m[38;2;248;248;242mmultiple[0m[38;2;102;217;239m·[0m[38;2;248;248;242mcharacters.[0m[38;2;249;38;114m␊[0m
|
||||||
|
@ -72,4 +72,4 @@ package TestSyntax {
|
|||||||
var sndChannel:SoundChannel = mySound.play();
|
var sndChannel:SoundChannel = mySound.play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,4 +56,4 @@ set LDLIBS= ^
|
|||||||
@set "LINK_FILES=%LINK_FILES% %%~f"
|
@set "LINK_FILES=%LINK_FILES% %%~f"
|
||||||
)
|
)
|
||||||
|
|
||||||
lld-link.exe %LINK_FILES% -out:"%OUTPUT%" %LDFLAGS% %LDLIBS%
|
lld-link.exe %LINK_FILES% -out:"%OUTPUT%" %LDFLAGS% %LDLIBS%
|
||||||
|
@ -55,4 +55,4 @@
|
|||||||
(println (factorial 5))
|
(println (factorial 5))
|
||||||
(log)
|
(log)
|
||||||
(log "Message"))
|
(log "Message"))
|
||||||
|
|
||||||
|
@ -16,4 +16,4 @@ EXPOSE 80/tcp
|
|||||||
|
|
||||||
VOLUME [/var/lib/mysql/data]
|
VOLUME [/var/lib/mysql/data]
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
|
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
|
||||||
|
@ -13,4 +13,4 @@
|
|||||||
*.patch -text
|
*.patch -text
|
||||||
|
|
||||||
.gitattributes linguist-language=gitattributes
|
.gitattributes linguist-language=gitattributes
|
||||||
.gitkeep export-ignore
|
.gitkeep export-ignore
|
||||||
|
@ -104,4 +104,4 @@
|
|||||||
[user]
|
[user]
|
||||||
email = f.nord@example.com
|
email = f.nord@example.com
|
||||||
name = Frank Nord
|
name = Frank Nord
|
||||||
signingkey = AAAAAAAAAAAAAAAA
|
signingkey = AAAAAAAAAAAAAAAA
|
||||||
|
@ -5,4 +5,4 @@
|
|||||||
192.160.0.200 try.sample.test try #another comment
|
192.160.0.200 try.sample.test try #another comment
|
||||||
216.58.223.238 google.com
|
216.58.223.238 google.com
|
||||||
|
|
||||||
::1 localhost.try ip6-localhost
|
::1 localhost.try ip6-localhost
|
||||||
|
@ -382,4 +382,4 @@ install: all
|
|||||||
@ln -sf $(REDIS_SERVER_NAME) $(INSTALL_BIN)/$(REDIS_SENTINEL_NAME)
|
@ln -sf $(REDIS_SERVER_NAME) $(INSTALL_BIN)/$(REDIS_SENTINEL_NAME)
|
||||||
|
|
||||||
uninstall:
|
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)}
|
rm -f $(INSTALL_BIN)/{$(REDIS_SERVER_NAME),$(REDIS_BENCHMARK_NAME),$(REDIS_CLI_NAME),$(REDIS_CHECK_RDB_NAME),$(REDIS_CHECK_AOF_NAME),$(REDIS_SENTINEL_NAME)}
|
||||||
|
@ -108,4 +108,4 @@ $doe->setName('John Doe');
|
|||||||
|
|
||||||
$ending = 2 > 3 ? "yep" : "nah";
|
$ending = 2 > 3 ? "yep" : "nah";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -5,4 +5,4 @@ pywheels>=12.4 #a whitespace followed by comments
|
|||||||
Nuitka<0.6.8.4
|
Nuitka<0.6.8.4
|
||||||
wxPython>=1.0, <=2.1
|
wxPython>=1.0, <=2.1
|
||||||
|
|
||||||
#this is another comment
|
#this is another comment
|
||||||
|
@ -31,4 +31,4 @@ emails:
|
|||||||
- bob@example.com
|
- bob@example.com
|
||||||
- bill@example.com
|
- bill@example.com
|
||||||
supervisors:
|
supervisors:
|
||||||
- george@example.com
|
- george@example.com
|
||||||
|
@ -317,4 +317,4 @@ blank lines before and after.)
|
|||||||
..
|
..
|
||||||
|
|
||||||
So this block is not "lost",
|
So this block is not "lost",
|
||||||
despite its indentation.
|
despite its indentation.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user