aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bb.c7
-rw-r--r--bterm.h1
2 files changed, 5 insertions, 3 deletions
diff --git a/bb.c b/bb.c
index 262815c..8f27d6c 100644
--- a/bb.c
+++ b/bb.c
@@ -784,7 +784,7 @@ void render(bb_t *bb)
if (!col.name) continue;
const char *title = col.name;
if (!title) title = "";
- move_cursor(tty_out, x, 1);
+ move_cursor_col(tty_out, x);
if (c > 0) {
fputs("┃\033[K", tty_out);
x += 1;
@@ -792,7 +792,7 @@ void render(bb_t *bb)
const char *indicator = " ";
if (bb->columns[c] == bb->sort[1])
indicator = bb->sort[0] == '-' ? RSORT_INDICATOR : SORT_INDICATOR;
- move_cursor(tty_out, x, 1);
+ move_cursor_col(tty_out, x);
fputs(indicator, tty_out);
fputs(title, tty_out);
x += colwidths[c];
@@ -816,10 +816,11 @@ void render(bb_t *bb)
CURSOR_COLOR : color_of(entry->info.st_mode);
fputs(color, tty_out);
int x = 0, y = i - bb->scroll + 2;
+ move_cursor(tty_out, x, y);
for (int c = 0; bb->columns[c]; c++) {
column_t col = columns[(int)bb->columns[c]];
if (!col.name) continue;
- move_cursor(tty_out, x, y);
+ move_cursor_col(tty_out, x);
if (c > 0) { // Separator |
if (i == bb->cursor) fprintf(tty_out, "\033[2m┃\033[22m");
else fprintf(tty_out, "\033[37;2m┃\033[22m%s", color);
diff --git a/bterm.h b/bterm.h
index 79183a1..9ab9b2f 100644
--- a/bterm.h
+++ b/bterm.h
@@ -76,6 +76,7 @@ typedef enum {
#define T_OFF(opt) "\033[?" opt "l"
#define move_cursor(f, x, y) fprintf((f), "\033[%d;%dH", (int)(y)+1, (int)(x)+1)
+#define move_cursor_col(f, x) fprintf((f), "\033[%d`", (int)(x)+1)
typedef struct {
int key;