Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'less' Text Pagination Functionality to Dynamically View Parts of Large Text #1115

Open
wants to merge 56 commits into
base: theseus_main
Choose a base branch
from

Conversation

nnh12
Copy link
Contributor

@nnh12 nnh12 commented Dec 5, 2024

This PR restores the less functionality. This displays a small section of text at a time to make viewing large files easier and interactively via the Up and Down key.

Note: Previous implementation relied on app_io to grab a reference to the current terminal and keyboard. However, app_io::get_my_terminal() and app_io::take_key_event_queue() can no longer be supported or re-added due to code structuring. This is why I added the code to the shell application, which already has access to the current terminal and keyboard.

Use the Up and Down key to scroll through text and Q key to quit less mode. Below are some test cases. I added opning_crawl_all.txt for a large file for test.

/extra_files/test_files/text/ : less opening_crawl_all.txt

(Used Down arrow key to scroll through rest of text).

It is a period of civil war.
Rebel spaceships, striking
from a hidden base, have won
their first victory against
the evil Galactic Empire.

During the battle, Rebel
spies managed to steal secret
plans to the Empire's
ultimate weapon, the DEATH
STAR, an armored space
station with enough power to
destroy an entire planet.
...
...
Rebel spaceships, striking
from a hidden base, have won
their first victory against
the evil Galactic Empire.

During the battle, Rebel
spies managed to steal secret
plans to the Empire's
ultimate weapon, the DEATH
STAR, an armored space
station with enough power to
destroy an entire planet.

...
...
from a hidden base, have won
their first victory against
the evil Galactic Empire.

During the battle, Rebel
spies managed to steal secret
plans to the Empire's
ultimate weapon, the DEATH
STAR, an armored space
station with enough power to
destroy an entire planet.

Pursued by the Empire's
...
...

(Using Up key to scroll up).

Rebel spaceships, striking
from a hidden base, have won
their first victory against
the evil Galactic Empire.

During the battle, Rebel
spies managed to steal secret
plans to the Empire's
ultimate weapon, the DEATH
STAR, an armored space
station with enough power to
destroy an entire planet.

...
...

Nathan Hsiao and others added 30 commits November 22, 2024 16:23
@nnh12 nnh12 marked this pull request as ready for review December 6, 2024 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant