add page up/down and home/end support to less

This commit is contained in:
Lisa Milne 2023-11-21 13:48:52 +10:00
parent af70e329da
commit e8ef43130a

View file

@ -388,6 +388,30 @@ Options:
showAt(topLine);
}
break;
case 'PageUp':
if (topLine > 0) {
topLine -= tty.lines-1;
if (topLine < 0)
topLine = 0;
showAt(topLine);
}
break;
case 'PageDown':
if (topLine < bottomLine) {
topLine += tty.lines-1;
if (topLine >= bottomLine)
topLine = bottomLine;
showAt(topLine);
}
break;
case 'Home':
topLine = 0;
showAt(topLine);
break;
case 'End':
topLine = bottomLine;
showAt(topLine);
break;
}
});
tty.draw('Loading...');