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 f2633923 for ; Tue, 16 Jul 2019 08:17:48 +0000 (UTC) Received: (qmail 5182 invoked by alias); 16 Jul 2019 08:17:39 -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: 44544 Received: (qmail 27976 invoked by uid 1010); 16 Jul 2019 08:17:39 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f41.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.41):SA:0(-2.0/5.0):. Processed in 2.022239 secs); 16 Jul 2019 08:17:39 -0000 X-Envelope-From: roman.perepelitsa@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.41 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=U3RNLJ2GH3dJHQnJkBTycSAH1R/+XRc9D5Aum2bvMbE=; b=AWPlT5iq2uvfb1qK2+G9wcnlFfzJK7ZZtgIM3rvK55YgM9dhMh4YLjH7FFLSln+77P oaOIa+NbA7ZMCOQpQx2StmR+HUY1KewoC+mK5NhwXSvEOBKzbjajIykZOLE3PnPjBtjL s/GPZstblzshut2uSGsjRHktUGbCVybYZYxAThbhWEyjebTm7KmWdjaEaL9F1JI0nemA B7eattiG9FPjFOS2vd6Z87dluA3hZWZo+pd2LlC2AbqGx9zRSp5BnMuB/aFz1GlbmCpW rK2bnc0K5GcbJQ1SKE5m7C3t5MMlO9m/0A1wrpNBvZ/cardYZ+NmlNzhqxVADRsxi0zW b5oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=U3RNLJ2GH3dJHQnJkBTycSAH1R/+XRc9D5Aum2bvMbE=; b=nh9BJ7pxm46wm+yQq/coSDhuWtdr2EfmPozkOTYeBwwDaA61gxfMtXQuSZ6OmZZZRr tyrDqlGO1UrmN0PQSFvU6kIgHgzljMUGSOJGa6+QiM5R1VTuIAxM9Toz4/P/gA2ob3ay jSjFxXBlhRJjiDW9IIVUdw4bLbTrWxTsLfFZt97aq4mKXtqI5fe6VDcNEbMNkSnhXVkq tkYkyoK39LF3L+BJmGt/s1e95vNi6Fxt0I6l5v3IKWl9qXE5cdYNwXDKundP3MmkpuHe Z66ELAhIhJXENuDbqpjFQT5bFNJJaBJhHukz487C0Cs/BhcZguJkmIpqlM6AVvX8VY49 Tq8A== X-Gm-Message-State: APjAAAU5wRnDzdKqdqWnxpZuPgPVjC0co3WzkNr3YtIVf4yXqRXwOPAb BUStuUUAhy5vTX3fp+0KxA7Kp5o5gNFDxcHBfcF9GlZCNQA= X-Google-Smtp-Source: APXvYqxap26GgOjFmLaanrFVwFmRbdLKITOLs/pokh6RbNiwEVu9CTL+YBMquz8AbBbiS2lnhtDhsmFnN1P62hIV6Ow= X-Received: by 2002:a02:5a89:: with SMTP id v131mr34037555jaa.130.1563265023724; Tue, 16 Jul 2019 01:17:03 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Roman Perepelitsa Date: Tue, 16 Jul 2019 10:16:52 +0200 Message-ID: Subject: Re: PATCH: draw prompt on the correct line after window change To: Bart Schaefer Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" On Tue, Jul 16, 2019 at 1:28 AM Bart Schaefer wrote: > Install some of the alternate window managers provided with the > various OSs you have, rather than the default ones. There's a > plethora of them. The main thing is one that does live redraw while > resizing windows, rather than having you drag a window outline around > and then snapping the window to the outline when you release the > mouse. Got it. So far all tests I've done were with window managers that redraw the window continuously while it's being resized. I'll make sure to test with those that don't redraw until the mouse button is released. > > This patch [is] only doing writes to the terminal without any reads. > > Whenever ZLE prints prompt, it issues TCSAVECURSOR > > OK, then there is a different problem: Nothing prevents the prompt > itself from printing TCSAVECURSOR/TCRESTRCURSOR, and in fact some of > the themed prompts provided with zsh do that. There's no way for zsh > to guarantee that the cursorsaved flag is accurate. In my patch I attempted to not break code that stores/restores cursor. It'll work in all the following cases: 1. The cursor is saved and restored by a foreground process. 2. The cursor is saved and restored in precmd. 3. The cursor is saved and restored in preexec. 4. The cursor is saved and restored by PROMPT and/or RPROMPT. Cursor cannot be restored if the terminal window may have been scrolled due to extra lines added at the bottom. This limits the number of places where anyone can save/restore cursors. For example, saving the cursor in precmd and restoring it in preexec won't work because there can be new lines added in between (unless single_line_zle is set, but in this case my patch doesn't save/restore cursor). I _think_ my code doesn't break working code but I may be wrong. What should I test with? Which theme(s) save and restore cursor? It's worth reiterating that currently prompt refresh on window change is quite broken. Even if my patch isn't perfect, it still may be an improvement (it is so far in all my tests). Roman.