{"id":34718031,"url":"https://github.com/ilkutkutlar/terminal-scroll-area","last_synced_at":"2026-04-21T00:33:20.129Z","repository":{"id":59157528,"uuid":"269209946","full_name":"ilkutkutlar/terminal-scroll-area","owner":"ilkutkutlar","description":"Scroll area to display large text on terminal","archived":false,"fork":false,"pushed_at":"2020-09-17T21:00:20.000Z","size":494,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-05T13:02:43.601Z","etag":null,"topics":["cli","ruby-gem","scroll-area","terminal"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ilkutkutlar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-03T22:44:20.000Z","updated_at":"2020-09-17T21:00:22.000Z","dependencies_parsed_at":"2022-09-13T20:11:21.268Z","dependency_job_id":null,"html_url":"https://github.com/ilkutkutlar/terminal-scroll-area","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ilkutkutlar/terminal-scroll-area","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilkutkutlar%2Fterminal-scroll-area","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilkutkutlar%2Fterminal-scroll-area/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilkutkutlar%2Fterminal-scroll-area/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilkutkutlar%2Fterminal-scroll-area/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ilkutkutlar","download_url":"https://codeload.github.com/ilkutkutlar/terminal-scroll-area/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilkutkutlar%2Fterminal-scroll-area/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28015265,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","ruby-gem","scroll-area","terminal"],"created_at":"2025-12-25T01:20:52.447Z","updated_at":"2025-12-25T01:20:53.220Z","avatar_url":"https://github.com/ilkutkutlar.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terminal Scroll Area\n\n[![Gem Version](https://badge.fury.io/rb/terminal-scroll-area.svg)](https://badge.fury.io/rb/terminal-scroll-area)\n\n\u003cimg alt=\"Gif showing usage\" src=\"https://raw.githubusercontent.com/ilkutkutlar/terminal-scroll-area/main/usage.gif\" width=50%\u003e\n\nThis gem lets the user display large text on terminal by creating a scroll area in which only a specified portion of the text is displayed at a time. This portion can be moved to reveal other parts of the text, analogous to a GUI scroll area, or a more general purpose pager. This gem is useful when your program needs to display a large amount of text that may not fit into the screen.\n\nThe `ScrollArea` class, which is not interactive, does not use Curses or a similar screen management library. The `InteractiveScrollArea` class does not rely on the Curses library and instead uses the [TTY toolkit](https://github.com/piotrmurach/tty), which has cross platform support and support for many types of terminals/terminal emulators. Therefore this gem should also have the same level of support.\n\n## Installation\n\n```rb\ngem install 'terminal-scroll-area'\n```\n\nor add it to your project's `Gemfile`:\n\n```rb\ngem 'terminal-scroll-area'\n```\n\n## Usage\n\n### `ScrollArea` class\n\n- Simple scroll area which lets you programmatically scroll the content in all directions.\n- Initialise:\n\n```rb\nrequire 'terminal-scroll-area'\n\n# Only display 5 lines at a time with\n# 5 characters in each line.\nwidth = 5\nheight = 5\nscroll = ScrollArea.new(width, height)\n```\n\n- Set the content that the scroll area will contain:\n\n```rb\n# Set content all at once:\nscroll.content = \"some text\"\n\n# Or use add_string/add_line:\nscroll.add_string(\"some string\")\n\n# Same as add_string, but adds a newline\n# after the string\nscroll.add_line(\"some line\")\n```\n\n- Render scroll area to get the portion of the entire content which is in view:\n\n```rb\n# Render and print the currently visible\n# portion of the text.\nprint(scroll.render)\n```\n\n- Scroll in all directions to reveal other portions:\n\n```rb\n# also available: \n# - scroll_down\n# - scroll_left\n# - scroll_right\nscroll.scroll_up\n```\n\n- Scroll area lets you access some values you may find useful:\n\n```rb\n# The starting coordinates of the window which is displayed.\nscroll.start_x\nscroll.start_y\n\n# The ending coordinates of the window which is displayed.\nscroll.end_x\nscroll.end_y\n```\n\n### `InteractiveScrollArea`\n\n- Regular `ScrollArea` lets you scroll the content with `scroll_\u003cdirection\u003e` methods. `InteractiveScrollArea` displays an interactive scroll area where the user can use arrow keys to control scrolling of the content (e.g. up arrow scrolls up, etc.).\n- This class will automatically print a new rendering of the area after user has triggered a scroll event by pressing a key. The previously printed rendering is removed and the updated rendering is printed in the same area, thereby giving the feeling of interactivity.\n\n```rb\nwidth = 5\nheight = 5\ninteractive = InteractiveScrollArea(width, height)\n\n# add_string and add_line are also available.\ninteractive.content = \"some text\"\n\n# Starts a loop, allowing user to use arrow keys to\n# scroll the content. Press Ctrl + C to exit.\ninteractive.scroll\n```\n\n## Development\n\n- Officially, this gem supports Ruby versions \u003e= 2.0.0 and such a Ruby version should be used during development as well.\n- Tests are written with [Rspec](https://github.com/rspec/rspec), version ~3.9. Run the tests on terminal with `rspec` in the project directory (need to install rspec first).\n- [Rubocop](https://github.com/rubocop-hq/rubocop) version ~0.8.2 is used to check for use of best practices and standard styling. Run Rubocop on the terminal with `rubocop` in the project directory (need to install Rubocop first). Currently, there are a couple of failing Rubocop checks which will be fixed soon.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filkutkutlar%2Fterminal-scroll-area","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filkutkutlar%2Fterminal-scroll-area","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filkutkutlar%2Fterminal-scroll-area/lists"}