[erlang-bugs] Silly eshell history behavior
Matthew Dempsky
matthew@REDACTED
Wed Apr 9 09:34:48 CEST 2008
I downloaded an R12B-1 snapshot to see if this patch had been merged
yet, and was initially excited because looking over the current
group.erl, the lines match up with the + lines in my diff below, but
testing then showed my test case still fails... after first wildly
assuming it was a platform specific thing and a few hours of repeated
recompiling on every machine I have access to, I finally noticed that
my patch below is reversed (I ran "diff -u group.erl group.erl.orig"
instead of "diff -u group.erl.orig group.erl")...
So in case any Erlang developers looked at this patch and/or tried to
merge it and assumed it had already been applied, no, it has not (as
of the 20080408 snapshot I downloaded). I'd appreciate if someone
would give feedback on this.
(patch(1) has a -R option to apply a patch in reverse for this reason.
Alternatively, I'll repost the diff correctly generated.)
On Thu, Mar 27, 2008 at 11:38 AM, Matthew Dempsky <matthew@REDACTED> wrote:
> Run erl, type "1.", hit enter, type "2.", hit enter, press up, press
> down, press up.
>
> I expect at the end of this sequence for the command edit buffer to
> contain "2.", not "1.". Below is a patch for this.
>
> Let me know if this breaks any intentional behavior and I will revise
> it as necessary.
>
>
> --- lib/kernel/src/group.erl 2008-03-27 11:34:12.000000000 -0700
> +++ lib/kernel/src/group.erl.orig 2007-11-26 10:55:37.000000000 -0800
> @@ -329,9 +329,9 @@ get_line1({undefined,{_A,Mode,Char},Cs,C
> or ((Mode =:= meta_left_sq_bracket) and (Char =:= $A)) ->
> send_drv_reqs(Drv, Rs),
> case up_stack(Ls0) of
> - {none,_Ls} ->
> + {none,Ls} ->
> send_drv(Drv, beep),
> - get_line1(edlin:edit_line(Cs, Cont), Drv, Ls0);
> + get_line1(edlin:edit_line(Cs, Cont), Drv, Ls);
> {Lcs,Ls} ->
> send_drv_reqs(Drv, edlin:erase_line(Cont)),
> {more_chars,Ncont,Nrs} = edlin:start(edlin:prompt(Cont)),
> @@ -346,9 +346,9 @@ get_line1({undefined,{_A,Mode,Char},_Cs,
> or ((Mode =:= meta_left_sq_bracket) and (Char =:= $B)) ->
> send_drv_reqs(Drv, Rs),
> case down_stack(Ls0) of
> - {none,Ls} ->
> + {none,_Ls} ->
> send_drv_reqs(Drv, edlin:erase_line(Cont)),
> - get_line1(edlin:start(edlin:prompt(Cont)), Drv, Ls);
> + get_line1(edlin:start(edlin:prompt(Cont)), Drv, Ls0);
> {Lcs,Ls} ->
> send_drv_reqs(Drv, edlin:erase_line(Cont)),
> {more_chars,Ncont,Nrs} = edlin:start(edlin:prompt(Cont)),
> @@ -407,17 +407,21 @@ new_stack(Ls) -> {stack,Ls,{},[]}.
>
> up_stack({stack,[L|U],{},D}) ->
> {L,{stack,U,L,D}};
> +up_stack({stack,[L|U],C,D}) ->
> + {L,{stack,U,L,[C|D]}};
> up_stack({stack,[],{},D}) ->
> {none,{stack,[],{},D}};
> -up_stack({stack,U,C,D}) ->
> - up_stack({stack,U,{},[C|D]}).
> +up_stack({stack,[],C,D}) ->
> + {none,{stack,[C],{},D}}.
>
> down_stack({stack,U,{},[L|D]}) ->
> {L,{stack,U,L,D}};
> +down_stack({stack,U,C,[L|D]}) ->
> + {L,{stack,[C|U],L,D}};
> down_stack({stack,U,{},[]}) ->
> {none,{stack,U,{},[]}};
> -down_stack({stack,U,C,D}) ->
> - down_stack({stack,[C|U],{},D}).
> +down_stack({stack,U,C,[]}) ->
> + {none,{stack,U,{},[C]}}.
>
> %% This is get_line without line editing (except for backspace) and
> %% without echo.
>
More information about the erlang-bugs
mailing list