diff options
| author | verdant <im@verdant.ee> | 2026-07-22 16:11:23 +0800 |
|---|---|---|
| committer | verdant <im@verdant.ee> | 2026-07-22 16:11:23 +0800 |
| commit | 102f85eaef4ca23026f94f39854ed59f6db59fad (patch) | |
| tree | 338ef25e1372be77eb722ae61780edee7219ddff | |
| parent | a6d136f0c34f6bb3de6b86ce7fe3ab608bd61283 (diff) | |
| download | sf-102f85eaef4ca23026f94f39854ed59f6db59fad.tar.gz sf-102f85eaef4ca23026f94f39854ed59f6db59fad.zip | |
Reformat fm.c
| -rw-r--r-- | fm.c | 78 |
1 files changed, 40 insertions, 38 deletions
@@ -4,48 +4,50 @@ #include "err.h" #include "wm.h" -static fm_info* fm_w_init(terminal* t) { - fm_info* f = xmalloc(sizeof(fm_info)); - f->fm_l = xmalloc(sizeof(window)); - f->fm_r = xmalloc(sizeof(window)); - int i = wm_fd_w_by_name(t, "stat"); - if (i == -1) { - die("Cannot find window \"stat\""); - } +static fm_info *fm_w_init(terminal *t) +{ + fm_info *f = xmalloc(sizeof(fm_info)); + f->fm_l = xmalloc(sizeof(window)); + f->fm_r = xmalloc(sizeof(window)); + int i = wm_fd_w_by_name(t, "stat"); + if (i == -1) { + die("Cannot find window \"stat\""); + } - int fm_w = t->maxx / 2; - int fm_h = t->maxy - t->windows[i]->height; - int fm_starty = t->windows[i]->height - STAT_BAR_HEIGHT; + int fm_w = t->maxx / 2; + int fm_h = t->maxy - t->windows[i]->height; + int fm_starty = t->windows[i]->height - STAT_BAR_HEIGHT; - int fm_l_startx = 0; - int fm_r_startx = t->maxx / 2; + int fm_l_startx = 0; + int fm_r_startx = t->maxx / 2; - window* fm_l = - wm_create_new_w(t, "fm_l", fm_h, fm_w, fm_starty, fm_l_startx); - window* fm_r = - wm_create_new_w(t, "fm_r", fm_h, fm_w, fm_starty, fm_r_startx); - if (!fm_l || !fm_r) { - die("Cannot create file manager window"); - } - f->fm_l->height = fm_h; - log_write(LOG_INFO, "fm_h = %d", fm_h); - log_write(LOG_INFO, "f->fm_l->height = %d", f->fm_l->height); - f->fm_l->width = fm_w; - f->fm_l->start_y = fm_starty; - f->fm_l->start_x = fm_l_startx; - f->fm_l->win = fm_l->win; + window *fm_l = + wm_create_new_w(t, "fm_l", fm_h, fm_w, fm_starty, fm_l_startx); + window *fm_r = + wm_create_new_w(t, "fm_r", fm_h, fm_w, fm_starty, fm_r_startx); + if (!fm_l || !fm_r) { + die("Cannot create file manager window"); + } + f->fm_l->height = fm_h; + log_write(LOG_INFO, "fm_h = %d", fm_h); + log_write(LOG_INFO, "f->fm_l->height = %d", f->fm_l->height); + f->fm_l->width = fm_w; + f->fm_l->start_y = fm_starty; + f->fm_l->start_x = fm_l_startx; + f->fm_l->win = fm_l->win; - f->fm_r->height = fm_h; - f->fm_r->width = fm_w; - f->fm_r->start_y = fm_starty; - f->fm_r->start_x = fm_r_startx; - f->fm_r->win = fm_r->win; - wborder(f->fm_l->win, ' ', ACS_VLINE, ' ', ' ', ' ', ' ', ' ', ' '); + f->fm_r->height = fm_h; + f->fm_r->width = fm_w; + f->fm_r->start_y = fm_starty; + f->fm_r->start_x = fm_r_startx; + f->fm_r->win = fm_r->win; + wborder(f->fm_l->win, ' ', ACS_VLINE, ' ', ' ', ' ', ' ', ' ', ' '); - return f; + return f; } -void fm_getdir(fm_info* f); -fm_info* fm_init(terminal* t) { - fm_info* f = fm_w_init(t); - return f; +void fm_getdir(fm_info *f); +fm_info *fm_init(terminal *t) +{ + fm_info *f = fm_w_init(t); + return f; } |
