From 9aa3c6e1b3684e5ef129e9a7ee6d82c23f36b4e7 Mon Sep 17 00:00:00 2001 From: xaizek Date: Sun, 7 Apr 2024 23:58:55 +0300 Subject: [PATCH] Fix incorrect filename coloring in tig status Due to the way commit a37ce5cfe1f256b81092dda365b1d66450e0929e updated src/draw.c:draw_filename() the whole line in `tig status` got colored according to `stat-*` which are supposed to color only status markers. This reverts part of that commit which was done for consistency with the changes made to draw_filesize(). --- NEWS.adoc | 8 ++++++++ src/draw.c | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 0e5000d63..56ed19468 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -1,6 +1,14 @@ Release notes ============= +tig-2.5.10 +---------- + +Bug fixes: + + - Fix `stat-*` coloring file names in `tig status` instead of just + markers (regression in 2.5.9). + tig-2.5.9 --------- diff --git a/src/draw.c b/src/draw.c index c2befa472..7be1522d3 100644 --- a/src/draw.c +++ b/src/draw.c @@ -276,10 +276,11 @@ draw_id(struct view *view, struct view_column *column, const char *id) } static bool -draw_filename(struct view *view, struct view_column *column, enum line_type type, const char *filename) +draw_filename(struct view *view, struct view_column *column, const char *filename, mode_t mode) { size_t width = filename ? utf8_width(filename) : 0; bool trim = width >= column->width; + enum line_type type = S_ISDIR(mode) ? LINE_DIRECTORY : LINE_FILE; int column_width = column->width ? column->width : width; if (column->opt.file_name.display == FILENAME_NO) @@ -528,7 +529,7 @@ view_column_draw(struct view *view, struct line *line, unsigned int lineno) continue; case VIEW_COLUMN_FILE_NAME: - if (draw_filename(view, column, line->type, column_data.file_name)) + if (draw_filename(view, column, column_data.file_name, mode)) return true; continue;