|
From: Bastian M. <bma...@we...> - 2011-03-18 09:39:39
|
Currently the builtin readline causes gnuplot to terminate
if ^D (DEL) is entered on an empty line. Would the following
trivial change have any negative side effect?
Bastian
--- /src/readline.c (revision 231)
+++ /src/readline.c (working copy)
@@ -715,7 +722,9 @@
case 004: /* ^D */
if (max_pos == 0) {
reset_termio();
- return ((char *) NULL);
+ if (!interactive) /* terminate */
+ return ((char *) NULL);
+ break;
}
if (cur_pos < max_pos) {
for (i = cur_pos; i < max_pos; i++)
|
|
From: Hans-Bernhard B. <HBB...@t-...> - 2011-03-20 19:29:03
|
On 18.03.2011 10:39, Bastian Märkisch wrote: > > Currently the builtin readline causes gnuplot to terminate > if ^D (DEL) is entered on an empty line. That's been the default behaviour of Unix command line shells since the beginning of time(). Some let you change that, some don't. > Would the following > trivial change have any negative side effect? I suspect it would surprise some long-time users. |
|
From: Allin C. <cot...@wf...> - 2011-03-20 20:36:39
|
On Sun, 20 Mar 2011, Bastian Märkisch wrote: > >On Sunday, March 20, 2011, Hans-Bernhard Bröker wrote: > >> On 18.03.2011 10:39, Bastian Märkisch wrote: > >> > > >> > Currently the builtin readline causes gnuplot to terminate > >> > if ^D (DEL) is entered on an empty line. > >> > >> That's been the default behaviour of Unix command line shells since the > >> beginning of time(). Some let you change that, some don't. > >> > >> > Would the following > >> > trivial change have any negative side effect? > >> > >> I suspect it would surprise some long-time users. > > > >Including me :-) > >That's what ^D is supposed to do. It means "End of File". > > > > Ethan > > Ok. The problem is that the builtin readline maps the DEL key > to ^D on Windows. So "DEL" terminates gnuplot there. So you > can accidentally close gnuplot while editing. Hmm. Initially you said that ^D causes gnuplot to exit if it's typed in an empty line (i.e. you're _not_ editing). And that's correct behavior. On the other hand, when in readline editing mode one would generally expect ^D to delete rightwards, as in emacs (unless your readline preference is set to vi-style.) And that's in fact what happens on *nix when libreadline is used. For example, type plot atan(x) and Enter. Then recall the last line with up-arrow, move the cursor onto the first 'a' and press ^D: this turns the line into plot tan(x) Is the behavior on Windows with built-in readline different from that? If so, I think that would be a bug. Allin Cottrell |
|
From: Tait <gnu...@t4...> - 2011-03-21 07:15:09
|
>>>>> Currently the builtin readline causes gnuplot to terminate >>>>> if ^D (DEL) is entered on an empty line. >> >> Ok. The problem is that the builtin readline maps the DEL key >> to ^D on Windows. So "DEL" terminates gnuplot there. So you >> can accidentally close gnuplot while editing. > > Hmm. Initially you said that ^D causes gnuplot to exit if it's > typed in an empty line (i.e. you're _not_ editing). And that's > correct behavior. > > On the other hand, when in readline editing mode one would > generally expect ^D to delete rightwards, as in emacs (unless your > readline preference is set to vi-style.) And that's in fact what > happens on *nix when libreadline is used. ... > > Is the behavior on Windows with built-in readline different from > that? If so, I think that would be a bug. Windows behaves the same way. The delete-on-its-own-line causing gnuplot to exit was something I hadn't noticed before, which is all the more reason not to change that behavior, imo. (I've always used control and d to generate ^d, although I probably use "exit" just as often.) |
|
From: sfeam (E. Merritt) <eam...@gm...> - 2011-03-20 19:47:05
|
On Sunday, March 20, 2011, Hans-Bernhard Bröker wrote: > On 18.03.2011 10:39, Bastian Märkisch wrote: > > > > Currently the builtin readline causes gnuplot to terminate > > if ^D (DEL) is entered on an empty line. > > That's been the default behaviour of Unix command line shells since the > beginning of time(). Some let you change that, some don't. > > > Would the following > > trivial change have any negative side effect? > > I suspect it would surprise some long-time users. Including me :-) That's what ^D is supposed to do. It means "End of File". Ethan |
|
From: Bastian M. <bma...@we...> - 2011-03-20 20:01:47
|
>On Sunday, March 20, 2011, Hans-Bernhard Bröker wrote: >> On 18.03.2011 10:39, Bastian Märkisch wrote: >> > >> > Currently the builtin readline causes gnuplot to terminate >> > if ^D (DEL) is entered on an empty line. >> >> That's been the default behaviour of Unix command line shells since the >> beginning of time(). Some let you change that, some don't. >> >> > Would the following >> > trivial change have any negative side effect? >> >> I suspect it would surprise some long-time users. > >Including me :-) >That's what ^D is supposed to do. It means "End of File". > > Ethan Ok. The problem is that the builtin readline maps the DEL key to ^D on Windows. So "DEL" terminates gnuplot there. So you can accidentally close gnuplot while editing. Bastian |
|
From: Hans-Bernhard B. <HBB...@t-...> - 2011-03-20 20:12:29
|
On 20.03.2011 21:01, Bastian Märkisch wrote: > Ok. The problem is that the builtin readline maps the DEL key > to ^D on Windows. That it shouldn't do. At least not according to the documentation (see "help command-line editing"). That says DEL should be mapped to be the same as ^H, and do back-space. |
|
From: sfeam (E. Merritt) <eam...@gm...> - 2011-03-20 22:19:55
|
On Sunday, March 20, 2011, Bastian Märkisch wrote: > > >On Sunday, March 20, 2011, Hans-Bernhard Bröker wrote: > >> On 18.03.2011 10:39, Bastian Märkisch wrote: > >> > > >> > Currently the builtin readline causes gnuplot to terminate > >> > if ^D (DEL) is entered on an empty line. > >> > >> That's been the default behaviour of Unix command line shells since the > >> beginning of time(). Some let you change that, some don't. > >> > >> > Would the following > >> > trivial change have any negative side effect? > >> > >> I suspect it would surprise some long-time users. > > > >Including me :-) > >That's what ^D is supposed to do. It means "End of File". > > > > Ethan > > Ok. The problem is that the builtin readline maps the DEL key > to ^D on Windows. So "DEL" terminates gnuplot there. So you > can accidentally close gnuplot while editing. From the top of the file readline.c /* NANO-EMACS line editing facility * printable characters print as themselves (insert not overwrite) * ^A moves to the beginning of the line * ^B moves back a single character * ^E moves to the end of the line * ^F moves forward a single character * ^K kills from current position to the end of line * ^P moves back through history * ^N moves forward through history * ^H and DEL delete the previous character * ^D deletes the current character, or EOF if line is empty * ^L/^R redraw line in case it gets trashed * ^U kills the entire line * ^W kills last word * LF and CR return the entire line regardless of the cursor postition * EOF with an empty line returns (char *)NULL * * all other characters are ignored */ Curiosly, the full information on ^D is not given in the help file. |
|
From: <pl...@pi...> - 2011-03-21 10:55:57
|
On 03/20/11 23:19, sfeam (Ethan Merritt) wrote: > * ^D deletes the current character, or EOF if line is empty > * ^L/^R redraw line in case it gets trashed > * ^U kills the entire line > * ^W kills last word > * LF and CR return the entire line regardless of the cursor postition > * EOF with an empty line returns (char *)NULL > * > * all other characters are ignored > */ > > Curiosly, the full information on ^D is not given in the help file. > > > Hi, I'd never used ^d as a delete on *nix since I already have del and bkspc I suppose. I just use if for exiting. This strange double function does not seem particularly good design but it been that way for decades so probably has not caused anyone to accidentally shut down the pumps on a nuclear reactor. I guess is can stay. So it's a feature not a bug and in any case is not a gnuplot issue. (go bug readline about windoze mapping of del key). regards |
|
From: Jonathan T. <jt...@as...> - 2011-03-20 21:33:13
|
On 18.03.2011 10:39, Bastian M?rkisch wrote:
> Currently the builtin readline causes gnuplot to terminate
> if ^D (DEL) is entered on an empty line.
IMHO that's a feature, not a bug. In particular, that's how I always
exit an interactive gnuplot session. I'd like to keep this behavior
(which is also the same for the GNU-readline version of gnuplot)
unchanged.
--
-- Jonathan Thornburg <jt...@as...>
Dept of Astronomy & IUCSS, Indiana University, Bloomington, Indiana, USA
"Washing one's hands of the conflict between the powerful and the
powerless means to side with the powerful, not to be neutral."
-- quote by Freire / poster by Oxfam
|