frontend: fix all compiler warnings
This commit is contained in:
@@ -14,12 +14,12 @@
|
||||
* the (x, y) coordinates provided should be the data coordinates of the
|
||||
* first character in `s`.
|
||||
*/
|
||||
void print_text(struct line_ed *ed, unsigned int x, unsigned int y, const char *s)
|
||||
void print_text(struct line_ed *ed, size_t x, size_t y, const char *s)
|
||||
{
|
||||
b_tty *tty = ed->l_tty;
|
||||
struct hl_range *cur_range = get_hl_range(ed, x, y);
|
||||
|
||||
for (unsigned int i = 0; s[i] != '\n' && s[i] != '\0'; i++) {
|
||||
for (size_t i = 0; s[i] != '\n' && s[i] != '\0'; i++) {
|
||||
if (!cur_range) {
|
||||
b_tty_reset_vmode(tty);
|
||||
fputc(s[i], stdout);
|
||||
@@ -96,18 +96,18 @@ void put_refresh(struct line_ed *ed, struct refresh_state *state)
|
||||
size_t line_len = strcspn(line_buf, "\n");
|
||||
|
||||
/* the index of the first char in line_buf that needs to be reprinted */
|
||||
int start_x = state->r_prev_cursor_x;
|
||||
size_t start_x = state->r_prev_cursor_x;
|
||||
|
||||
/* the distance between the first char to be reprinted and the end
|
||||
* of the line.
|
||||
* the physical cursor will be moved back by this amount after the
|
||||
* line is reprinted. */
|
||||
int cursor_rdelta = (int)(line_len - start_x);
|
||||
long cursor_rdelta = (long)(line_len - start_x);
|
||||
|
||||
if (ed->l_flags & LINE_ED_FULL_REPRINT) {
|
||||
if (start_x) {
|
||||
//fprintf(stdout, "\033[%uD", start_x);
|
||||
b_tty_move_cursor_x(ed->l_tty, B_TTY_POS_CURSOR, -start_x);
|
||||
b_tty_move_cursor_x(ed->l_tty, B_TTY_POS_CURSOR, -(long long)start_x);
|
||||
}
|
||||
|
||||
start_x = 0;
|
||||
@@ -148,14 +148,14 @@ void backspace_nl_refresh(struct line_ed *ed, struct refresh_state *state)
|
||||
|
||||
/* the index of the first char in line_buf that needs to be reprinted.
|
||||
* subtract one to account for the linefeed that has since been deleted. */
|
||||
unsigned int start_x = state->r_prev_line_len - 1;
|
||||
size_t start_x = state->r_prev_line_len - 1;
|
||||
|
||||
/* the column to move the physical cursor to after it has been moved
|
||||
* to the previous line.
|
||||
* NOTE that this number includes the length of the prompt!
|
||||
* we add 1 to start_x to ensure that the cursor is moved to the cell
|
||||
* AFTER the last char of the line. */
|
||||
unsigned int new_x;
|
||||
size_t new_x;
|
||||
line_ed_coords_to_physical_coords(ed, start_x + 1, ed->l_cursor_y, &new_x, NULL);
|
||||
|
||||
/* the physical cursor is currently at the beginning of the line that
|
||||
@@ -166,7 +166,7 @@ void backspace_nl_refresh(struct line_ed *ed, struct refresh_state *state)
|
||||
|
||||
if (ed->l_flags & LINE_ED_FULL_REPRINT) {
|
||||
/* next, move the physical cursor up and to the beginning of the previous line */
|
||||
unsigned int tmp_x;
|
||||
size_t tmp_x;
|
||||
line_ed_coords_to_physical_coords(ed, 0, ed->l_cursor_y, &tmp_x, NULL);
|
||||
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, tmp_x);
|
||||
@@ -181,7 +181,7 @@ void backspace_nl_refresh(struct line_ed *ed, struct refresh_state *state)
|
||||
|
||||
/* now reprint all of the buffer lines, starting with the first of the
|
||||
* two lines that were concatenated. */
|
||||
unsigned int ydiff = 0;
|
||||
size_t ydiff = 0;
|
||||
while (1) {
|
||||
print_text(ed, start_x, ed->l_cursor_y + ydiff, line_buf + start_x);
|
||||
|
||||
@@ -220,19 +220,19 @@ void backspace_simple_refresh(struct line_ed *ed, struct refresh_state *state)
|
||||
size_t line_len = strcspn(line_buf, "\n");
|
||||
|
||||
/* the index of the first char in line_buf that needs to be reprinted */
|
||||
int start_x = ed->l_cursor_x;
|
||||
size_t start_x = ed->l_cursor_x;
|
||||
//get_data_cursor_position(ed, &start_x, NULL);
|
||||
|
||||
/* the distance between the first char to be reprinted and the end
|
||||
* of the line.
|
||||
* the physical cursor will be moved back by this amount after the
|
||||
* line is reprinted. */
|
||||
int cursor_rdelta = (int)(line_len - start_x);
|
||||
long long cursor_rdelta = (long long)(line_len - start_x);
|
||||
|
||||
if (ed->l_flags & LINE_ED_FULL_REPRINT) {
|
||||
if (start_x) {
|
||||
//fprintf(stdout, "\033[%uD", start_x);
|
||||
b_tty_move_cursor_x(ed->l_tty, B_TTY_POS_CURSOR, -start_x);
|
||||
b_tty_move_cursor_x(ed->l_tty, B_TTY_POS_CURSOR, -(long long)start_x);
|
||||
}
|
||||
|
||||
start_x = 0;
|
||||
|
||||
Reference in New Issue
Block a user