commit dbebc89f4f79743958d17f0d5694ca1b90a95b39
parent 53ee1e571244f465783a084ab25b3846f545bb17
Author: Sebastian <sebastian@sebsite.pw>
Date: Sat, 9 Dec 2023 21:17:07 -0500
haredoc: submodules newline fixes
If a README wasn't present but the module had submodules, a newline was
inserted before the submodules were listed, and a newline wasn't added
after the submodules before the declarations.
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/cmd/haredoc/doc/tty.ha b/cmd/haredoc/doc/tty.ha
@@ -103,7 +103,10 @@ export fn emit_tty(ctx: *context) (void | error) = {
fn emit_submodules_tty(ctx: *context) (void | error) = {
if (len(ctx.submods) != 0) {
- fmt::fprintln(ctx.out)?;
+ if (!firstline) {
+ fmt::fprintln(ctx.out)?;
+ };
+ firstline = false;
if (!no_color) fmt::fprintf(ctx.out, "\x1b[{}m",
color(unparse::synkind::COMMENT))?;
if (len(ctx.ident) == 0) {