Bill Allombert on Thu, 24 Sep 2009 18:37:53 +0200


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

Re: break> prompt


On Thu, Sep 24, 2009 at 11:28:06AM -0400, igorschein wrote:
> n Thu, Sep 24, 2009 at 10:46 AM, Bill Allombert <
> Bill.Allombert@math.u-bordeaux1.fr> wrote:
> 
> > On Thu, Sep 24, 2009 at 09:47:55AM -0400, Igor Schein wrote:
> > > Hi,
> > >
> > > In svn version 11882 ^C would take you from break> prompt to regular
> > prompt,
> > > but in version 11961 it doesn't any more.  Is it intentional or
> > accidental?
> >
> > This is mostly intentional, see bug #958. The purpose of this change is
> > to avoid the loss of a computation that you interrupted to look at its
> > progress. For example if you stop the computation to change the debug level
> > and make an error, you should still be allowed to continue the computation.
> > This include spurious ^C stroke.
> >
> > > >From the point of convenience, I much prefer version 11882 behavior.
> >
> > Honestly, I did not know that ^C would get you out of the breakloop, and it
> > is
> > not documented. I suggest to use ^D instead.
> >
> 
> Right, except that ^D is tricky - click it twice in a row by accident and
> you lose your 3 week-old session with 6000 lines of input and output.  It'd
> be nice to be able to unbind ^D at the regular prompt, but because it's not
> a readline binding, it's not immediately obvious to me whether it's doable
> or not without mocking with shell and terminal settings.  I'll switch to the
> 3rd option then - 3 ^Js in a row, which is much safer.

I completly agree with you on the risk of ^D.
Here a patch that disable ^D in the main loop.
Maybe the '0' should be replaced by some default.

Cheers,
Bill.
diff --git a/src/gp/gp.c b/src/gp/gp.c
index 89cf643..1564997 100644
--- a/src/gp/gp.c
+++ b/src/gp/gp.c
@@ -1530,7 +1530,7 @@ gp_main_loop(long flag)
 
     if (! gp_read_line(&F, NULL))
     {
-      if (popinfile()) gp_quit(0);
+      if (popinfile() && 0) gp_quit(0);
       if (ismain) continue;
       pop_buffer(); return z;
     }