Обсуждение: psql/readline clears screen

Поиск
Список
Период
Сортировка

psql/readline clears screen

От
"Merlin Moncure"
Дата:
is there a way to configure psql/readline so that it doesn't clear the
screen after browsing a query with 'q'?

regards,
merlin

Re: psql/readline clears screen

От
Martijn van Oosterhout
Дата:
On Wed, Aug 09, 2006 at 09:02:55AM -0400, Merlin Moncure wrote:
> is there a way to configure psql/readline so that it doesn't clear the
> screen after browsing a query with 'q'?

You don't say the OS, but you may be seeing the effects of less working
on a terminal with a seperate interactive screen (for example xterm).
What's happening is that when less exits, it switches back to the main
screen, thus hiding what you were just looking at.

From reading the manpage, setting the pager to "less -X" should solve
this problem.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

Re: psql/readline clears screen

От
AgentM
Дата:
On Aug 9, 2006, at 9:02 , Merlin Moncure wrote:

> is there a way to configure psql/readline so that it doesn't clear the
> screen after browsing a query with 'q'?

Assuming you are using less as your PAGER, then see:
http://www.greenwoodsoftware.com/less/#tite

One can add the -X option to your LESS or PAGER environment variables.

-M


Re: psql/readline clears screen

От
Reece Hart
Дата:
On Wed, 2006-08-09 at 09:02 -0400, Merlin Moncure wrote:
is there a way to configure psql/readline so that it doesn't clear the
screen after browsing a query with 'q'?

I assume you're using the less text pager on a Unix box. I think what you're seeing is less clearing the screen after displaying a query (i.e., it's not psql or readline).

I like the following invocation: less -iMSx4 -FX (see less manpage for explanation).  This is particularly useful with ' \pset pager always' (in .psqlrc). The upshot is that less will decide whether the contents fit on one screen both horizontally and vertically; if so it'll display and quit without any interaction, and if not it will permit scrolling in one or both directions.

There are two ways you might enable this:
- set and export the LESS environment variable in your shell setup, like this in .bashrc:
export LESS='-iMSx4 -FX'
-  prefix your psql invocation with the LESS environment variable setting, like this:
$ LESS='iMSx4 -FX'   psql <optargs...>


-Reece

-- 
Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0

Re: psql/readline clears screen

От
"Merlin Moncure"
Дата:
On 8/9/06, Reece Hart <reece@harts.net> wrote:
>  On Wed, 2006-08-09 at 09:02 -0400, Merlin Moncure wrote:
>
>      is there a way to configure psql/readline so that it doesn't clear the
>      screen after browsing a query with 'q'?
>  I assume you're using the less text pager on a Unix box. I think what you're seeing is less clearing the screen
afterdisplaying a query (i.e., it's not psql or readline). 
>
>  I like the following invocation: less -iMSx4 -FX (see less manpage for explanation).  This is particularly useful
with' \pset pager always' (in .psqlrc). The upshot is that less will decide whether the contents fit on one screen both
horizontallyand vertically; if so it'll display and quit without any interaction, and if not it will permit scrolling
inone or both directions. 


actually, i do my editing about 60% windows, 40% linux until i finish
migrating my development platform to os x. on windows, i tried out
your less options using the cygwin compiled psql and like them very
much.

merlin