Fix Top and Bot detection

This commit is contained in:
Night Kaly 2024-11-12 12:41:09 +00:00
parent ef4e93abb9
commit e90877d2ac
Signed by: night0721
SSH key fingerprint: SHA256:B/hgVwUoBpx5vdNsXl9w8XwZljA9766uk6T4ubZp5HM

4
vip.c
View file

@ -93,8 +93,8 @@ void draw_status_bar(void)
strlen(cur_editor->filename) > 0 ? cur_editor->filename : "[No Name]", cur_editor->dirty ? "[+]" : "");
int info_len = snprintf(info, sizeof(info), " %s ", cur_editor->syntax ? cur_editor->syntax->filetype : "");
int lines_len;
if (cur_editor->rows == 0 || cur_editor->rows == cur_editor->y + 1) {
lines_len = snprintf(lines, sizeof(lines), " %s ", cur_editor->rows == 0 ? "Top" : "Bot");
if (cur_editor->y == 0 || cur_editor->rows == cur_editor->y + 1) {
lines_len = snprintf(lines, sizeof(lines), " %s ", cur_editor->y == 0 ? "Top" : "Bot");
} else {
lines_len = snprintf(lines, sizeof(lines), " %d%% ", ((cur_editor->y + 1) * 100 / cur_editor->rows));
}