xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit d9a31d8c032c4a5c8b46b846d5441b0851d67c79

Slightly optimize column_line_print()
Avoid checking that the column is primary twice as it can involve look
ups of Lua data. This function is called a lot, so no need to do extra
work that's easy to avoid.
Author: xaizek
Author date (UTC): 2026-06-07 14:19
Committer name: xaizek
Committer date (UTC): 2026-06-07 22:11
Parent(s): 91b89ef5a33bcec8ccada166796921b6a2cba8b4
Signing key: 99DC5E4DB05F6BE2
Tree: 9487906f0364ca9a4beae3a070090af643e23f9a
File Lines added Lines deleted
src/ui/fileview.c 9 13
File src/ui/fileview.c changed (mode: 100644) (index c88d33731..6c941d322)
... ... static void column_line_print(const char buf[], int offset, AlignType align,
123 123 static void column_line_match(const char full_column[], static void column_line_match(const char full_column[],
124 124 const format_info_t *info, int *match_from, int *match_to); const format_info_t *info, int *match_from, int *match_to);
125 125 static void draw_line_number(const column_data_t *cdt, int column); static void draw_line_number(const column_data_t *cdt, int column);
126 static int is_primary_colored_column_id(int id);
127 126 static int is_primary_column_id(int id); static int is_primary_column_id(int id);
128 127 static cchar_t prepare_col_color(const view_t *view, int is_primary_colored, static cchar_t prepare_col_color(const view_t *view, int is_primary_colored,
129 128 int line_nr, const column_data_t *cdt, int real_id, int filling); int line_nr, const column_data_t *cdt, int real_id, int filling);
 
... ... column_line_print(const char buf[], int offset, AlignType align,
1184 1183 const int padding = (cfg.extra_padding != 0); const int padding = (cfg.extra_padding != 0);
1185 1184 const int filling = (info->id == FILL_COLUMN_ID); const int filling = (info->id == FILL_COLUMN_ID);
1186 1185
1187 const int is_primary_colored = is_primary_colored_column_id(info->id);
1186 const int is_primary_column = is_primary_column_id(info->id);
1187 /* Only primary columns can have tree pseudo-graphics. */
1188 const int is_treeable_column = is_primary_column;
1189 /* Primary and extension columns are affected by highlighting derived from
1190 * file's type, path or name. */
1191 const int is_primary_colored = info->id == SK_BY_EXTENSION
1192 || info->id == SK_BY_FILEEXT
1193 || is_primary_column;
1194
1188 1195 const cchar_t line_attrs = const cchar_t line_attrs =
1189 1196 prepare_col_color(view, is_primary_colored, 0, cdt, info->real_id, filling); prepare_col_color(view, is_primary_colored, 0, cdt, info->real_id, filling);
1190 1197
1191 1198 /* Non-empty prefix contains tree pseudo-graphics. */ /* Non-empty prefix contains tree pseudo-graphics. */
1192 const int is_treeable_column = is_primary_column_id(info->id);
1193 1199 size_t extra_prefix = is_treeable_column ? *cdt->prefix_len : 0U; size_t extra_prefix = is_treeable_column ? *cdt->prefix_len : 0U;
1194 1200
1195 1201 if(extra_prefix != 0U && align == AT_RIGHT) if(extra_prefix != 0U && align == AT_RIGHT)
 
... ... column_line_match(const char full_column[], const format_info_t *info,
1345 1351 } }
1346 1352 } }
1347 1353
1348 /* Checks whether column id corresponds to a column that is affected by a
1349 * highlight derived from file's type/path/name. Returns non-zero if so. */
1350 static int
1351 is_primary_colored_column_id(int id)
1352 {
1353 return id == SK_BY_EXTENSION
1354 || id == SK_BY_FILEEXT
1355 || is_primary_column_id(id);
1356 }
1357
1358 1354 /* Checks whether column id corresponds to a column that displays a substantial /* Checks whether column id corresponds to a column that displays a substantial
1359 1355 * part of entry's path. Such columns can be searched and also display * part of entry's path. Such columns can be searched and also display
1360 1356 * pseudographics of a tree. Returns non-zero if so. */ * pseudographics of a tree. Returns non-zero if so. */
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master