frontend: fix all compiler warnings

This commit is contained in:
2024-12-13 17:20:45 +00:00
parent 97aaffd166
commit b3a9943fe5
14 changed files with 68 additions and 72 deletions

View File

@@ -19,10 +19,10 @@ void put_char(struct line_ed *ed, char c)
.r_prev_cursor_y = ed->l_cursor_y,
};
unsigned int prev_cursor = ed->l_buf_ptr - ed->l_buf;
size_t prev_cursor = ed->l_buf_ptr - ed->l_buf;
char *dest = ed->l_buf_ptr;
unsigned int len = ed->l_line_end - ed->l_buf_ptr + 1;
size_t len = ed->l_line_end - ed->l_buf_ptr + 1;
if (dest < ed->l_line_end) {
memmove(dest + 1, dest, len);
@@ -53,10 +53,10 @@ static void backspace_simple(struct line_ed *ed)
.r_prev_cursor_y = ed->l_cursor_y,
};
unsigned int prev_cursor = ed->l_buf_ptr - ed->l_buf;
size_t prev_cursor = ed->l_buf_ptr - ed->l_buf;
char *dest = ed->l_buf_ptr;
unsigned int len = ed->l_line_end - ed->l_buf_ptr + 1;
size_t len = ed->l_line_end - ed->l_buf_ptr + 1;
memmove(dest - 1, dest, len);
ed->l_cursor_x--;
@@ -70,7 +70,7 @@ static void backspace_simple(struct line_ed *ed)
static void backspace_nl(struct line_ed *ed)
{
unsigned int prev_line_len = line_length(ed, ed->l_cursor_y - 1);
size_t prev_line_len = line_length(ed, ed->l_cursor_y - 1);
struct refresh_state state = {
.r_prev_cursor_x = ed->l_cursor_x,
@@ -79,7 +79,7 @@ static void backspace_nl(struct line_ed *ed)
};
char *dest = ed->l_buf_ptr;
unsigned int len = ed->l_line_end - ed->l_buf_ptr + 1;
size_t len = ed->l_line_end - ed->l_buf_ptr + 1;
memmove(dest - 1, dest, len);
ed->l_cursor_x = prev_line_len - 1;
@@ -126,17 +126,17 @@ void cursor_left(struct line_ed *ed)
ed->l_cursor_y--;
ed->l_buf_ptr--;
unsigned int prompt_len = 0;
size_t prompt_len = 0;
if (ed->l_cursor_y == 0) {
prompt_len = prompt_length(ed, PROMPT_MAIN);
}
unsigned int len = line_length(ed, ed->l_cursor_y);
size_t len = line_length(ed, ed->l_cursor_y);
ed->l_cursor_x = len - 1;
//printf("\033[A\033[%dG", len + prompt_len);
b_tty_move_cursor_y(ed->l_tty, B_TTY_POS_CURSOR, -1);
b_tty_move_cursor_x(ed->l_tty, B_TTY_POS_START, len + prompt_len);
b_tty_move_cursor_x(ed->l_tty, B_TTY_POS_START, (int)(len + prompt_len));
fflush(stdout);
}
@@ -178,12 +178,12 @@ void arrow_up(struct line_ed *ed)
if (ed->l_cursor_y > 0) {
//printf("\033[%uA", ed->l_cursor_y);
b_tty_move_cursor_y(ed->l_tty, B_TTY_POS_CURSOR, ed->l_cursor_y);
b_tty_move_cursor_y(ed->l_tty, B_TTY_POS_CURSOR, (long long)ed->l_cursor_y);
}
//printf("\033[%zuG\033[J", prompt_length(ed, PROMPT_MAIN) + 1);
b_tty_move_cursor_x(
ed->l_tty, B_TTY_POS_START, prompt_length(ed, PROMPT_MAIN));
ed->l_tty, B_TTY_POS_START, (long long)prompt_length(ed, PROMPT_MAIN));
b_tty_clear(ed->l_tty, B_TTY_CLEAR_SCREEN | B_TTY_CLEAR_FROM_CURSOR);
save_buf_to_history(ed);
@@ -202,7 +202,7 @@ void arrow_down(struct line_ed *ed)
if (ed->l_cursor_y > 0) {
//printf("\033[%uA", ed->l_cursor_y);
b_tty_move_cursor_y(ed->l_tty, B_TTY_POS_CURSOR, ed->l_cursor_y);
b_tty_move_cursor_y(ed->l_tty, B_TTY_POS_CURSOR, (int)ed->l_cursor_y);
}
//printf("\033[%zuG\033[J", prompt_length(ed, PROMPT_MAIN) + 1);