From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id e44f7bcd for ; Mon, 15 Jul 2019 19:15:17 +0000 (UTC) Received: (qmail 20977 invoked by alias); 15 Jul 2019 19:15:12 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 44527 Received: (qmail 7975 invoked by uid 1010); 15 Jul 2019 19:15:12 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f52.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25510. spamassassin: 3.4.2. Clear:RC:0(209.85.166.52):SA:0(-2.0/5.0):. Processed in 1.479339 secs); 15 Jul 2019 19:15:12 -0000 X-Envelope-From: mikachu@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.52 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=y2J/6TWUqhagtYLCw8qZXwtAqi92pUnPOUhif3wv92M=; b=bXEHxROKDdHBqZB2K+xUMr+VcbFtdUyZF/dpfgfedo6wAUUO/Ch2IQGasWBXo0/67N SasKCEKfXxfgZ0gDG8vHFwzwLmCkJAnz7w2WSsD91+rfZF+o/KkKjQagRgTrD+uNPIYn HyDZQAKPz+8jSTCPcyVfE2OPyzW5K1sWEmyQ4mc/yKAQLNrO95yEYCUtpDv0ueNCJQDs fSdWv5RIBPtqp8qjwVB/JY1Tmw5xyhWzh4DYfoTfego74kfQxyR7IKNEZE4rVnn60nBu XM9GL7oDCx2Ns2N1LyNdTQvYuLu688UHm8aSwZJiUyWZkzuxIgvj4Quigpx1v4yO3WFX K6WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=y2J/6TWUqhagtYLCw8qZXwtAqi92pUnPOUhif3wv92M=; b=UBhchLZ+/OTZjbwpVFg0JlE8MXfg1SZnSe+v/z7j5Y2+ttbm7Jlbsi91yuRxo7v09j FD2PJOeNrRGDkebJ6vdsyp13rjaC4A5Da7P3wBcJEkJM0BpxHolLM1cfqAx+a08J4EHq kq1w8JJ2ogeeTNW6IU82dmO9YV19gQTPv7t3/MvaijgyxcDtddUpUlDMe8ZkNJ/hRcks sEsipqhcIl77SB/bcPVpmg4F+k9yjC8Wls3hCkYjQEBAB2SlhLZDRxtsgAPRs+JB5Sc7 0yIkiGosmQ2VwLnP2cjjSuxHU+EokqIR1duKUzHu7bdUf3tF/Y6CUd8bNsZCj2W7dVTY 2KeA== X-Gm-Message-State: APjAAAUZ6kb1ivvwx6yGNS/vujWq2BGAcBvMN3qrxsvtwHgXMQA9XOdU IUTLFLzrOL8gLcCzbdj0td0GTOh7sxGv0k/NHLc= X-Google-Smtp-Source: APXvYqxPt+xhXRD7eGtt/VUuwww0frBFXgl/q7QxR+WiruNFFiPhmjiqw38eu/mGIGUYI38Nr1dMyE7Q+zu9Ssx5UmI= X-Received: by 2002:a6b:641a:: with SMTP id t26mr26759484iog.3.1563218078348; Mon, 15 Jul 2019 12:14:38 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Mikael Magnusson Date: Mon, 15 Jul 2019 21:14:37 +0200 Message-ID: Subject: Re: PATCH: draw prompt on the correct line after window change To: Roman Perepelitsa Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" On 7/15/19, Roman Perepelitsa wrote: > Many terminals reflow text when the window is resized. When the height > of the prompt changes as a result of this reflowing, ZSH draws the > updated prompt on the wrong line. This can lead to some parts of the > prompt not being erased, or to the disappearance of lines prior to the > prompt. > > There are many ways to reproduce this issue. Here are a couple. Both > require terminals that reflow text when the window is resized. > > 1. Run `zsh -df`, hit a few times, then type > `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` (don't hit ). > > OR > > 2. Run `PROMPT="${(pl.$COLUMNS..-.)}%f"$'\n> ' zsh -df` > and hit a few times. > > Now try resizing the terminal window back and forth causing lines to > wrap and unwrap. Terminal content before the last prompt will be > erased one line at a time. > > This patch cannot handle the case when the terminal window is being > resized while the first prompt line is outside the terminal window. > The content of the viewport will be correct but scrolling the terminal > window up will reveal some mess up there. ZSH before this patch also > fails in this case although it creates a different mess. > > The change is conservative. The new code triggers only on window > resize and not, for example, on redisplay. This reduces the chance > that it'll break something that isn't currently broken. > > I've tested this code only on GNOME Terminal. Before I go testing on a > dozen different terminals I'd like to get some feedback. Anything I'm > missing? Anything tricky to look out for? I've tested it on urxvt and it makes things worse there, enlarging the window always deletes the last output line even with an empty input line. -- Mikael Magnusson