[darcs-users] darcs patch: Resolve issue1578: Don't put newlines in the Haskeline prompts.

Judah Jacobson judah.jacobson at gmail.com
Sun Aug 30 06:19:19 UTC 2009


On Sat, Aug 29, 2009 at 7:15 PM, Trent W. Buck<trentbuck at gmail.com> wrote:
> Simon Michael <simon at joyful.com> writes:
>
>> This does indeed prevent issue 1578. But as I said there, wouldn't it
>> be better to build the workaround into haskeline, keeping your api
>> simple ?
>
> The patch seems reasonable to me, because it splits up what I see as
> conceptually different output -- a warning, and the actual prompt.  I'd
> be inclined to accept it (as churn) even if it didn't fix an issue.

Yeah, I agree.  I think it would actually make the API more
complicated to process newlines within Haskeline.  For example,
pressing ctrl-r in emacs line input mode temporarily replaces the
prompt with "(reverse-i-search)..." .  If the prompt contained
multiple lines, should they all be temporarily replaced or just the
last line?  I think replacing just the last line is the simpler choice
(and it's the correct behavior in all cases that I've seen in darcs or
elsewhere).  But if Haskeline is given a prompt string with multiple
lines, its behavior is harder to predict.

So like Trent says, I'd prefer to keep warning or status messages
separate from the actual input prompt.  I'll add a note to the
Haskeline documentation about this issue.

> I'm not applying it immediately because I first want to hear Judah's
> views on handling "stty -echo" directly in haskeline (I suspect it's not
> as trivial as it sounds).

Haskeline relies on echoing already being off so that it can detect
that it's inside an emacs-shell-like environment and behave correctly.
 (This is tricky to get right because "M-x shell" pretends to be a
terminal but does not, e.g., provide unbuffered input to programs run
inside of it.)

So I think the best way to resolve this is:
1) Apply my patch which makes the stty echo issues more benign; now,
the only problem that can occur is for user input to be printed twice.
 (This is the same behavior as bash.)
2) Figure out what program messes up echoing on Simon's machine.

Best,
-Judah


More information about the darcs-users mailing list