2

I am a beginner C programmer and one of my assignments asks me to write an interpreter for the Logo Programming Language. To that end I was wondering if it was possible, when using the ncurses library, to split the screen up so that half retains basic terminal properties with regular text i/o and the other half is formatted in ncurses mode.

My wish is to create a UI such that in one half users can type in Logo style commands and on the other half, such commands are executed onto a little icon.

Steven Doggart
  • 43,358
  • 8
  • 68
  • 105
pingOfDoom
  • 408
  • 1
  • 4
  • 21
  • That's not really feasible. You can fake it with the whole screen in curses mode, and make it look as though inputs are typed in (say) the bottom half of the screen while the top half executes the Logo commands. But the terminal will need to be in curses mode. – Jonathan Leffler Jan 27 '15 at 04:56
  • There isnt a way using the forms or windows or any other tangentially related ncurses library to achieve my goal? – pingOfDoom Jan 27 '15 at 04:58
  • I don't think so. Hang around; someone else may have an idea. But I'm not confident that they will. – Jonathan Leffler Jan 27 '15 at 07:11
  • 1
    It's perfectly feasible to achieve what you *actually want*, you just have to stop describing it in those specific words. The "terminal" window will be simulated -- what Jonathan Leffler referred to as "faking it". However, there need be nothing "fake" about it, from the user's perspective. – William McBrine Jan 27 '15 at 12:25
  • Basically all im trying to say is that i want to split the screen so that ncurses only applies to a single section. To the user it all looks the same but formatting text and such with ncurses I have found to be a bit onerous, and would much prefer having to deal with the default terminal in that area – pingOfDoom Jan 27 '15 at 23:08
  • Agreeing with the above comments, this reminds me of the "window" program which was part of the BSD distributions (and is still in FreeBSD ports for example). Making it work with Linux is not a task for a beginner. I simulate a split screen with [http://invisible-island.net/ded], and that is fairly advanced. – Thomas Dickey Feb 08 '15 at 15:36

1 Answers1

1

There is an application called screen which can split the terminal into multiple areas. What is does is implementing it's own terminal emulator which runs inside another terminal emulator. That's the only way to do it because the terminal itself has no concept of screen areas. So you basically have to implement a terminal emulator on top of ncurses which can be used as a "non ncurses area".

Perhaps a different approach would be easier. Does it need to run in a terminal? If not you could use the terminal for regular I/O only and create a GUI window of some sort beside it. Or not use the terminal at all, instead have some terminal widget embedded in your GUI (most GUI toolkits provide such I suppose).

Fabel
  • 1,711
  • 14
  • 36