diag: fix pretty write_underline writing line margin in bold
This commit is contained in:
@@ -33,11 +33,12 @@ struct snippet_print_ctx {
|
||||
const struct ivy_diag_amendment *ctx_amendment;
|
||||
};
|
||||
|
||||
#define __STREAM_COLOUR_ERROR "[red,bold]"
|
||||
#define __STREAM_COLOUR_WARN "[yellow,bold]"
|
||||
#define __STREAM_COLOUR_HINT "[blue,bold]"
|
||||
#define __STREAM_COLOUR_ACCENT "[cyan]"
|
||||
#define __STREAM_COLOUR_RESET "[reset]"
|
||||
#define __STREAM_COLOUR_ERROR "[red,bold]"
|
||||
#define __STREAM_COLOUR_WARN "[yellow,bold]"
|
||||
#define __STREAM_COLOUR_HINT "[blue,bold]"
|
||||
#define __STREAM_COLOUR_LINE_NO "[cyan]"
|
||||
#define __STREAM_COLOUR_ACCENT "[cyan]"
|
||||
#define __STREAM_COLOUR_RESET "[reset]"
|
||||
|
||||
#define STREAM_COLOUR_ERROR(stream) \
|
||||
if (DIAG_STREAM_FLAG_SET(stream, IVY_DIAG_STREAM_F_COLOUR)) { \
|
||||
@@ -55,6 +56,10 @@ struct snippet_print_ctx {
|
||||
if (DIAG_STREAM_FLAG_SET(stream, IVY_DIAG_STREAM_F_COLOUR)) { \
|
||||
diag_stream_puts(stream, __STREAM_COLOUR_ACCENT); \
|
||||
}
|
||||
#define STREAM_COLOUR_LINE_NO(stream) \
|
||||
if (DIAG_STREAM_FLAG_SET(stream, IVY_DIAG_STREAM_F_COLOUR)) { \
|
||||
diag_stream_puts(stream, __STREAM_COLOUR_LINE_NO); \
|
||||
}
|
||||
#define STREAM_COLOUR_RESET(stream) \
|
||||
if (DIAG_STREAM_FLAG_SET(stream, IVY_DIAG_STREAM_F_COLOUR)) { \
|
||||
diag_stream_puts(stream, __STREAM_COLOUR_RESET); \
|
||||
@@ -400,7 +405,8 @@ static void write_underline(struct snippet_print_ctx *ctx)
|
||||
return;
|
||||
}
|
||||
|
||||
STREAM_COLOUR_ACCENT(ctx->ctx_stream);
|
||||
STREAM_COLOUR_RESET(ctx->ctx_stream);
|
||||
STREAM_COLOUR_LINE_NO(ctx->ctx_stream);
|
||||
diag_stream_puts(ctx->ctx_stream, " : ");
|
||||
diag_stream_puts(ctx->ctx_stream, ctx->ctx_underline_buf);
|
||||
STREAM_COLOUR_RESET(ctx->ctx_stream);
|
||||
@@ -421,7 +427,7 @@ static void print_snippet(
|
||||
|
||||
for (unsigned long row = snippet->s_first_line;
|
||||
row <= snippet->s_last_line; row++) {
|
||||
STREAM_COLOUR_ACCENT(stream);
|
||||
STREAM_COLOUR_LINE_NO(stream);
|
||||
diag_stream_printf(stream, " %4lu | ", row);
|
||||
printer.ctx_row = row;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user