Re: Question about Ctrl-C and less - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: Question about Ctrl-C and less
Date
Msg-id 20051023100056.GA6623@svana.org
Whole thread Raw
In response to Re: Question about Ctrl-C and less  ("Sean Utt" <sean@strateja.com>)
List 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@svana.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.

pgsql-hackers by date:

Previous
From: Andreas Pflug
Date:
Subject: Re: [Slony1-general] Slony1_funcs broken with 8.1
Next
From: Dmitry Karasik
Date:
Subject: prepared queries in plpgsql