Re: Question about Ctrl-C and less

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Sean Utt <sean(at)strateja(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Question about Ctrl-C and less
Date: 2005-10-23 10:00:56
Message-ID: 20051023100056.GA6623@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Oct 22, 2005 at 02:48:53PM -0700, Sean Utt wrote:
> Except that if I am in less, and I do CONTROL-C, it doesn't do anything at
> all.
>
> It doesn't exit.
>
> If I send a kill -2 to the process, it doesn't exit. less ignores SIGINT
> completely.

Not quite, It interprets it as "abort command". Obviously if you're not
doing anything at the time it appears to do nothing. Start a search (/)
or turn on follow mode (F) and you'll see you can (or indeed in the
latter case, must) use Ctrl-C to get back to the command prompt.

Indeed, in follow mode it says:

Waiting for data... (interrupt to abort)

> If we are in the pager, don't respond to CONTROL-C, and instead output a
> helpful hint telling people to use q to quit, which will do what they
> really wanted anyway.

That's wrong too, who says q exits the pager? Not to mention the
message screws the screen also, needing a ^L to redraw the screen. Best
do nothing at all (ie ignore). If the user doesn't know how to use
less, then they shouldn't use it as pager. Besides, less comes with
online help (press h), with how to quit being the first thing you read.

> In theory, we already deal gracefully with q being pressed in the pager.

Yes, by not reading stdin. Ergo, we should also not respond to ^C
either.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Karasik 2005-10-23 10:49:18 prepared queries in plpgsql
Previous Message Andreas Pflug 2005-10-23 09:57:08 Re: [Slony1-general] Slony1_funcs broken with 8.1