0

I want to use ncurses to create overlays on top of the current terminal. From looking at C examples there is a cur_scr variable which contains the data for the current screen, which I assume I can use to clear the screen, to create the appearance of ncurses overlaying the terminal.

I want to do this with ruby ncurses which seems to be problematic, because I do not know how to access the cur_scr variable from ruby.

How can I do this?

dda
  • 6,030
  • 2
  • 25
  • 34
Joseph Le Brech
  • 6,541
  • 11
  • 49
  • 84

1 Answers1

0

I'm afraid this is not possible.

When you start ncurses it has no way of knowing what the screen currently contains, so the first thing it does is clear the screen. Once the screen is cleared ncurses does know the state of the screen so it can overlay content but it does this by always maintaining the full state of the screen in memory. (See How Do ncurses et. al. Work? )

Some terminals have the ability to save the content of the screen and will re-display it when the ncurses application ends but this is not a feature of ncurses it is a feature of the terminal.

Community
  • 1
  • 1
Craig
  • 4,750
  • 22
  • 21
  • so there is no screenscraping library for the terminal? – Joseph Le Brech Oct 03 '12 at 14:37
  • As far as I can tell neither vt220 nor ansi escape sequences include a way to determine the current character at a given location on the screen. Specific terminals may provide extensions but it would certainly not be portable. – Craig Oct 03 '12 at 15:10
  • apparently `screen -L` will log the terminal, so I could "blank", "print screenlog", "display windows". I'll give it a go and report back. when I `cat screenlog.0` It outputs the colours too :D but i'm not sure if I can pipe out to screen in that way in ncurses. – Joseph Le Brech Oct 03 '12 at 15:21