mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:37:36 +00:00
Utilities: Allow 'less' to scroll to top/bottom using 'G' and 'g'
This commit is contained in:
parent
751cb094ff
commit
c4887882cc
1 changed files with 16 additions and 0 deletions
|
@ -151,6 +151,18 @@ public:
|
||||||
fflush(m_tty);
|
fflush(m_tty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void top()
|
||||||
|
{
|
||||||
|
up_n(m_line);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bottom()
|
||||||
|
{
|
||||||
|
while (read_line())
|
||||||
|
;
|
||||||
|
down_n(m_lines.size() - m_line);
|
||||||
|
}
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
while (m_lines.size() < m_height) {
|
while (m_lines.size() < m_height) {
|
||||||
|
@ -369,6 +381,10 @@ int main(int argc, char** argv)
|
||||||
} else if (sequence == "k" || sequence == "\e[A") {
|
} else if (sequence == "k" || sequence == "\e[A") {
|
||||||
if (!emulate_more)
|
if (!emulate_more)
|
||||||
pager.up();
|
pager.up();
|
||||||
|
} else if (sequence == "g") {
|
||||||
|
pager.top();
|
||||||
|
} else if (sequence == "G") {
|
||||||
|
pager.bottom();
|
||||||
} else if (sequence == " " || sequence == "\e[6~") {
|
} else if (sequence == " " || sequence == "\e[6~") {
|
||||||
pager.down_page();
|
pager.down_page();
|
||||||
} else if (sequence == "\e[5~") {
|
} else if (sequence == "\e[5~") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue