diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2020-02-18 23:20:57 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2020-02-18 23:20:57 -0800 |
| commit | d7e6159eb855578142b19d4becadadc5c55e32ca (patch) | |
| tree | 57d18bc7a74ee04f14bbb661e92f4eb0c6f88698 /bb.c | |
| parent | 2767e33ab782edfab8bf6dcde36c28bca9b76f87 (diff) | |
Bugfix for cursor position not being remembered correctly.
Diffstat (limited to 'bb.c')
| -rw-r--r-- | bb.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -397,6 +397,7 @@ int populate_files(bb_t *bb, const char *path) { int samedir = path && strcmp(bb->path, path) == 0; int old_scroll = bb->scroll; + int old_cursor = bb->cursor; char old_selected[PATH_MAX] = ""; if (samedir && bb->nfiles > 0) strcpy(old_selected, bb->files[bb->cursor]->fullname); @@ -491,6 +492,7 @@ int populate_files(bb_t *bb, const char *path) sort_files(bb); if (samedir) { set_scroll(bb, old_scroll); + bb->cursor = old_cursor > bb->nfiles-1 ? bb->nfiles-1 : old_cursor; if (old_selected[0]) { entry_t *e = load_entry(bb, old_selected); if (e) set_cursor(bb, e->index); @@ -827,8 +829,8 @@ void render(bb_t *bb) for (int col = 0; bb->columns[col]; col++) { fprintf(tty_out, "\033[%d;%dH\033[K", y+1, x+1); if (col > 0) { - if (i == bb->cursor) fputs("│", tty_out); - else fputs("\033[37;2m│\033[22m", tty_out); + if (i == bb->cursor) fputs("┃", tty_out); + else fputs("\033[37;2m┃\033[22m", tty_out); fputs(i == bb->cursor ? CURSOR_COLOR : "\033[0m", tty_out); x += 1; } |
