There is some legacy C code that implements a multi-level menu in the linux terminal. To navigate through nested menus, use the following algorithm:
- There is a buffer containing 24x80 characters.
- A new screen is drawn in it.
- If this is not the first screen, then the previous state is reset to the second buffer.
- Buffer content is displayed.
I need to refine this code now, but this mechanism with drawing into the buffer just freezes. All kinds of life-style delights printf'ov immediately go to the forest.
I want to remake this way:
- Calculate the area of drawing a new submenu
- Specifically, this area is dropped into a small local buffer.
- A submenu is drawn directly to the screen
- When returning - we return a piece of the screen from the buffer back
Actually a question. Is it possible to implement paragraph 2?
Well, in general, if you have any thoughts on how to organize such behavior humanly, I will be glad.
PS curses not to offer. Fully shovel under it will not stay.