From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 10662 invoked from network); 26 Aug 2023 01:00:14 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 26 Aug 2023 01:00:14 -0000 ARC-Seal: i=2; cv=pass; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1693011614; b=TXmEp6ag1r9JxF04E/SOx5f41K2joaikjuBYvhdoA/Era++yH8I0vtvFwoeq2kPZzlyiY+6qqC LkDRYWFWrSYnHoj0iSzKjbB0KpE1G+jrdm+8JyB6A2sNWLZnjuh2MYVsjGl+QXiWVgqSYIlsQ7 v7ItvSh+nXYxKzq9bzPB4lAUSGP0/edlwG+zHpGIviYaGtE86WhSsb1OSC+MoCwkb9YsqIg0E3 1LzdmBLrCOcyiG71bav6rnznz35SigrgRBXqnIcayVF0pM8Z+mu7PMOutnVyeyI0+z2k/xvQPL opviPpfOoosQk/kudPpzt7fzpZN9fKEeiYYcDE07zIz/sg==; ARC-Authentication-Results: i=2; zsh.org; iprev=pass (mail-sn1nam02on2048.outbound.protection.outlook.com) smtp.remote-ip=40.107.96.48; dkim=pass header.d=alum.mit.edu header.s=selector2 header.a=rsa-sha256; dmarc=none header.from=alum.mit.edu; arc=pass (i=1) header.s=arcselector9901 arc.oldest-pass=1 smtp.remote-ip=40.107.96.48 ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1693011614; bh=zXCN5FZvmg5sIzHQjfodtzsUz4ONH+ovXPJw287HuyY=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:DKIM-Signature:DKIM-Signature; b=fusFn9bGErTIrR8NXukqpHmKd+nLiIimAPSjJMeR8vjMc5OkO8I01DboMLwGH1I2++nzgUe/Z7 8WQCWxYHY+3KyvmGqW3eS/0+H0WdZfXSpapDv+uBCGRltwUsHF6ajuXw45VC21PgWTHozvo3l7 NZJlV+YD+9CG8v9pfwtBEvLQsGrmK1h96c0Wy16b0I81oRKdkC8uiRW0xoPgy688Q6BZ4/xYH0 rq996zzdOLl2COio+OSybIMCH+0geIOE4IfAc6RQfwf1BKPJk6e4CDxNWulhP+vNxhyCjdPIIE C0VYFUVbr0wjzumHM5IySOGMDc0BkQMsKgrLFAyepp8RpQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=K6kzkG/kLajMsNYzTG16k5t0X0zqs61rhnbYRf4j7OU=; b=VeNEDGGyveTTiYR0XopK/Z7CEJ 7RFkE6LfCHX/q4DbQKw1HfCe8oY+EkDVQ8qGoe0y75Omf6ASYtf8IPBR9CD4S11GEuE0VJakrHAz4 4i+JMoLnwJNfEZYYdJEa6lBAVJ/ix+kNDvIpfqXT6aEXe8jRLlP4dQSYc84tuDbAUFq8NigAPsImu LF351Kcccnx3SAu7W4IbwRxWTGZCoPwR/yZTHARTtckB6p22iRMHW8yDqe8XxoFFSKNHEPxlHn7zP pSkTZ1pP4nzlRyUhnm0nrLyKfkdJPdaSg/70sDEMw8Abhb5vQpPoBK9CoR83i4/r+pQVOCyzg+bav d8XzlmPQ==; Received: by zero.zsh.org with local id 1qZhew-0006Ff-6P; Sat, 26 Aug 2023 01:00:14 +0000 Authentication-Results: zsh.org; iprev=pass (mail-sn1nam02on2048.outbound.protection.outlook.com) smtp.remote-ip=40.107.96.48; dkim=pass header.d=alum.mit.edu header.s=selector2 header.a=rsa-sha256; dmarc=none header.from=alum.mit.edu; arc=pass (i=1) header.s=arcselector9901 arc.oldest-pass=1 smtp.remote-ip=40.107.96.48 Received: from mail-sn1nam02on2048.outbound.protection.outlook.com ([40.107.96.48]:18914 helo=NAM02-SN1-obe.outbound.protection.outlook.com) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1qZheE-0005XE-IQ; Sat, 26 Aug 2023 00:59:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nf7AokLh4vzuvRqvffxpFKDzUsW9ur2DQxOX5+CQhnwBZV2TkqRhWnx6k0GxdrQd/RwY0ACciwNzuTAgO754R0KRYOGFr1MyZxQXFC1fBVbeETWwf6BS9LpgzVOthzcQbsgs69/gCcUdoEDCILUsVb+g3sdhqkW8a3e2JOHmIUyS5OKS3Mdh06UGl4Jht1E90D7RBIjFWedeoUSD6JqqOEph0zLmI/PGzR6t0WL7kM+KLTztjWPYogvRIUGVqd7b2qNBa7lgJKYOcoh//0D7fyivEik3rV0T5FLsqDWbxGeX2eW4aNzT4UIoRir2kJs+yuRf3sbR0iB5eASSvXXbiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=K6kzkG/kLajMsNYzTG16k5t0X0zqs61rhnbYRf4j7OU=; b=TqodTgF/KrT/s0AVwVNGEJIpKphe62sUk+NsfQlvXIMlqeKGp2uH+CrzraQH5tVyJdDJSbVNN0ADW1QhLMsx0INtIbJBDehU7WaWBCgYhVodFSmG9jTOlibXiFvSK+MdGZanC3oWkdg9h56nSk+9KPA9XdvsLkdz4krLarPRKngr5PNn8oKGgVHyULw+1s6sbfXGZH5OhJpLDq2wI4EQ5Z13r9bbllyGXhtn5PRzJhXZ4YGWBYQW9nUR3ncH8278EykCkzwzbRTkcj5Kg5InS6Mnrz2ZauNz/HAZOjwRWT4MF2zVo+FY5HiIW4PoPqdQDP/cOTSX/K6ZjXLY03gRdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 18.7.68.33) smtp.rcpttodomain=alum.mit.edu smtp.mailfrom=alum.mit.edu; dmarc=pass (p=none sp=none pct=100) action=none header.from=alum.mit.edu; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alum.mit.edu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K6kzkG/kLajMsNYzTG16k5t0X0zqs61rhnbYRf4j7OU=; b=QzDo1mez8tG83Nx65BZUd0cYN68GlQPYQUBP0cL0gGaXu8jJEZ5UABgd1sIKQABeklb+FC3j/GiDq/HZ8ZLPZfcw3K4TAzYjH0oqrE49tkiEC8vK3oMk63i9Ut/4qjJoaCZqtf6Zx/IRuHIt3gL7Plu6IKRdsJKNIkNkeQTXCvY= Received: from BN9PR03CA0140.namprd03.prod.outlook.com (2603:10b6:408:fe::25) by SJ2PR12MB8689.namprd12.prod.outlook.com (2603:10b6:a03:53d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.27; Sat, 26 Aug 2023 00:59:23 +0000 Received: from BN1NAM02FT014.eop-nam02.prod.protection.outlook.com (2603:10b6:408:fe:cafe::a9) by BN9PR03CA0140.outlook.office365.com (2603:10b6:408:fe::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.30 via Frontend Transport; Sat, 26 Aug 2023 00:59:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 18.7.68.33) smtp.mailfrom=alum.mit.edu; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=alum.mit.edu; Received-SPF: Pass (protection.outlook.com: domain of alum.mit.edu designates 18.7.68.33 as permitted sender) receiver=protection.outlook.com; client-ip=18.7.68.33; helo=outgoing-alum.mit.edu; pr=C Received: from outgoing-alum.mit.edu (18.7.68.33) by BN1NAM02FT014.mail.protection.outlook.com (10.13.2.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.12 via Frontend Transport; Sat, 26 Aug 2023 00:59:22 +0000 Received: from localhost ([50.230.201.134]) (authenticated bits=0) (User authenticated as jhawk@ALUM.MIT.EDU) by outgoing-alum.mit.edu (8.14.7/8.12.4) with ESMTP id 37Q0xK22008960 (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Aug 2023 20:59:20 -0400 Date: Fri, 25 Aug 2023 20:59:20 -0400 From: John Hawkinson To: Bart Schaefer Cc: zsh-users@zsh.org Subject: Re: Why does zsh clear to end-of-screen after prompt? Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1NAM02FT014:EE_|SJ2PR12MB8689:EE_ X-MS-Office365-Filtering-Correlation-Id: caa41c2e-c4b0-4ceb-6798-08dba5cfafd1 X-LD-Processed: 3326b102-c043-408b-a990-b89e477d582f,ExtAddr,ExtFwd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /0GLhIucW9Y6ICjWMhdKThP6dD0gH6ufURB+HPnfNn0oSpaLzNNkl8p9iIey3sq2WFcg/HsPJ+w20EDnsWa9izFX3hGwbwCshJ/OE//Tqhg4ldq7OLfWkw788Yg3tQfz5yoxhNot18pEVhNfK1gAXbkk47NiotJqD42Vg50invSQ733rdYumM3WHJD/JccfvHkv0FAAyatJlCVR4NZpe1W9E4GCwIpgS2NG4OvxY9dyZh4duA4EINg1vqKkiNFvvMyrA8CpOThnK3oZ5JnILsls4laeMFQJVOE0BBcD18NzFDlv1/61TtxPstTgPmgYgZpq5/hr5Uz4sMSJfM/IiSD0T2lay4ooKep5BLx47vbvNdOya/KEP8D0TpXCNQaBrYqqRAgEKQ0SzuJ9z23pscYpa30GN6gcLzO7lqyrMoCTQcB2LYxYMElA6LZbzgKLqCMtkLA98MXWQl7bzn43AQJIzoMNkmAY6zdawJwSmuqFxvkOn44pSurq/dEt46mq6RydRNzds/mqx5r6GgjD4utLVQfLmE9PJkp6BDnvtRy5nsVd//xkZa/nHvfgnp5zEJtd9jtDanHShSHaoRAvmMn1b1s6HJhnZwvTLExgXa8FZVsU8JC3SuM9MIqdyjsKzQlXOUeqRo2laCUxAjocE7GdFpE1Mk10M5GfL97ZParxE5JiCJQVvItiGjDDFSwp1nT1V8VN9GAwpybWn7QrbcMWNPjOvWTq3rfdl2COoRxRg1nAbaPbrmYqIjA/6r0w+ X-Forefront-Antispam-Report: CIP:18.7.68.33;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:outgoing-alum.mit.edu;PTR:outgoing-alum.mit.edu;CAT:NONE;SFS:(13230031)(39860400002)(376002)(396003)(346002)(136003)(186009)(1800799009)(82310400011)(451199024)(46966006)(40470700004)(36840700001)(956004)(40460700003)(75432002)(66899024)(5660300002)(8676002)(4326008)(8936002)(336012)(47076005)(83380400001)(41320700001)(36860700001)(26005)(40480700001)(82740400003)(356005)(7596003)(6916009)(786003)(70206006)(70586007)(316002)(478600001)(41300700001)(2906002)(9686003)(86362001);DIR:OUT;SFP:1101; X-OriginatorOrg: alum.mit.edu X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2023 00:59:22.8669 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: caa41c2e-c4b0-4ceb-6798-08dba5cfafd1 X-MS-Exchange-CrossTenant-Id: 3326b102-c043-408b-a990-b89e477d582f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3326b102-c043-408b-a990-b89e477d582f;Ip=[18.7.68.33];Helo=[outgoing-alum.mit.edu] X-MS-Exchange-CrossTenant-AuthSource: BN1NAM02FT014.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8689 X-Seq: 29199 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: Bart Schaefer wrote on Fri, 25 Aug 2023 at 20:18:01 EDT in : > This happens because ZLE is a mult-line editor and also because > completion uses the space under the editor area to display lists etc. > If the screen were not cleared, text being edited could mingle with > the screen contents already present. Ugh. I suppose it would be too much to ask that it not do this in the (for me) 90+% case where neither completion nor multi-line editing have been used? Or only to clear as many lines as have been used, rather than to end-of-screen? Or a knob to just not clear it and let the user deal with the fallout? I was optimistic that setopt SINGLE_LINE_ZLE would solve this, but it does not. Oddly setopt noZLE does so, but it's a worse user experience than TERM=dumb. At least with TERM=dumb I get up/down arrow, even if the editing is not quite right and overlaps the prompt in weird ways. > > How can I get cursor positining to work without forgoing, e.g., line editing? > > You can try something like this: > > PS1=$'%{\e[H%}'$PS1$'%{\e[K%}' Bah. I mean, yeah, that works, but it feels fairly not-great. In case it wasn't apparent, the use case is I had a small ad hoc script that produced ~20 lines of key/value output and sometimes the values change and I'd like to keep them in the same position on the screen and just overwrite themselves when they change if I rerun the script with up-arrow/RET. I guess another way is this: OPS1="$PS1" # save it for idempotency later PS1=$'%{\e[40H%}'$OPS1 echo '\e[H'; seq 1 20 which, for an 80x48 window, gives 8 lines for editing and commands that don't do any positioning, and leaves the top 40 lines for stuff that's prefixed by CSI H homing to the top-left. Maybe this is an acceptable balance, I dunno. > There are also games to be played with save_cursor and restore_cursor, > e.g., a command that wants to control the screen appearance could move > to a position, save_cursor, and then move to the end of the screen, if > the prompt were then programmed to start with a restore_cursor -- but > you still have to be careful about that "start in the leftmost column" > and deal with avoiding the restore if the last command didn't save. Yeah, this feels even more...antithetical to the simplicity I was desiring. Honestly it feels like just using bash for this particular one-off is the easiest way out :( It seems to me, also, that the documentation could use some improvement on this point, but perhaps it is so obscure that it is going to be hard to find a good place to insert a straightforward discussion of this concern. If this thread doesn't reach any better resolution I'll do some thinking about ways to improve that. Thanks, Bart. -- jhawk@alum.mit.edu John Hawkinson