Skip to content

Commit

Permalink
Fix incorrect filename coloring in tig status
Browse files Browse the repository at this point in the history
Due to the way commit a37ce5c 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().
  • Loading branch information
xaizek committed Apr 7, 2024
1 parent d4a13ff commit 9aa3c6e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions NEWS.adoc
Original file line number Diff line number Diff line change
@@ -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
---------
Expand Down
5 changes: 3 additions & 2 deletions src/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 9aa3c6e

Please sign in to comment.