Creating a terminal menu with scrollable text

Creating a terminal menu with scrollable text

Creating a terminal menu with scrollable text

I am using a terminal only so no GUI and using Free Pascal 2.6.2. If I have a screen that begins on line 5 I can use the arrow keys to move down to say line 26, and if I get to line 27 it goes back to line 5, and line 4 wraps to line 25. All good and works with enter if a line is selected.

My problem is, if I have text that is say 100 lines long, I want to keep using the arrow keys go down, and if at line 27, line 27 moves to line 26 and line 26 to line 25 and line 5 would be removed from view.

Does anyone have an example of how to accomplish this?

RE: Creating a terminal menu with scrollable text

Isn't it dependent only of your terminal window settings ?
For examle in Windows you can set Screen Buffer Size, which means how many lines has your command scrren.
See this for example: http://delltech.150m.com/XP/dos/4.htm

RE: Creating a terminal menu with scrollable text

I pulled out an old text viewer project in Turbo Pascal which was rather interesting to see still works in Windows 8. Anyhow, there's a lot there, but here's a clue on how I handled it (too much here to repost the whole thing):

This is what gets called when the user presses the DOWN or UP key. RedrawTop() is just a procedure that puts a status line on the top of the screen that says "Viewing <XYZ>, Press F1 for Help", nothing relevant to what your question is. Textarray is the place where the text lines are stored in memory.

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.The Tek-Tips staff will check this out and take appropriate action.