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 eabffbff89623220a7b079d9e3b88e7de36762f5

Fix Lua column messing up search highlighting
Any Lua column (even one which didn't provide custom matches) used to
effectively disable search highlighting for all columns to its right.
The cause is that `custom_match` wasn't reset and affected the rest of
columns.

Now, resetting it isn't that straightforward: need to take filling into
account.

Because `custom_match` should be 0 by default now, don't set it in
`lua_viewcolumn_handler()` unless necessary. It was probably added as a
workaround for some side-effect of incorrect operation without realizing
it.
Author: xaizek
Author date (UTC): 2026-04-08 08:24
Committer name: xaizek
Committer date (UTC): 2026-04-11 13:28
Parent(s): 5e6bf4d5542955acc60279225b8b489f27a6d86a
Signing key: 99DC5E4DB05F6BE2
Tree: e18c6f8a96193c38503e32f602f3ce5e63dd7e41
File Lines added Lines deleted
ChangeLog 3 0
src/lua/vifm_viewcolumns.c 1 5
src/ui/fileview.c 9 2
File ChangeLog changed (mode: 100644) (index 34ff24a7a..e57b3c633)
232 232
233 233 Fixed completion of :highlight truncating long custom column names. Fixed completion of :highlight truncating long custom column names.
234 234
235 Fixed a Lua column disabling search highlighting for all columns to its
236 right.
237
235 238 0.14-beta to 0.14 (2025-02-08) 0.14-beta to 0.14 (2025-02-08)
236 239
237 240 Improved documentation on zh/zl menu keys a bit. Improved documentation on zh/zl menu keys a bit.
File src/lua/vifm_viewcolumns.c changed (mode: 100644) (index b734d5cb9..1218e59d0)
... ... lua_viewcolumn_handler(void *data, size_t buf_len, char buf[],
223 223 vifmentry_new(lua, entry); vifmentry_new(lua, entry);
224 224 lua_setfield(lua, -2, "entry"); lua_setfield(lua, -2, "entry");
225 225
226 /* No match highlighting by default. */
227 cdt->custom_match = 1;
228 cdt->match_from = 0;
229 cdt->match_to = 0;
230
231 226 const int sm_cookie = vlua_state_safe_mode_on(lua); const int sm_cookie = vlua_state_safe_mode_on(lua);
232 227 if(lua_pcall(lua, 1, 1, 0) != LUA_OK) if(lua_pcall(lua, 1, 1, 0) != LUA_OK)
233 228 { {
 
... ... lua_viewcolumn_handler(void *data, size_t buf_len, char buf[],
269 264
270 265 if(has_start && has_end && start >= 0 && end >= 0 && start <= end) if(has_start && has_end && start >= 0 && end >= 0 && start <= end)
271 266 { {
267 cdt->custom_match = 1;
272 268 cdt->match_from = start; cdt->match_from = start;
273 269 cdt->match_to = end; cdt->match_to = end;
274 270 } }
File src/ui/fileview.c changed (mode: 100644) (index 4f5843967..38f776ead)
... ... column_line_print(const char buf[], int offset, AlignType align,
1176 1176 size_t prefix_len, final_offset; size_t prefix_len, final_offset;
1177 1177 size_t width_left, trim_pos; size_t width_left, trim_pos;
1178 1178
1179 const column_data_t *const cdt = info->data;
1179 column_data_t *const cdt = info->data;
1180 1180 view_t *view = cdt->view; view_t *view = cdt->view;
1181 1181 dir_entry_t *entry = cdt->entry; dir_entry_t *entry = cdt->entry;
1182 1182
 
... ... column_line_print(const char buf[], int offset, AlignType align,
1248 1248 /* Draw match highlighting if there is any. */ /* Draw match highlighting if there is any. */
1249 1249 int match_from = (cdt->custom_match ? cdt->match_from : info->match_from); int match_from = (cdt->custom_match ? cdt->match_from : info->match_from);
1250 1250 int match_to = (cdt->custom_match ? cdt->match_to : info->match_to); int match_to = (cdt->custom_match ? cdt->match_to : info->match_to);
1251 if(match_from != match_to)
1251 if(info->id != FILL_COLUMN_ID && match_from != match_to)
1252 1252 { {
1253 1253 /* Calculate number of screen characters before the match. */ /* Calculate number of screen characters before the match. */
1254 1254 size_t match_start_col = utf8_nstrsw(print_buf, match_from); size_t match_start_col = utf8_nstrsw(print_buf, match_from);
 
... ... column_line_print(const char buf[], int offset, AlignType align,
1261 1261
1262 1262 /* Use a given prefix value at most once. */ /* Use a given prefix value at most once. */
1263 1263 *cdt->prefix_len = 0; *cdt->prefix_len = 0;
1264
1265 if(info->id != FILL_COLUMN_ID)
1266 {
1267 /* Any match for this column has already been consumed, so reset it in
1268 * preparation of processing the next column. */
1269 cdt->custom_match = 0;
1270 }
1264 1271 } }
1265 1272
1266 1273 /* Draws current line number at specified column. */ /* Draws current line number at specified column. */
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