edit bar to look like catpuccin

This commit is contained in:
Night Kaly 2024-07-01 02:48:04 +01:00
parent 171a43d2ac
commit 23f1a2ab8a
Signed by: night0721
GPG key ID: 957D67B8DB7A119B

32
bar.c
View file

@ -10,20 +10,34 @@ extern editor vip;
void draw_status_bar(struct abuf *ab) void draw_status_bar(struct abuf *ab)
{ {
abAppend(ab, "\x1b[7m", 4); abAppend(ab, "\x1b[7m", 4);
char status[80], rstatus[80]; abAppend(ab, "\x1b[1m", 4);
int len = snprintf(status, sizeof(status), "NORMAL | %.20s", abAppend(ab, "\x1b[38;2;137;180;250m", 19);
char mode[9] = " NORMAL ";
int mode_len = 8;
abAppend(ab, mode, 8);
char file[80], lines[80];
int file_len = snprintf(file, sizeof(file), " %.20s ",
vip.filename ? vip.filename : "[No Name]"); vip.filename ? vip.filename : "[No Name]");
int rlen = snprintf(rstatus, sizeof(rstatus), "%dL | %d:%d", vip.rows, int lines_len = snprintf(lines, sizeof(lines), "%dL | %d:%d", vip.rows,
vip.cy + 1, vip.rx + 1); vip.cy + 1, vip.rx + 1);
if (len > vip.screencols) len = vip.screencols;
abAppend(ab, status, len); abAppend(ab, "\x1b[38;2;49;50;68m", 16);
while (len < vip.screencols) { abAppend(ab, "\x1b[22m", 5);
if (vip.screencols - len == rlen) { abAppend(ab, "\x1b[48;2;137;180;250m", 19);
abAppend(ab, rstatus, rlen); abAppend(ab, file, file_len);
abAppend(ab, "\x1b[38;2;0;0;0m", 13);
while (file_len < vip.screencols) {
if (vip.screencols - mode_len - file_len == lines_len) {
abAppend(ab, "\x1b[48;2;255;255;255m", 19);
abAppend(ab, lines, lines_len);
break; break;
} else { } else {
abAppend(ab, " ", 1); abAppend(ab, " ", 1);
len++; file_len++;
} }
} }
abAppend(ab, "\x1b[m", 3); abAppend(ab, "\x1b[m", 3);