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 e1f8c029a79012ed1ec7d5272f854118d2e07da0

Fix ruler size not being updated on menu switches
That is on :cnewer and :colder.

How to reproduce:
1. :grep if
2. :find *.cpp
3. :copen
4. :colder
5. G

Update statusbar layout in ui_ruler_set() as well. Also call
update_window_lazy() instead of wnoutrefresh().

tests/commands/history.c is updated because it ends up calling
ui_ruler_set() which now needs cfg.ruler_format to not be NULL.
Author: xaizek
Author date (UTC): 2025-08-19 16:39
Committer name: xaizek
Committer date (UTC): 2025-08-19 16:39
Parent(s): 081580c79b48422d048cce1a17aca07ffe46269e
Signing key: 99DC5E4DB05F6BE2
Tree: 396dc0cd499352303fa923ceee3f70408f9a5ef0
File Lines added Lines deleted
src/ui/ui.c 19 7
tests/commands/history.c 2 0
File src/ui/ui.c changed (mode: 100644) (index 538173942..3e4baafa5)
... ... static WINDOW *lborder;
150 150 static WINDOW *mborder; static WINDOW *mborder;
151 151 static WINDOW *rborder; static WINDOW *rborder;
152 152
153 static void set_ruler_text(const char val[], int lazy_redraw);
153 154 static int init_pair_wrapper(int pair, int fg, int bg); static int init_pair_wrapper(int pair, int fg, int bg);
154 155 static int pair_content_wrapper(int pair, int *fg, int *bg); static int pair_content_wrapper(int pair, int *fg, int *bg);
155 156 static int pair_in_use(int pair); static int pair_in_use(int pair);
 
... ... ui_ruler_update(view_t *view, int lazy_redraw)
219 220 expanded = expand_ruler_macros(view, cfg.ruler_format); expanded = expand_ruler_macros(view, cfg.ruler_format);
220 221 expanded = break_in_two(expanded, getmaxx(ruler_win), "%="); expanded = break_in_two(expanded, getmaxx(ruler_win), "%=");
221 222
222 ui_ruler_set(expanded);
223 if(!lazy_redraw)
224 {
225 ui_refresh_win(ruler_win);
226 }
227
223 set_ruler_text(expanded, lazy_redraw);
228 224 free(expanded); free(expanded);
229 225 } }
230 226
231 227 void void
232 228 ui_ruler_set(const char val[]) ui_ruler_set(const char val[])
229 {
230 update_statusbar_layout();
231 set_ruler_text(val, /*lazy_redraw=*/1);
232 }
233
234 /* Sets text to be displayed on the ruler and updates the ruler on the screen
235 * (possibly lazily). */
236 static void
237 set_ruler_text(const char val[], int lazy_redraw)
233 238 { {
234 239 const int x = getmaxx(ruler_win) - strlen(val); const int x = getmaxx(ruler_win) - strlen(val);
235 240
236 241 werase(ruler_win); werase(ruler_win);
237 242 mvwaddstr(ruler_win, 0, MAX(x, 0), val); mvwaddstr(ruler_win, 0, MAX(x, 0), val);
238 wnoutrefresh(ruler_win);
243 if(lazy_redraw)
244 {
245 update_window_lazy(ruler_win);
246 }
247 else
248 {
249 ui_refresh_win(ruler_win);
250 }
239 251 } }
240 252
241 253 int int
File tests/commands/history.c changed (mode: 100644) (index c4a298820..bd9584e22)
... ... SETUP()
15 15 { {
16 16 modes_init(); modes_init();
17 17 cmds_init(); cmds_init();
18 conf_setup();
18 19
19 20 curr_view = &lwin; curr_view = &lwin;
20 21 view_setup(&lwin); view_setup(&lwin);
 
... ... TEARDOWN()
43 44 vle_keys_reset(); vle_keys_reset();
44 45
45 46 cfg_resize_histories(0); cfg_resize_histories(0);
47 conf_teardown();
46 48 } }
47 49
48 50 TEST(history_symbols) TEST(history_symbols)
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