commit b2cd5e069649931daeb8619734b6e8c8dc697819 from: Omar Polo date: Sat Mar 06 16:11:39 2021 UTC implement & fix cursor-related functions commit - 1d08c280e4fb59f78de88a09aa7932e3013e1ce7 commit + b2cd5e069649931daeb8619734b6e8c8dc697819 blob - a32b231dcdacc9ff63d4d65cc5b19decb370585f blob + d3d55e98117cd34b9eadb7368ffa5eddd0d89571 --- ui.c +++ ui.c @@ -179,18 +179,28 @@ cmd_next_line(int k) struct tab *tab; tab = current_tab(); - tab->s->curs_y = MIN(LINES, tab->s->curs_y-1); + tab->s->curs_y = MIN(LINES-1, tab->s->curs_y+1); move(tab->s->curs_y, tab->s->curs_x); } static void cmd_forward_char(int k) { + struct tab *tab; + + tab = current_tab(); + tab->s->curs_x = MIN(COLS-1, tab->s->curs_x+1); + move(tab->s->curs_y, tab->s->curs_x); } static void cmd_backward_char(int k) { + struct tab *tab; + + tab = current_tab(); + tab->s->curs_x = MAX(0, tab->s->curs_x-1); + move(tab->s->curs_y, tab->s->curs_x); } static void