From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754031AbcK1ACa (ORCPT ); Sun, 27 Nov 2016 19:02:30 -0500 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:54717 "EHLO out5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752964AbcK1ACV (ORCPT ); Sun, 27 Nov 2016 19:02:21 -0500 X-ME-Sender: X-Sasl-enc: rzYsdqMdgjzI0qfrgYP+8ZIvFfkUpUn1rEYUJipseZZJ 1480291340 Date: Mon, 28 Nov 2016 00:02:15 +0000 From: Andrey Utkin To: Adam Borowski Cc: Manuel =?iso-8859-1?Q?Sch=F6lling?= , plagnioj@jcrosoft.com, tomi.valkeinen@ti.com, jslaby@suse.cz, gregkh@linuxfoundation.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 0/3] console: Add persistent scrollback buffers for all VGA consoles Message-ID: <20161128000215.GQ11418@dell-m4800.home> References: <20161123173340.GA24872@angband.pl> <1480265509-20922-1-git-send-email-manuel.schoelling@gmx.de> <20161127213730.GO11418@dell-m4800.home> <20161127231548.GA29376@angband.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161127231548.GA29376@angband.pl> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 28, 2016 at 12:15:48AM +0100, Adam Borowski wrote: > On Sun, Nov 27, 2016 at 09:37:30PM +0000, Andrey Utkin wrote: > > I've just patched next-20161125 with this set and given it a run. > > > > Scrollback persistence works fine, just as in earlier versions. > > > > This time I didn't forget to test clear operation. > > > > The only important concern is that after logout, the scrollback is not > > wiped by /bin/login or /sbin/agetty (not sure who of them is responsible > > for that). What do you see on your workstations in this case? > > If you're on Debian or a derivative, that's clear_console. It uses a > switch-vt-then-back hack which obviously doesn't work with scrollback > persistence. Reported as https://bugs.debian.org/845177 -- I'll molest the > maintainer if the patch doesn't get applied soon, so we can have the fix in > time for stretch (then Ubuntu zesty). I'm on Gentoo. > Because of a sad lack of a time machine, old systems will use clear_console > with that hack until they die, that's why > CONFIG_VGACON_SOFT_SCROLLBACK_PERSISTENT defaults to n; in a few years it'll > be ok to flip it. > > > I guess we need to do something of the following: > > - catch some control character sequences to wipe the scrollback > > \e[3J > > > - indicate (by some flag) some feature capability for this > > Terminfo calls this flag "E3". > > > - request update in terminfo database or whatever, to let ncurses know > > that it is capable of scrollback wiping by some control charater > > sequences > > Already there for quite a while. > > > clear(1) doesn't wipe the scrollback at all, it is still reachable, all > > of it. > > It does for me on the console. The man page says: > > # clear clears your screen if this is possible, including its scrollback > # buffer (if the extended "E3" capability is defined). clear looks in the > # environment for the terminal type and then in the terminfo database to > # determine how to clear the screen. > > Because of its reliance on terminfo, you need to have TERM=linux in your > environment; also, screen/tmux obviously breaks this. I wonder whether my ncurses is not bleeding-edge enough, or I have some non-standard config. Anyway, thanks for explanation. > > echo -e "\e[3J" seems to wipe the scrollback, but if you do it several > > times in a row, every time you (or at last I do) get your prompt a bit > > lower, so after many times you end up with blank screen and the prompt > > at the bottom of the screen. > > Yeah, none of \e[J subcommands move the cursor at all. As you use echo > without -n, you move two lines lower, and even with -n the command you typed > takes a line. You want to move the cursor explicitly, add "\e[H". Thanks for explanation.