zsh-users
 help / color / mirror / code / Atom feed
* clearing the screen without losing anything?
@ 2008-01-16 15:13 Andy Spiegl
  2008-01-16 15:46 ` Seth Kurtzberg
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andy Spiegl @ 2008-01-16 15:13 UTC (permalink / raw)
  To: zsh-users

I was just wondering whether it's possible to clear the screen (with Ctrl-l)
such that the screen contents is pushed into the terminal's (i.e. xterm)
scrollback buffer.

Uhm, I am not even sure whether that's a zsh or xterm issue?

Thanks,
 Andy.

-- 
 If you take an Oriental person and spin him around several times,
 does he become disoriented?       (George Carlin, US comedian)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: clearing the screen without losing anything?
  2008-01-16 15:13 clearing the screen without losing anything? Andy Spiegl
@ 2008-01-16 15:46 ` Seth Kurtzberg
  2008-01-16 15:56 ` Mikael Magnusson
  2008-01-16 16:08 ` Bart Schaefer
  2 siblings, 0 replies; 5+ messages in thread
From: Seth Kurtzberg @ 2008-01-16 15:46 UTC (permalink / raw)
  To: Andy Spiegl; +Cc: zsh-users

That's an xterm issue.  xterm does have a logging facility built in, and it wouldn't be impossible to clear, read some part of the log, and redisplay it.  I suspect, however, that the result would be exactly what was on the screen before you cleared it, so it probably won't solve your problem.  Which brings to mind:  What is your problem, specifically?  Perhaps someone will have an idea about how to solve it.

Seth

On Wed, 16 Jan 2008 16:13:49 +0100
Andy Spiegl <zsh.Andy@spiegl.de> wrote:

> I was just wondering whether it's possible to clear the screen (with Ctrl-l)
> such that the screen contents is pushed into the terminal's (i.e. xterm)
> scrollback buffer.
> 
> Uhm, I am not even sure whether that's a zsh or xterm issue?
> 
> Thanks,
>  Andy.
> 
> -- 
>  If you take an Oriental person and spin him around several times,
>  does he become disoriented?       (George Carlin, US comedian)
> 


-- 
Seth Kurtzberg <seth@cql.com>
Hardware and Software Engineer


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: clearing the screen without losing anything?
  2008-01-16 15:13 clearing the screen without losing anything? Andy Spiegl
  2008-01-16 15:46 ` Seth Kurtzberg
@ 2008-01-16 15:56 ` Mikael Magnusson
  2008-01-16 16:50   ` Andy Spiegl
  2008-01-16 16:08 ` Bart Schaefer
  2 siblings, 1 reply; 5+ messages in thread
From: Mikael Magnusson @ 2008-01-16 15:56 UTC (permalink / raw)
  To: zsh-users

On 16/01/2008, Andy Spiegl <zsh.Andy@spiegl.de> wrote:
> I was just wondering whether it's possible to clear the screen (with Ctrl-l)
> such that the screen contents is pushed into the terminal's (i.e. xterm)
> scrollback buffer.
>
> Uhm, I am not even sure whether that's a zsh or xterm issue?
>
> Thanks,
>  Andy.

You can create a custom widget that echos some blank lines, and then
clears the screen.

function myclear() {zle -I;repeat $((LINES-2)) echo;clear}
zle -N myclear
bindkey '^L' myclear

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: clearing the screen without losing anything?
  2008-01-16 15:13 clearing the screen without losing anything? Andy Spiegl
  2008-01-16 15:46 ` Seth Kurtzberg
  2008-01-16 15:56 ` Mikael Magnusson
@ 2008-01-16 16:08 ` Bart Schaefer
  2 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2008-01-16 16:08 UTC (permalink / raw)
  To: zsh-users

On Jan 16,  4:13pm, Andy Spiegl wrote:
}
} I was just wondering whether it's possible to clear the screen (with Ctrl-l)
} such that the screen contents is pushed into the terminal's (i.e. xterm)
} scrollback buffer.
} 
} Uhm, I am not even sure whether that's a zsh or xterm issue?

Some of each.  Ctrl-l (the clear-screen widget) is implemented by sending
the "clear screen" terminal control string; what the terminal does with
that is out of zsh's hands, but zsh doesn't have to send that string.

    clear-screen() { repeat $LINES print '' >/dev/tty ; zle -I }
    zle -N clear-screen


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: clearing the screen without losing anything?
  2008-01-16 15:56 ` Mikael Magnusson
@ 2008-01-16 16:50   ` Andy Spiegl
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Spiegl @ 2008-01-16 16:50 UTC (permalink / raw)
  To: zsh-users

Great!  I combined Mikael's and Bart's solution into:

 clear-screen() { zle -I;repeat $((LINES-2)) echo;clear }
 zle -N clear-screen

Bart's solution works, too, but the prompt ends up in the bottom line
instead of the first line.

Wonderful, I am happy now :-)
 Andy.

-- 
 Many would never speak with a full mouth, but do it with an empty head.
                                                      (Orson Welles)


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-01-16 16:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-16 15:13 clearing the screen without losing anything? Andy Spiegl
2008-01-16 15:46 ` Seth Kurtzberg
2008-01-16 15:56 ` Mikael Magnusson
2008-01-16 16:50   ` Andy Spiegl
2008-01-16 16:08 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).