From a0af514581bd7b5559b0cabd44de770ed37f4d7e Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 27 Mar 2024 16:23:38 +0100 Subject: [PATCH] context: make error line debug a little better Make a line to the ^ so that it is more visible. Spell out column completely. Make the sizes a little smaller to avoid awkward gaps. --- spa/include/spa/debug/context.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spa/include/spa/debug/context.h b/spa/include/spa/debug/context.h index 74266a90a..4f881a415 100644 --- a/spa/include/spa/debug/context.h +++ b/spa/include/spa/debug/context.h @@ -35,7 +35,7 @@ struct spa_debug_context { static inline void spa_debugc_error_location(struct spa_debug_context *c, struct spa_error_location *loc) { - int i, skip = loc->col > 80 ? loc->col - 40 : 0; + int i, skip = loc->col > 80 ? loc->col - 40 : 0, lc = loc->col-skip-1; char buf[80]; for (i = 0; (size_t)i < sizeof(buf)-1; i++) { @@ -45,10 +45,10 @@ static inline void spa_debugc_error_location(struct spa_debug_context *c, buf[i] = isspace(ch) ? ' ' : ch; } buf[i] = '\0'; - spa_debugc(c, "line: %6d | %s%s", loc->line, skip ? "..." : "", buf); + spa_debugc(c, "line:%6d | %s%s", loc->line, skip ? "..." : "", buf); for (i = 0; buf[i]; i++) - buf[i] = i+skip+1 == loc->col ? '^' : ' '; - spa_debugc(c, "col: %6d | %s%s", loc->col, skip ? " " : "", buf); + buf[i] = i < lc ? '-' : i == lc ? '^' : ' '; + spa_debugc(c, "column:%4d |-%s%s", loc->col, skip ? "---" : "", buf); } /**