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 14301 invoked from network); 1 Dec 2022 00:04:41 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 1 Dec 2022 00:04:41 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1669853081; b=R+oqQs6zyubv/sxN2SSJ78dw2Voa+byQjl0rJDxbMo8vPl2Tf1nIHgrTheWvtJvaW5q2XmGUoZ H1+NtS74jXZTk9AsWhyadhlMZouunYgLxQnuF7SAmrOPk5uMwVUc/EY7OKWwhgJIJ1girAcuN3 FoxiCtfOwESFJDKHzTPfKKV+RIG0tbJ6HYdhuEho09CcPF4lzEwa11kdblISptULe5ExfdRkFT 9HeFBaZCHO9dok0O6P2cUm4Cpr5nfup1ba0e0YXNShJwQcaJ3Fd2j9+eKLYccXY2FRtsjDd2VF vVkK9quS5ti9H+Zkx9iOpjYhZ00Iab0wf0vR60qgXt7jGw==; 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.20210112.gappssmtp.com header.s=20210112 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=1669853081; bh=JWsCT3XJUvSo3/wAgpLDRt7ByamNofgYv2u+3GfXi9E=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=Ju56XYC2akdYw4X6ioKl1EmIcaUcC0gwJyvvZKE0ThjoT5vs83MvrZ+YhmpBpTGg1909ts1iiu F9LkSh0zhNuHSviB2hYsFvGcs4Ulxi1SbleY5PFHwgEZ8i2e1KEh3UXp5dYNCeSQMdPfLG4PWe 91i/S46S1gxcxesnUQV4lEjEc0daJTyvTGveOPmgmneE8NO3cJXsVeb8OUB6b/ZWPjyuRSkrbs 7oDs7XMhZvFb+JfiemCn/QEsH4n0eY/IlpOpsR64STsXCtMbCY+XciRNFyJvzaye3ePH7w/Dlh H9Avvn80TJt8Rl084c4+xaibWM8RQ+Qy8Lvg7Qr7IlVrkQ==; 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-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=88rYvfc2jgTp4BankRpOzab/I0DR0rm5TEgAnOGYk9A=; b=GHNsKE779r2QAxsD3lHwuCoXP+ FZ4qfvLUypSPDFf6jdRmb3ICcEJXwP4nGm5lZSsKSDJ1uaH1eWBDUHj5ebVs8LPAwXwLA6gniWDmW PqYLxy+zZ+sz3eseECS3rVrZS8+4NffZPgR3DoSjLI+IsI8zx0OmW8cMk3ipqyQoCJFTUTGoBo24W vNbT2ZjKJeQOV6HpQOyveblZZ60YOvDzWrcgd1hgNtBBhL86jiwKP0WJzcrFXPV3aEHlrLHAt7lfi gSgim72dHmPNpKg7i2aByKsg80OtfVI8fwqZxFOW2OjrpCo4iP9FEgYOiwifhDAo5jDE0IRsMzyJ9 94L05Afg==; Received: by zero.zsh.org with local id 1p0X4C-000MNi-KT; Thu, 01 Dec 2022 00:04:40 +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.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ej1-f44.google.com ([209.85.218.44]:41684) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1p0X3V-000LgF-AJ; Thu, 01 Dec 2022 00:03:58 +0000 Received: by mail-ej1-f44.google.com with SMTP id vp12so397297ejc.8 for ; Wed, 30 Nov 2022 16:03:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=88rYvfc2jgTp4BankRpOzab/I0DR0rm5TEgAnOGYk9A=; b=CYfQpzlnO5iY6ZuYsYO7YIcRLLQg/dTwZg/x27kc5VQfBdI1vAPoCTy4xj99tr/wXG 6dxA44v73drd2x6FR0byCgMkJuqoYKA8dV0VMudoQhZlmOotB+lnxHFAzLCo+XNkbPFS 6fvM7IPDBK/RHorCuy1vr/bCN1aPWC64hMJ/lkaeaiNr0R6mJF59cbsiosfuMQdec5Q7 D2nVqQMadbE99nytqAF695ENAQ4jfH1ow12M89knV6O4KGDW1nbxEk06/vmcthJ8k4aT fxK0GMj/B2BcxmDYrFgN+1Wq66rjtLGDF3zbTgygqTadJidSxUGzhdZSvVGiGxLSciX0 eK5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=88rYvfc2jgTp4BankRpOzab/I0DR0rm5TEgAnOGYk9A=; b=uHZj7AY2xaEmHsW0XkaCqibAn4SkqFxLi7QS8nH8eFygbLjEVClwV7G7izYnRoJJT2 cjoMgc7uD9ZZPBub1pb/wpKjTBLlygXWOVMpdhWKwLU2DCj7aEB1zrukW5rnWjVCuOuA pIoUJaKbmnFjOMNS2qlIIeHGYj/HHj/WgyYSWla2UUcwNVPkihGZ8MmM4v+FCrUH8+gc oPnASJJcv/RNlwvtxoR0eR3NN78Cu/qJgKQK75xfz9nwVlebA8yl2lJF+DtOxjI1k1HA my927LWUJWGn9CmapZ51hnT/BhUjqONkVF8XChRDJz0UpR/ZETkODOVXTJUbLfkgRg3i pV2g== X-Gm-Message-State: ANoB5plUZPfIjY/qzwfhlX6R71FInONheUl7PggzzeKQ1QCDUffFVcOI oNKqV/2B1EyETgehxEe51J/1hCDF4xIeEbyURkvcAID9Psx4Hg== X-Google-Smtp-Source: AA0mqf6dIohXUC3hDawJCVXyHmlYYQNxBIkwYeFtzWC2GxSYki9sa8e7PNxEQ2BsjjFDTf2t+l02TFE8v5hm82emrdc= X-Received: by 2002:a17:907:cc9c:b0:7bb:8de1:5139 with SMTP id up28-20020a170907cc9c00b007bb8de15139mr28053482ejc.55.1669853036449; Wed, 30 Nov 2022 16:03:56 -0800 (PST) MIME-Version: 1.0 References: <5d0c4e22-80b0-2fd2-ee75-6902da52d121@eastlink.ca> <57e8e248-bb1a-663a-8557-e3fc13f671d4@eastlink.ca> In-Reply-To: <57e8e248-bb1a-663a-8557-e3fc13f671d4@eastlink.ca> From: Bart Schaefer Date: Wed, 30 Nov 2022 16:03:44 -0800 Message-ID: Subject: Re: one time in 20 error To: Ray Andrews Cc: zsh-users@zsh.org Content-Type: text/plain; charset="UTF-8" X-Seq: 28459 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 Wed, Nov 30, 2022 at 5:56 AM Ray Andrews wrote: > > Well, so far the 'timeout' is working 100%, still I myself would sorta > build that in to 'zcurses end'. While in zcurses,it owns all inputs so > on quitting the idea that some input would be 'forwarded' to the > terminal seems strange. Suppose you have a curses program that's controlled from the keyboard, and when you type shift-Q that program calls "zcurses end". Now, you happen to be a 300-words-per-minute typist, so upon hitting Q you instinctively begin typing the first word of the next command that you expect to execute, without waiting for a prompt. Should zcurses swallow up all or part of that command because it "owns" the input? > As you say there are these > 'generated by the terminal' ... but I don't know anything about such > things. Seems to me the terminal receives input, not makes input Everything about ANSI terminal control is unfortunately "in-band": There is only one data stream between whatever program is using the terminal (zsh in this case) and the terminal itself, which (importantly) includes the keyboard. All those weird sequences starting with ^[[ or similar are still sent to (and from!) the terminal via the same stream as the prompt or the output of "ls" or your typing or copy-pasting or whatever. In the "to" direction, the terminal notices ^[[ followed by something, and interprets it as a command (change the color, move the cursor, etc.) instead of as "normal" characters to be displayed. Some of those commands ask the terminal for data (tell me the cursor position, tell me where the mouse was clicked, etc.). In that case data is sent in the "from" direction: the terminal writes ^[[ followed by the requested data, and the program using the terminal is expected to recognize the ^[[ as "not normal" and read it -- but there's nothing else to distinguish that from something that was typed on the keyboard, it's all on the same stream. So unless the program is waiting for one of those ^[[ sequences, it responds as if you typed it. One of Roman's hacks (his skip-csi-sequence function) is to make zsh ALWAYS be "waiting for" one of those sequences, so as to throw it away if it wasn't really requested.