octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Questions about the pager


From: John Swensen
Subject: Re: Questions about the pager
Date: Tue, 07 Nov 2006 17:22:19 -0500
User-agent: Thunderbird 2.0a1 (X11/20060807)

John W. Eaton wrote:
On  6-Nov-2006, John Swensen wrote:

| John Swensen wrote:
| > I recently have discovered the my IDE fails when the pager is turned | > on. I think I have narrowed down the problem, but need advice from | > someone with more UNIXy PTY experience than I. I am using the patch | > that JWE pointed me to, which I modified per the maintainers request | > and re-submitted to the VTE. It allows me to make the IDE and octave | > the same process. I am not 100% sure exactly how it works, other than | > the fact that I open a new pseudo-TTY and attach the master side to | > the VTE widget and run octave inside the pseudo-TTY using the | > following function run as a thread.
| >
| > void* octave_main_wrapper(void *dummy)
| > {
| >  // TODO: pass in the real argc, argv
| >  int argc = 1;
| >  char* argv[] = {"/usr/bin/octave"};
| >  octave_main(argc,argv,0);
| >
| >  do_octave_atexit();
| >
| >  cout << "Exiting Octave - debug CTRL-C" << endl;
| >
| >  return 0;
| > }
| >
| > The problem seems to arise when the pager is called. I think this is | > because Octave is actually spawning an instance of 'less' and for some | > reason it is attached to the TTY of the terminal from which I ran | > octave, rather than being attached to the pseudo-TTY in which Octave | > is running. Can anyone give some advice on this issue? Namely, is | > there a way to make the pager run inside the same pseudo-TTY as the | > octave process.
| >
| > John Swensen
| >
| I would like to amend this statement. In fact, the pager output does | show up in the VTE window, it is the input to the pager that must come | from the original terminal from which I launched my IDE. So, forward, | back, quit, nor CTRL-C works from the VTE window, but they do work from | the original terminal.

Look at the source to less.  In the file ttyin.c, it opens /dev/tty to
get input from the user.  I think the reason for this is that if less
is invoked like this:

  some_command | less

then it can't use stdin to read user commands from the keyboard
becuase stdin is already connected to the source for the text it is
displaying.

Isn't the VTE widget used to implement gnome-terminal?  What does it
do to connect to /dev/tty when it has the window manager focus?

jwe

After investigating a little further, I have discovered the following. The patch to VTE was intended such that the IDE and octave would show up as a single process. Otherwise, it would be just like gnome-terminal and bash, where each time gnome-terminal is started, an instance of bash is also started. This was done by creating a pseudoTTY(PTY) and attaching it to VTE, then running Octave in the new PTY. I'm not 100% sure on this, but I think I am pretty much out of luck to get this working with the current way of doing things. I am going to run a very simple test to see if it acts differently between using the VTE fork_pty() and set_pty() function. I suspect the fork_pty() will work as expected, but set_pty() won't. So, I can see at least 2 solutions to this problem (but others may see much better ones) 1) Since the IDE has scrollback, just make sure paging is off when octave is running in the IDE 2) Somehow set up my IDE as an external pager and handle it myself (very undesirable, because 'less' is good at what it does) 3) Some other method of redirecting the input channel from the VTE to the file descriptors from the popen() call. (Also probably won't be easy).

Any other suggested solutions?

John Swensen


reply via email to

[Prev in Thread] Current Thread [Next in Thread]