home, end, pgup and pgdown keys now work correctly

This commit is contained in:
Alessandro Mauri 2019-12-05 17:44:59 +01:00
parent b0a5fb35e9
commit 3a56ea3fc1
4 changed files with 13 additions and 3 deletions

Binary file not shown.

View File

@ -3,5 +3,6 @@
#define TABSIZE 4 // Tab size as used in render #define TABSIZE 4 // Tab size as used in render
#define MAX_LINE 1024 // maximum line length on screen #define MAX_LINE 1024 // maximum line length on screen
#define PGK_DELTA 15
#endif #endif

View File

@ -178,11 +178,19 @@ int main (int argc, char *argv[])
break; break;
case (KEY_END): case (KEY_END):
t.cur.y = rows.rownum - 1; t.cur.x = rows.rw[t.cur.y].size;
break; break;
case (KEY_HOME): case (KEY_HOME):
t.cur.y = 0; t.cur.x = 0;
break;
case (KEY_NPAGE):
t.cur.y += PGK_DELTA;
break;
case (KEY_PPAGE):
t.cur.y -= PGK_DELTA;
break; break;
case (CTRL('f')): case (CTRL('f')):
@ -489,7 +497,8 @@ void curUpdateRender ()
*/ */
/* Adjust x and y if they are out of bounds */ /* Adjust x and y if they are out of bounds */
if (t.cur.y < 0 || t.cur.y >= rows.rownum) t.cur.y = 0; if (t.cur.y < 0) t.cur.y = 0;
if (t.cur.y >= rows.rownum) t.cur.y = rows.rownum - 1;
if (t.cur.x < 0) t.cur.x = 0; if (t.cur.x < 0) t.cur.x = 0;
if (t.cur.y >= t.cur.off_y && t.cur.y < t.cur.off_y + t.dim.y) { if (t.cur.y >= t.cur.off_y && t.cur.y < t.cur.off_y + t.dim.y) {

BIN
src/ste.o

Binary file not shown.