> < ^ Date: Wed, 06 Mar 1996 10:53:00 +0100 (MET)
> < ^ From: Martin Schoenert <martin.schoenert@math.rwth-aachen.de >
< ^ Subject: Re: documentation of line editing
Michael Smith wrote in his e-mail message of 1996/03/05

The following is an excerpt from the GAP manual ("Line Editing"),

<ctr>-'L'       insert last input line before current character.
<ctr>-'P'       redisplay  the last input   line, another  <ctr>-'P' will
                redisplay the line  before that, etc.   If  the cursor is
                not in the first column  only the lines starting with the
                string to the left  of the cursor  are taken.
<ctr>-'N'       Like <ctr>-'P' but goes the other way round  through  the
                history.
<esc>-'<'       goes to the beginning of the history.
<esc>-'>'       goes to the end of the history.
<ctr>-'O'       accepts this line and perform a <ctr>-'N'.

This should be updated, since the command <ctr>-'O' does not seem to be
implemented. I was delighted to find out today that a feature just like
it exists in GAP already but is not explicitly mentioned in the manual.
Instead of typing <ctl>-'O' to accept the line and edit the historically
following one, simply hit return to accept the line and then press
<ctl>-'N' to receive the next one.

This is a feature I have sorely missed, and only discovered it today by
accident --- perhaps it should be mentioned explicitly in the manual?

(I had assumed that it was my terminal emulator/settings that were
causing the problem with using <ctl>-'O').

<ctr>-'O' is implemented (in 'SyFgets') and works fine for me.
There must be some other reason that it doesn't work for you.
I would guess that the <ctr>-'O' is eaten by your terminal driver.
On our FreeBSD 2.1 systems it is the default for the <discard>
special character (which toggles the flushing of terminal output).
I turn it off with 'stty discard undef' in my '.login' file.
I have been told that the command under SunOS is 'stty flush undef'.

The reason that it is not automatically turned off by 'SyFgets'
(the way the <interrupt> and <suspend> special characters are turned off)
is that <discard> and <lnext> (literal next character, usually <ctr>-'V')
are relatively new POSIX additions and are not known on all BSD systems.

I thought it clear that "accepts this line and perform a <ctr>-'N'"
means that <ctr>-'O' is equivalent to <enter>/<ctr>-'N'.

Which feature exactely have you missed and only discovered today?
That <ctr>-'N' starts with the line that historically follows the
line that was edited last?

Note also that <enter>/<ctr>-'N' is not quite equivalent to <ctr>-'O'.
The latter one can be prefixed with a repetition count, the former not.

In case you wonder what all this is about, allow me to describe in more
detail what <ctr>-'N' and <ctr>-'O' do.

Assume you have entered the following code to compute a list of squares

gap> e := 2;;
gap> l := [];;
gap> for i in [1..10] do
>        Add( l, i^e );
>    od;
gap> l;
[ 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 ]

and you now want to compute a list of cubes.

First you press <ctr>-'P' six times (or <ctr>-'U'/'6'/<ctr>-'P') to go
back to the line 'e := 2;;'.  Then you change this line to 'e := 3;;'.
Next you press <enter> to enter this line.

If you now press <ctr>-'N', it goes to the next line in the history,
starting from the one you just entered, i.e., it immediately brings up
the next line 'l := [];;'. Again you press <enter> to enter this line
and <ctr>-'N' to bring up the next line 'for i in [1..10] do'.
Four more <enter>/<ctr>-'N' later you have reentered the whole block.

<ctr>-'O' is simply a shorthand for <enter>/<ctr>-'N'. Thus instead of
pressing <enter>/<ctr>-'N' six times you can simply press <ctr>-'O' six
times. Or, even shorter, you can simply press '<ctr>-'U'/'6'/<ctr>-'O'.

Try it. It is much simpler to use than to describe.
And to reenter large blocks of code it is very useful.

Martin.

-- .- .-. - .. -.  .-.. --- ...- . ...  .- -. -. .. -.- .-
Martin Sch"onert,   Martin.Schoenert@Math.RWTH-Aachen.DE,   +49 241 804551
Lehrstuhl D f"ur Mathematik, Templergraben 64, RWTH, 52056 Aachen, Germany

> < [top]