[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Stretch]Typing ""clear" on terminal restricts the scrollback to only a screenful



Hi,

Am 2017-06-21 11:57, schrieb Avinash Sonawane:
On Wed, Jun 21, 2017 at 1:36 PM, Christian Seiler <christian@iwakd.de> wrote:
So what happened is that 'tput clear' in Stretch now behaves the
same as 'clear', while the version in Jessie of 'tput clear'
wouldn't clear the scrollback buffer.

This suggests that the version of 'clear' in Jessie used to clear the
scrollback buffer.
But that's untrue. I have always used 'clear' to clear the screen in
Jessie. And it never cleared the scrollback buffer. (I'm not sure
about 'tput clear' though. Haven't used that much)

I see two possible explanations for the behavior you're seeing:

 a. The terminal program you're using doesn't like the additional ';'
    character in the escape sequence that 'clear' on Jessie was
    sending, so ignored the escape sequence entirely. In that case
    it only interpreted '\033[H\033[2J'.

    Reminder: 'clear' on Jessie would send:   \033[3;J\033[H\033[2J
              'clear' on Stretch would send:  \033[3J\033[H\033[2J
              On the Linux text console \033[3J and \033[3;J both
              clear the scrollback buffer completely, at least with
              kernel 4.9.

 b. The terminal program you're using changed behavior between
    Jessie and Stretch. For example, KDE's 'konsole' terminal program
    will _not_ clear the scrollback buffer with either one of these
    commands:

      printf '\033[3J\033[H\033[2J'
      tput clear
      clear

    It may be that your terminal program used to ignore the sequence
    as well in Jessie, but implemented it in Stretch.

    (Funnily enough, just found out, KDE's 'konsole' will clear it
    if you just issue \033[3J - but once you issue a \033[2J again,
    it will restore the buffer once more. Really weird.)

You can test which one of these is the case by using the following
commands:

printf '\033[3;J\033[H\033[2J'

printf '\033[3J\033[H\033[2J'

If the first one doesn't erase the scrollback buffer, but the second
one does, then you know that your program doesn't support the escape
sequence that Jessie's clear sent, but does support the one that
Stretch sent. (Case a.) If in both cases the scrollback buffer is
erased, then it's likely that the behavior of your terminal program
changed between Jessie and Stretch. (Case b.)

Regards,
Christian


Reply to: