diff options
author | LarsVomMars | 2021-04-27 15:27:27 +0200 |
---|---|---|
committer | LarsVomMars | 2021-04-27 15:27:27 +0200 |
commit | 60e7b5069d5936546356053f85008a5a02bb473a (patch) | |
tree | 72e30bf504bccc15f18f29fa2344bd22324b4267 /src/warnings.c | |
parent | efbbd5533e2d66dcfb6d360792793f23a8f4dd05 (diff) |
lol
Diffstat (limited to 'src/warnings.c')
-rw-r--r-- | src/warnings.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/warnings.c b/src/warnings.c index 8effbb2..da8d11b 100644 --- a/src/warnings.c +++ b/src/warnings.c @@ -13,6 +13,7 @@ struct warning { u8 exists; struct context ctx; char text[WARNING_LENGTH]; + char name[8]; }; static struct warning warnings[WARNING_COUNT] = { 0 }; @@ -32,18 +33,23 @@ void warnings_add(struct context *ctx, const char *fmt, ...) warning_index++; } -// TODO: Print somewhere else (e.g. next to line) +static void warnings_generate_name(u32 i) { + static u32 ctr = 0; + snprintf(warnings[i].name, 8, "%d", ctr++); +} + void warnings_print(void) { - gui_unhighlight_name("warning"); + gui_remove_line_marker("error"); for (u32 i = 0; i < WARNING_COUNT; i++) { if (!warnings[i].exists) continue; - /* gui_show_warning(warnings[i].text); */ printf("Line %d:%d: %s\n", warnings[i].ctx.line, warnings[i].ctx.column, warnings[i].text); - gui_highlight(warnings[i].ctx.column, warnings[i].ctx.line, 1, "warning"); + warnings_generate_name(i); + gui_add_line_marker(warnings[i].ctx.line - 1, warnings[i].name, warnings[i].text, "error", + "dialog-warning", (GdkRGBA){ 1, 0, 0, .3 }); } } |