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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 9018 invoked from network); 26 Aug 2023 00:19:04 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 26 Aug 2023 00:19:04 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1693009144; b=RkhBu6JesbHp6asjrYPqMhPM3Bi7QCXpBdt39uMVf19RycJ4YgSUjXwLA7yyOmJj7kDKKWPtzm BMqg1RHuMfIbjpw/grt5JBw/2REShDn/AadYWL/+Qra1XOzkScH7RgIuPY+TELXA86vyrlagpT 2tU92oOBxBx0GC6JD1suIUIk/+T2n+hudo3JpM9TiwVYKJlua9fPeWG3hblnh7evfTEoGuz29P t2GX2oJ7Os+F8b+SrnaP/DTgT3/H1kjyE1Rf7XddTnduojHLWLTDAYmssseAVo8VXxeIxhWfBE NTSrEHX2Qw37xIN5SFyBnZdW/W31rH8nQAEcKnPYtKxOgA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f44.google.com) smtp.remote-ip=209.85.218.44; dkim=pass header.d=brasslantern-com.20221208.gappssmtp.com header.s=20221208 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1693009144; bh=ipaJFdY6JuSsSXdRLb8jEVr+EKxTtCKeRDNMvLHCfyY=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=U2ofPvBVpXX7bCvWY90EBkPmE0riIcsZi7awrmayC7dinLBH2ly04649BhBh/VQUoOd7dwIhJA nIQ0vq1od1oY0G9lGddSOTwlqvFRvyJS9ah+858Xre42DMZ1WN9sj6cFlMxy4pxKC62Q/xJ0Wf nchntWI1hNvp1GfZ4rftKa76RlTmAoi7OUFLtJxRxKVRUtuzHi+hkLrIDL/2y6/UzO0JkGY36k p/lf6UO+DaFmoZ8xE5H8FOCb3+KkdU2lO+eyosHXbT+vK3bpo05koDp4R8rhF1euttQQUKwg2W SnvQJC+00eclw5iu7o7P93t6bR4Ii89Sdb2L5T1DQBvOKg==; 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:Content-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=GBHgfZoejtnAmdpdv8UGNGXTYHE6xMVHThJVEnWPRyE=; b=IPtqmlheI3c4lkbPyAzskwWc5K 3V/B39Cbz+ox7DWkjmqNSFUTbtdy7vV0QawJoN3RFbuFCemBZAxEbEbgyQG3g2IrZ4dhXvkHVk5WE BXBbMZ1p/x44C4TaRSFUXvPGF7/VSB5T1kpQ8pdlNEgqZDiIQUG6ocxpWWasq2JQThyO97moLSvNd uWfrFepXkCWbvi9EA298VEPLpUy4NgKJ9nVOrZJhpniDkyRM+uixjtJ/NM6zwz7kM6V67rdBfyvRj UII5zptGsgm0BWSTxPirfCMqNm3sJn89rXhr37I8GZt+H+fAqoHMFF7wHU8B/sXokvBIhD3IqCBne xeiup/pw==; Received: by zero.zsh.org with local id 1qZh15-0004BL-CO; Sat, 26 Aug 2023 00:19:03 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f44.google.com) smtp.remote-ip=209.85.218.44; dkim=pass header.d=brasslantern-com.20221208.gappssmtp.com header.s=20221208 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ej1-f44.google.com ([209.85.218.44]:62648) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1qZh0G-0003UX-PG; Sat, 26 Aug 2023 00:18:13 +0000 Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-9a1de3417acso521655566b.0 for ; Fri, 25 Aug 2023 17:18:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20221208.gappssmtp.com; s=20221208; t=1693009092; x=1693613892; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=GBHgfZoejtnAmdpdv8UGNGXTYHE6xMVHThJVEnWPRyE=; b=eLlGC55TjtQl9Vupv//RDOscF27+bcBLzrZCLFGUj4qNELeM+S3WgvxxdkAV+EAepZ r3JGKqgfdu9pPgt7byy1qy8oIghcMpM5SXfmnfldbUgAOtuUhK0S1koU4eiFR6eHiA4e pZtnvVc9j6r4w6Dzged6mvLVZsin+XxmWTsvT4t2zwV9BAyQ3mBKmuOuKKzIiYL9Xr82 erAwckgARfmEWYe+pAMa2VGFOL6Iq/9bEFpw/WHPtVc490jKAMbd4JiKPCzmdjDpj2Ii yGAHRtRgUAWfCGExqYsHOxfRjxYmQHtr2131DyXME2cTDAcpRnnMzoXh4r8u1Sw0Rw/b hBTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693009092; x=1693613892; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GBHgfZoejtnAmdpdv8UGNGXTYHE6xMVHThJVEnWPRyE=; b=PsNRtD/IWDVpJ+zOs8+ubcz1zIti0BBG5NdsgtAwANOaseCjLbma6V6+gTH0raxbPa w4TCqlrh+9NU0eCwApvnjaugjpSO8mrpkTvqsYoc3cnnDLWSfKi7gHyWyM74lI3TV7qI nHmtl1ZkQOAnCag1UK09gHVLw4BbnpDEalOgIeyb2AOABSJ4EgBWtnbi/N8owU+ps5Y4 K2jJ1mAkd7G/4I2nDOsTIvCnP0WLv2USnsz2UXmefpE5Fk874fnxkHHIfGJ8sS8TWghg ++JgeOa8VokrbfVxYX89tL5FuPS4kR6ART+UtrptL8xydHdWBdKcx9ZIoSJ2v7m0OmWQ yoSA== X-Gm-Message-State: AOJu0YxIi1YQBSKLVBxcPJEDmyEmiUcr5CbSZj4wfDSOWJ40CFXWNXTi Ovpab438Xm029Cc48VFmB9JnZGLLWS0wxiySC5qIGQ== X-Google-Smtp-Source: AGHT+IE9spurXjAxM+/Baw2H5JFNIr+jpvkIX8QNb6sefWqE7qf7JwgEBCpRX9Y9da2vSIF0u8zgoPfXx4Rqf8YrGLw= X-Received: by 2002:a17:907:3f8a:b0:9a5:7b9a:f32f with SMTP id hr10-20020a1709073f8a00b009a57b9af32fmr2918319ejc.1.1693009092029; Fri, 25 Aug 2023 17:18:12 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Fri, 25 Aug 2023 17:18:01 -0700 Message-ID: Subject: Re: Why does zsh clear to end-of-screen after prompt? To: John Hawkinson Cc: zsh-users@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 29198 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: On Fri, Aug 25, 2023 at 12:53=E2=80=AFPM John Hawkinson wrote: > > When I reposition the cursor to the top left corner of the screen (or any= where), as with ESC [ H, when zsh prints a prompt it clears from the prompt= to the end of the screen, oblitering any text on the screen already, which= defeats the point of my cursor positioning. 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. The clear-to-end-of-screen is actually printed BEFORE the prompt is output, to make sure the prompt itself doesn't commingle with anything, and the prompt always expects to be started in the leftmost column or editing will be confused. > How can I get cursor positining to work without forgoing, e.g., line edit= ing? You can try something like this: PS1=3D$'%{\e[H%}'$PS1$'%{\e[K%}' However, this only works because the cursor positioning is part of the prompt string. If you try to move the cursor with a command like in your "echo" example, zle is still going to erase the whole screen at and below the line where the cursor is positioned when the command finishes. 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.