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 75d4398d for ; Mon, 15 Jul 2019 22:10:36 +0000 (UTC) Received: (qmail 6306 invoked by alias); 15 Jul 2019 22:10:31 -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: 44540 Received: (qmail 11299 invoked by uid 1010); 15 Jul 2019 22:10:31 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f68.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.68):SA:0(-2.0/5.0):. Processed in 1.903343 secs); 15 Jul 2019 22:10:31 -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.68 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=bxGzirU9r418X0Yw4I5htUUSzJHftrBKeyoTAAAxqCM=; b=FrpFFRkUSiMMtMhTqRzyd9M8IcEoa+lUQT/TytvCLRo3THyPqnPf0WQFCtulYFA4CO 2vy52qZ6YjjoVyE5Sez1ry2tcVOifq4GO8o1Pt1fTxx5oj66IITvaQTKhbNTDZ1RPYg8 41PW5vkYeHVmdLoami4X0OQ9aSDHPJptu+nJQZqsjwdck/TI1VCxFp2olj2OhOy0L8do SpsNVQh4gJJ0L7sy1/ylqQ2134TuojlyTcknInv+f4CX7aw0AP88X27DD3ENRaZjhHZS UGg2Qfte3SZR8NA1sOe/U+p8SQJnyWV7P18CHzju259zEWoFavmanqctG3LFFkqcaARG De+g== 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=bxGzirU9r418X0Yw4I5htUUSzJHftrBKeyoTAAAxqCM=; b=OexhuQUvllR5tao8+VOHGA4tS+dJpxk59Wbpq3QFVOSgq6R6rlahhkgmhw++5WQQ2v 2S8SMT/otM2pg1ZaYmjwMH+LIKIg2qrSFqBLeHTrCd2daAiaNqXPRoj3LDl4GjtgKwz5 W/nYfBGODXokcmAU6ALifRH3NC8rgZkWEpxGcy9R1J/a060uKM6FWlqqF6Nt3mg4I8SG zuZpkzy5ETbqEou9PTMj1qEvcphqWbtSJpryQ8ym+aUgdKWZ3/vGW5Zgy5T9ky6bI5lC PMRQ3DnoM4t3ed/PChqJmauPEjneL1t68VlDHwt/Xoz8ZtIVZ+OkkeelhW3WF18tN8n3 xVsA== X-Gm-Message-State: APjAAAVhNAzgYTqHZKIqt7N1IzHvec5ka0ujI+B/sRVrcCPIPfKWlqSI y3Ebz4b4IZVvn0G+jUVOsa0+biGlXmfnow0ZM0d4uiVyjq0= X-Google-Smtp-Source: APXvYqwubxw9R0du7RHy378n34CPfZ7D+vCGvowusSl/ROdUKvKOXZONGJCGV5Ae50Xy+OZqBAXu+jnRlXHotWsI29U= X-Received: by 2002:a6b:7208:: with SMTP id n8mr17196973ioc.151.1563228596977; Mon, 15 Jul 2019 15:09:56 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Roman Perepelitsa Date: Tue, 16 Jul 2019 00:09:46 +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 Mon, Jul 15, 2019 at 11:24 PM Bart Schaefer wrote: > > On Mon, Jul 15, 2019 at 10:21 AM Roman Perepelitsa > wrote: > > > > 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? > > The most significant problem with window resizing is not the terminal > itself, but window/session managers that try to do "live update" of > the window contents as the cursor is rapidly dragged around. These > tend to send a stream of WINCH signals which we have had to do various > tricks to manage. I would be concerned that attempting to write a > control sequence to the terminal and read back the response in the > midst of a flood of such signals would fail as often as it succeeds. > If this is already limited/controlled by the mechanisms in place, > great. This patch isn't only doing writes to the terminal without any reads. Whenever ZLE prints prompt, it issues TCSAVECURSOR which instruct the terminal to save the position of the cursor in a special stash. When window resizes, ZLE issues TCRESTRCURSOR to tell the terminal to move the cursor to the previously saved position. The nice thing about these commands is that the stashed cursor position will still be in the right place after the terminal has reflowed text. I _think_ this shouldn't window/session managers but I'll definitely need to test it first. Do you have suggestions on what I should test with? I have a battery of 13 terminals and 4 operating systems that I use for testing changes but I'm not sure any of my configurations qualify as high-risk for this patch. > > The patch is attached to the email. You can also see it in > > https://github.com/zsh-users/zsh/compare/master...romkatv:fix-winchanged. > > Thanks for the link, it's the only way I was able to see this on a > mobile device. Please inline patches, or attach them as text/plain > (not text/x-something), without base64 encoding if possible. Sorry about that. I don't think it's possible to specify content type for attachments in GMail. Perhaps if I attach *.txt instead of *.patch it'll become "text/plain"? I'll try it next time. Roman.