add proper scroll
This commit is contained in:
11
main.c
11
main.c
@@ -159,7 +159,7 @@ void input_string(int terminal_width, int terminal_height, char *buffer, int buf
|
|||||||
|
|
||||||
void display_todos(int width, int height, int current_line) {
|
void display_todos(int width, int height, int current_line) {
|
||||||
int current_y = 1;
|
int current_y = 1;
|
||||||
int current_index = current_line;
|
int current_index = 0;
|
||||||
const char *padding = "...";
|
const char *padding = "...";
|
||||||
unsigned long title_length = 0;
|
unsigned long title_length = 0;
|
||||||
unsigned long padding_length = strlen(padding);
|
unsigned long padding_length = strlen(padding);
|
||||||
@@ -168,9 +168,14 @@ void display_todos(int width, int height, int current_line) {
|
|||||||
|
|
||||||
attron(COLOR_PAIR(DEFAULT_PAIR));
|
attron(COLOR_PAIR(DEFAULT_PAIR));
|
||||||
|
|
||||||
// TODO: Use an offset or something
|
// calculate the offset
|
||||||
|
if (height - 4 <= current_line) {
|
||||||
|
// ignore the first n todos
|
||||||
|
current_index = current_line - (height - 4);
|
||||||
|
}
|
||||||
|
|
||||||
while(current_y < height - 2) {
|
// while we have space to print todos
|
||||||
|
while (current_y < height - 2) {
|
||||||
// check if we're out of bounds
|
// check if we're out of bounds
|
||||||
if (current_index >= arrlen(todos)) {
|
if (current_index >= arrlen(todos)) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user