home, end, pgup and pgdown keys now work correctly

master
Alessandro Mauri 4 years ago
parent b0a5fb35e9
commit 3a56ea3fc1
  1. BIN
      .sconsign.dblite
  2. 1
      src/config.h
  3. 15
      src/ste.c
  4. BIN
      src/ste.o

Binary file not shown.

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

@ -178,11 +178,19 @@ int main (int argc, char *argv[])
break;
case (KEY_END):
t.cur.y = rows.rownum - 1;
t.cur.x = rows.rw[t.cur.y].size;
break;
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;
case (CTRL('f')):
@ -489,7 +497,8 @@ void curUpdateRender ()
*/
/* 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.y >= t.cur.off_y && t.cur.y < t.cur.off_y + t.dim.y) {

Binary file not shown.
Loading…
Cancel
Save