darcs

Issue 1125 ^L should clear screen at interactive char prompts.

Title ^L should clear screen at interactive char prompts.
Priority wishlist Status resolved
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, jaredj, judah, kowey, thorkilnaur, twb
Assigned To judah
Topics ProbablyEasy

Created on 2008-10-05.23:39:46 by twb, last changed 2010-04-07.01:48:36 by judah.

Files
File name Uploaded Type Edit Remove
unnamed dagit, 2008-10-05.23:59:18 text/html
Messages
msg6233 (view) Author: twb Date: 2008-10-05.23:39:44
Darcs maintainers,

Below is a bug report from a Debian user (coincidentally, also me).
The associated Debian BTS ticket is http://bugs.debian.org/494160.
Please ensure that 494160@bugs.debian.org remains in the nosy list for
this roundup ticket.

On Fri, Aug 08, 2008 at 12:20:31AM +1000, Trent W. Buck wrote:
> Package: darcs
> Version: 2.0.2-2
> Severity: wishlist
>
> For example, if my screen has the following on it
>
>     twb@Clio[Preferences]$ darcs push soy:Preferences
>     Sun Aug  3 22:23:07 EST 2008  Trent W. Buck <trentbuck@gmail.com>
>       * Ignore Debian BTS headers.
>     Shall I push this patch? (1/29)  [ynWsfvpxdaqjk], or ? for help: y
>     Sun Aug  3 22:23:51 EST 2008  Trent W. Buck <trentbuck@gmail.com>
>       * Don't hard-wrap in IRC.
>     Shall I push this patch? (2/29)  [ynWsfvpxdaqjk], or ? for help:
>
> Then I expect ^L to issue a "clear screen" terminal command, then
> print the current information and the prompt, resulting in
>
>     Sun Aug  3 22:23:51 EST 2008  Trent W. Buck <trentbuck@gmail.com>
>       * Don't hard-wrap in IRC.
>     Shall I push this patch? (2/29)  [ynWsfvpxdaqjk], or ? for help:
>
> This makes it MUCH easier for me to focus on only the information
> relating to the current question -- because the rest is no longer
> on-screen.
>
> Note that in real cases, there's a lot more scrollback for ^L to clear;
> the benefit of ^L is less obvious in the shortened example above.
msg6234 (view) Author: dagit Date: 2008-10-05.23:59:19
On Sun, Oct 5, 2008 at 4:39 PM, Trent Buck <bugs@darcs.net> wrote:

>
> New submission from Trent Buck <trentbuck@gmail.com>:
>
> Darcs maintainers,
>
> Below is a bug report from a Debian user (coincidentally, also me).
> The associated Debian BTS ticket is http://bugs.debian.org/494160.
> Please ensure that 494160@bugs.debian.org remains in the nosy list for
> this roundup ticket.
>
> On Fri, Aug 08, 2008 at 12:20:31AM +1000, Trent W. Buck wrote:
> > Package: darcs
> > Version: 2.0.2-2
> > Severity: wishlist
> >
> > For example, if my screen has the following on it
> >

[snip]

[snip]

>
> > Note that in real cases, there's a lot more scrollback for ^L to clear;
> > the benefit of ^L is less obvious in the shortened example above.

I don't know how to implement this, but I agree it would be a very nice
feature.

It sounds like something that should possibly be supported in the terminal
io library we use.  But, then maybe that requires a call back.  So that
leaves us with watching for ^L, sending a clear screen code, and then
showing the prompt again.

Jason
Attachments
msg8337 (view) Author: kowey Date: 2009-08-22.10:38:52
I found this IRC chat log and wikipedia article.  It sounds like this is easy
enough to do by putting the right string out.

 http://tuukka.iki.fi/tmp/haskell-2007-11-24.html
 http://en.wikipedia.org/wiki/ANSI_escape_code

It would be a nice touch
msg8372 (view) Author: twb Date: 2009-08-23.07:00:08
On Sat, Aug 22, 2009 at 10:38:56AM +0000, Eric Kow wrote:
> I found this IRC chat log and wikipedia article.  It sounds like
> this is easy enough to do by putting the right string out.

It's not a single string -- it depends on the kind of terminal
emulator in use.  "tput clear" should emit the appropriate sequence;
it examines the terminfo/termcap entries of $TERM.

However, I think this is now a bug for haskeline, not Darcs.
msg8380 (view) Author: kowey Date: 2009-08-23.10:08:08
On Sun, Aug 23, 2009 at 07:00:12 +0000, Trent W. Buck wrote:
> However, I think this is now a bug for haskeline, not Darcs.

Cool.

Please file as needed and paste in the ticket URL from
  http://trac.haskell.org/haskeline
msg8800 (view) Author: twb Date: 2009-09-13.06:22:32
On Sun, Aug 23, 2009 at 10:08:11AM +0000, Eric Kow wrote:
> On Sun, Aug 23, 2009 at 07:00:12 +0000, Trent W. Buck wrote:
>> However, I think this is now a bug for haskeline, not Darcs.
> Please file [a bug with upstream].

I investigated further, and now I think this IS our fault.
Consider the following transcript:

    $ touch x
    $ darcs rec -l x
    Recording changes in "x":

    addfile ./x
    Shall I record this change? (1/1)  [ynWsfvplxdaqjk], or ? for help: (1)
    What is the patch name? (2)

At prompt (1), ^L does not work.  At prompt (2), ^L does work.
Furthermore, http://trac.haskell.org/haskeline/wiki/KeyBindings
indicates that ^L has worked upstream since 0.5.
msg8801 (view) Author: kowey Date: 2009-09-13.06:44:48
Hi Judah: If you have any time for Darcs hacking, could you investigate this
darcs bug?  The complaint appears to be that ^L works for long prompts (eg.
patch name) but not for one-character prompts (y/n/etc)
msg8802 (view) Author: judah Date: 2009-09-13.08:19:06
On Sat, Sep 12, 2009 at 11:44 PM, Eric Kow <bugs@darcs.net> wrote:
>
> Eric Kow <kowey@darcs.net> added the comment:
>
> Hi Judah: If you have any time for Darcs hacking, could you investigate this
> darcs bug?  The complaint appears to be that ^L works for long prompts (eg.
> patch name) but not for one-character prompts (y/n/etc)

It's not a darcs bug; the one-character prompts use a different
Haskeline function than the long prompts.  The one-character prompt
intentionally provides a much simpler user interface which is supposed
to mimic an unbuffered getChar.

But making the one-character prompt aware of ctrl-L is a good idea and
a quick fix.  I've added that functionality to Haskeline's HEAD, and
it will be included in next week's release of 0.6.2.

With that change, pressing ctrl-L and then "x" results in the following:

    Shall I push this patch? (1/1)  [ynWsfvplxdaqjk], or ? for help: x
        Sun Sep 13 01:07:31 PDT 2009  Judah Jacobson
          * Teach getInputChar about ctrl-L (clear-screen).

            M ./System/Console/Haskeline.hs +2

In other words, pressing ctrl-l clears the screen of all but the last
line ("Shall I push this patch?..."); and then pressing "x"
re-displays the patch summary.

Thanks for the idea!  If you have any suggestions/bugs about how this
works, please file a ticket at http://trac.haskell.org/haskeline .
msg10692 (view) Author: judah Date: 2010-04-07.01:48:36
Closing this ticket, as the enhancement was released in haskeline-0.6.2 
(in September).
History
Date User Action Args
2008-10-05 23:39:46twbcreate
2008-10-05 23:59:20dagitsetfiles: + unnamed
nosy: kowey, dagit, simon, twb, thorkilnaur, dmitry.kurochkin
status: unread -> unknown
messages: + msg6234
2008-10-16 15:00:29droundysetpriority: wishlist
nosy: kowey, dagit, simon, twb, thorkilnaur, dmitry.kurochkin
2009-05-30 05:35:37twbsetnosy: kowey, dagit, simon, twb, thorkilnaur, dmitry.kurochkin
title: Bug#494160: Wish ^L would clear screen at interactive prompts. -> ^L should clear screen at interactive prompts.
2009-08-10 23:47:31adminsetnosy: - dagit
2009-08-22 10:38:56koweysetstatus: unknown -> needs-implementation
nosy: + jaredj
topic: + ProbablyEasy
messages: + msg8337
2009-08-23 07:00:11twbsetnosy: kowey, simon, twb, thorkilnaur, jaredj, dmitry.kurochkin
messages: + msg8372
2009-08-23 10:08:11koweysetnosy: kowey, simon, twb, thorkilnaur, jaredj, dmitry.kurochkin
messages: + msg8380
2009-08-25 17:30:17adminsetnosy: + darcs-devel, - simon
2009-08-26 15:22:11koweysetstatus: needs-implementation -> needs-reproduction
nosy: kowey, darcs-devel, twb, thorkilnaur, jaredj, dmitry.kurochkin
2009-08-26 15:22:30koweysetnosy: kowey, darcs-devel, twb, thorkilnaur, jaredj, dmitry.kurochkin
assignedto: twb
2009-08-27 14:33:28adminsetnosy: kowey, darcs-devel, twb, thorkilnaur, jaredj, dmitry.kurochkin
2009-09-13 06:22:34twbsetnosy: kowey, darcs-devel, twb, thorkilnaur, jaredj, dmitry.kurochkin
messages: + msg8800
2009-09-13 06:44:50koweysetnosy: + judah
assignedto: twb -> judah
messages: + msg8801
title: ^L should clear screen at interactive prompts. -> ^L should clear screen at interactive char prompts.
2009-09-13 08:19:08judahsetnosy: kowey, darcs-devel, twb, thorkilnaur, jaredj, dmitry.kurochkin, judah
messages: + msg8802
2010-04-07 01:48:36judahsetstatus: needs-reproduction -> resolved
messages: + msg10692