From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id D49DD2FF7F for ; Mon, 28 Oct 2024 19:15:38 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1730139338; b=gi811IYPHv3XKHNUbDAyvlXA9UdhrcIEfxyWZxnmljsoX+5VP8TFQDtHjDbtn+hMFpcJgLUP7U gY+3z2UlSQ00pc1eNpFBWM+0coHq75ym1EI8HtDBQcAOQeSMHjAzJdNuwgf4u2FxclKOs3scu6 /+YGixQAfTxZNOKT1fYDG6sTJSmWNEfuPBsFDg/gsygLc6pR896tuNzqkst9Fp/zEFNYbEcVJv 8V/DGyosZlGLZxyd4gFv53Ych9ZDZv/qk2SVFL7QQ4WJLo3Vizc24pM0j9hic6s0hd50KBXVLf 1ZHU6BV6b9V2jOWHkPN9DSw/uxJSFutimI/P2o+36VvI/A==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ed1-f47.google.com) smtp.remote-ip=209.85.208.47; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 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=1730139338; bh=LPTtuSXsRg7RN0w3qM/QzuJibTXDLp5seEODiyOKatk=; 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=ZM95dzNIEH75u+RPNKRnyZp5J/HycF7n9K0kGqvtxz+QzEtvumijr6ePglQn3lDBlCq6Cl+KJC CyTW7x7aJhHjKUSo0aulzNxHvZ4Zae9WIVP5hp4Tay7cf3xsEpJoFoV+HsGy79Z7q+Flte/xjm 1YpKemzjYfuxaC+t7BwxJiGwGL/1jIoqlCKJ9u+ryxD9ZnSYS+tYWsmQrBCDx+kXKij7+f7Ke5 MfSRLmY45ycdtqtpBUUa5p0oNM2pLTZ1xlgIW+dFrOWBe3+wW34bABboH5fN7kwScBtb/b4UeM AvyR4OoufN3TV4bIk7Lq/vfCbsThuAmIbakvwxBoSCHNBA==; 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=oDkGkU0Rt/evTyEGRCJjE+jPelbD1/LLXUcxS4HnbgE=; b=sqtwuGah4ebMiQeW+chWWPf7HK 7Hq9jCfnifKCQcVWGG6JRwr4yiWVWPllXJqSjesNkhu8r0+AgyG2f8RCFD3EXADHA18/PUKAgjfkk B7ux3z2iWah8m0Bm8uZXFA8RqD2rBvpJRsV53IVKJsryqJdsFuuQzSINXeCfaCBVI9nRHRofZF+q1 NDnBowDQ+Pk+kYkbdoMB1lfvkW7VH8Ljajbx98sJcOZRlkBivHsFhSS60pQAY9kWXicgoTFyL9Dt2 fKQkhF5LW+opcIiZnygR5OtFaGYSK3paol76DLrxMxt78nBTRPdt11iZna+ZC4K1qNUDLXueOR/BU 2xdyYpoA==; Received: by zero.zsh.org with local id 1t5UHB-000HVU-V5; Mon, 28 Oct 2024 18:15:37 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f47.google.com) smtp.remote-ip=209.85.208.47; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ed1-f47.google.com ([209.85.208.47]:40313) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1t5UGY-000Gnb-G6; Mon, 28 Oct 2024 18:15:00 +0000 Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-5c940512711so878958a12.1 for ; Mon, 28 Oct 2024 11:14:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20230601.gappssmtp.com; s=20230601; t=1730139298; x=1730744098; darn=zsh.org; 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=oDkGkU0Rt/evTyEGRCJjE+jPelbD1/LLXUcxS4HnbgE=; b=1aChIgnsqMzlbN8JtXFDrDTb7sVBUloBCGzr8LlvoRqazgo1tNJRnbXzSHy5pWhq4G 66tgp0t9d3wixpaZ56bna9w2PXOh5q6xYzSZzl8P2pJe8P2vjTZCUiRlxnKpTH/hgf8L gCIhKP2meouCSRXOgzav1Pk4ILmILzZWYZ9XfPHWxzJFrrD354xf8t3HGewRucSLjK8u 8KMZy4RM1MIDYpbrNIA9eIZ/ErE2sUoShzyWWOYNMmtmZ0kLVHq7G3UTbB3FBqcXlT4/ Et0e0EzlVBgEjMAofG87hH4Qae6e/CFEL43+LHDur9rgvu6bvt2+FdOqFA/UmeteJ+Ol 0ajQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730139298; x=1730744098; 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=oDkGkU0Rt/evTyEGRCJjE+jPelbD1/LLXUcxS4HnbgE=; b=H82LPzUszRJgNro3Zo+/0qHBJM830A0007Sg7U2SW3AuJrzWG4BUfsboazPj8RGQjE uKOdq5k5nDrDvPRZS8m5q+//t5A1NXN4Dnrf/wm1I2Sscz3HIQb5luz2C3oIX9Qmq2Rf kF+t9vZUCHdxzag4kPYNUD+Uxp3Wcqis1QXLQPnsRjPZcxMYKIeQwrxZKexq5Z0JyO7U BXOYAs20NnNV5J1jSNBzqLdGHE1+y9vJwCwicbMTPmz62T7ELlF2e/3E/cer8wwhHcnL b+e6hRVU1Qm2u/26+5Gvw5zDjhjmbYI3XhmvQOYaf9tbUCc3cRZfT0WF/IuTHA1h/5Ci eaqA== X-Gm-Message-State: AOJu0YxIlTCR9jRZhxBFOpCjCvPfDBxZqB7vcm3EX4j+dVMumSWtZTqC Lk8GmPXjHn9O6av/H5AESGswQcpYyN9MJ8Q0boDDMkWGgwJBXhp+IxzVYaeK5jltsv2AYMJmTEi 3Qjy1ypmzXCRHAhYy/IL8KF+w6KNx6ie681GxQm7cx9dqT885nw== X-Google-Smtp-Source: AGHT+IEk4Nbm+gQKbtasNkR6UccKgi/s3nHmOLo38Ktd53FjOnagGUtM5GVqlhtCJVRpm2dpJuVRUUaXRff6JhoYYz8= X-Received: by 2002:a17:907:9608:b0:a99:4a35:2400 with SMTP id a640c23a62f3a-a9de5fa8260mr325153766b.7.1730139297854; Mon, 28 Oct 2024 11:14:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Mon, 28 Oct 2024 11:14:46 -0700 Message-ID: Subject: Re: Foreign Commands Not Appearing in 'history' Array When 'sharehistory' Option is Enabled Until a Command is Entered To: "zsh-users@zsh.org" Cc: Langbart Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 30092 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 Mon, Oct 28, 2024 at 10:35=E2=80=AFAM Roman Perepelitsa wrote: > > I believe the OP is saying that after you execute a command in one > terminal and press ENTER in another terminal, within that second > terminal all widgets that operate on history, such as > history-incremental-search-backward, will see the command, but the > `history` array won't contain it. That would seem to be pretty nearly impossible, because $history is populated by calling the same methods that the widgets use, it's not pre-generated/cached. However, I notice that the OP is doing this: printf "%s\t%s\n" "${(kv)history[@]}" | head -5 The left hand side of that pipe is going to be forked off and might not see the same history list as the parent shell. However, also note from my "longer answer": > First, a history position (the "next" number) has already been allocated = for expansion of the %h prompt escape, and loading from the shared history = would have to somehow fit "above" that. The history number isn't incremented on an empty command, so this situation remains. I just re-read the OP and I don't find the "widgets that operate on history ... will see the command" part? What have I missed?