1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

Utilities: Allow 'less' to scroll to top/bottom using 'G' and 'g'

This commit is contained in:
Lennon Donaghy 2021-07-27 06:35:07 +01:00 committed by Andreas Kling
parent 751cb094ff
commit c4887882cc

View file

@ -151,6 +151,18 @@ public:
fflush(m_tty);
}
void top()
{
up_n(m_line);
}
void bottom()
{
while (read_line())
;
down_n(m_lines.size() - m_line);
}
void init()
{
while (m_lines.size() < m_height) {
@ -369,6 +381,10 @@ int main(int argc, char** argv)
} else if (sequence == "k" || sequence == "\e[A") {
if (!emulate_more)
pager.up();
} else if (sequence == "g") {
pager.top();
} else if (sequence == "G") {
pager.bottom();
} else if (sequence == " " || sequence == "\e[6~") {
pager.down_page();
} else if (sequence == "\e[5~") {