From 7aad838572248df2902c172b7448bc033ce01964 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Wed, 2 Sep 2026 12:55:12 +0200 Subject: config: remove support for the deprecated colors and colors2 sections They were deprecated in 1.26.0, and replaced by colors-dark and colors-light. --- CHANGELOG.md | 5 ++++ config.c | 72 ++--------------------------------------------------- tests/test-config.c | 4 +-- 3 files changed, 9 insertions(+), 72 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae474f3c..c41c59b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -108,6 +108,11 @@ ### Deprecated ### Removed + +* `[colors]` and `[colors2]` config sections. These were deprecated in + 1.26.0, and were replaced by `[colors-dark]` and `[colors-light]`. + + ### Fixed * Out-of-bounds read when parsing URIs with malformed %-encoded diff --git a/config.c b/config.c index da4d764e..e216f0d2 100644 --- a/config.c +++ b/config.c @@ -1178,40 +1178,8 @@ parse_section_main(struct context *ctx) sizeof(conf->initial_color_theme) == sizeof(int), "enum is not 32-bit"); - if (!value_to_enum(ctx, (const char*[]){ - "dark", "light", "1", "2", NULL}, - (int *)&conf->initial_color_theme)) - return false; - - if (streq(ctx->value, "1")) { - LOG_WARN("%s:%d: [main].initial-color-theme=1 deprecated, " - "use [main].initial-color-theme=dark instead", - ctx->path, ctx->lineno); - - user_notification_add( - &ctx->conf->notifications, - USER_NOTIFICATION_DEPRECATED, - xstrdup("[main].initial-color-theme=1: " - "use [main].initial-color-theme=dark instead")); - - conf->initial_color_theme = COLOR_THEME_DARK; - } - - else if (streq(ctx->value, "2")) { - LOG_WARN("%s:%d: [main].initial-color-theme=2 deprecated, " - "use [main].initial-color-theme=light instead", - ctx->path, ctx->lineno); - - user_notification_add( - &ctx->conf->notifications, - USER_NOTIFICATION_DEPRECATED, - xstrdup("[main].initial-color-theme=2: " - "use [main].initial-color-theme=light instead")); - - conf->initial_color_theme = COLOR_THEME_LIGHT; - } - - return true; + return value_to_enum(ctx, (const char*[]){ + "dark", "light", NULL}, (int *)&conf->initial_color_theme); } else if (streq(key, "uppercase-regex-insert")) @@ -1670,34 +1638,6 @@ parse_section_colors_light(struct context *ctx) return parse_color_theme(ctx, &ctx->conf->colors_light); } -static bool -parse_section_colors(struct context *ctx) -{ - LOG_WARN("%s:%d: [colors]: deprecated; use [colors-dark] instead", - ctx->path, ctx->lineno); - - user_notification_add( - &ctx->conf->notifications, - USER_NOTIFICATION_DEPRECATED, - xstrdup("[colors]: use [colors-dark] instead")); - - return parse_color_theme(ctx, &ctx->conf->colors_dark); -} - -static bool -parse_section_colors2(struct context *ctx) -{ - LOG_WARN("%s:%d: [colors2]: deprecated; use [colors-light] instead", - ctx->path, ctx->lineno); - - user_notification_add( - &ctx->conf->notifications, - USER_NOTIFICATION_DEPRECATED, - xstrdup("[colors2]: use [colors-light] instead")); - - return parse_color_theme(ctx, &ctx->conf->colors_light); -} - static bool parse_section_cursor(struct context *ctx) { @@ -3193,10 +3133,6 @@ enum section { SECTION_TWEAK, SECTION_TOUCH, - /* Deprecated */ - SECTION_COLORS, - SECTION_COLORS2, - SECTION_COUNT, }; @@ -3228,10 +3164,6 @@ static const struct { [SECTION_ENVIRONMENT] = {&parse_section_environment, "environment"}, [SECTION_TWEAK] = {&parse_section_tweak, "tweak"}, [SECTION_TOUCH] = {&parse_section_touch, "touch"}, - - /* Deprecated */ - [SECTION_COLORS] = {&parse_section_colors, "colors"}, - [SECTION_COLORS2] = {&parse_section_colors2, "colors2"}, }; static_assert(ALEN(section_info) == SECTION_COUNT, "section info array size mismatch"); diff --git a/tests/test-config.c b/tests/test-config.c index 16cfb2b0..4fff7f0c 100644 --- a/tests/test-config.c +++ b/tests/test-config.c @@ -713,7 +713,7 @@ test_section_colors_dark(void) struct context ctx = { .conf = &conf, .section = "colors-dark", .path = "unittest"}; - test_invalid_key(&ctx, &parse_section_colors, "invalid-key"); + test_invalid_key(&ctx, &parse_section_colors_dark, "invalid-key"); test_color(&ctx, &parse_section_colors_dark, "foreground", false, &conf.colors_dark.fg); test_color(&ctx, &parse_section_colors_dark, "background", false, &conf.colors_dark.bg); @@ -794,7 +794,7 @@ test_section_colors_light(void) struct context ctx = { .conf = &conf, .section = "colors-light", .path = "unittest"}; - test_invalid_key(&ctx, &parse_section_colors, "invalid-key"); + test_invalid_key(&ctx, &parse_section_colors_light, "invalid-key"); test_color(&ctx, &parse_section_colors_light, "foreground", false, &conf.colors_light.fg); test_color(&ctx, &parse_section_colors_light, "background", false, &conf.colors_light.bg); -- cgit v1.3