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,T_SCC_BODY_TEXT_LINE 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 79AB5214FA for ; Mon, 12 Feb 2024 06:00:07 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1707714007; b=oRcmuzptMwWQ/XWOneezFZ9HBWr6WC+907VmSHl4/YYWVi52QIBr0QjpWYnMqjevqy+MsmhbuX kbG1ftr86vAEJtSAaN3Pr1FaNwOpxsVycoz5FinI6ssyKu6o2jyxMlyTWBwGxWBZiIbmIEHIU4 ZnpeQuv0vk7/Ipuz6yI1b1S+7P9G/RcrwSqcIhys403+Wzt4J8YMEiR9WcPKomWKIbKsIVHrWh b95xwO7LF0KY4XNj4cv11xA4ux+SS8Bj5Wz9q9pZGzGqHDTfsGaGbYVW26/DE0dwikvBip/OBb swz+oRT9fQAqgYcRS4xTV24dghWENtYBS+5EyEprGwEhcQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f47.google.com) smtp.remote-ip=209.85.218.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=1707714007; bh=Y2akoQTaVm2Yt3lSMzUN5H7d8UbkLwtKNkQETuHc6XE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature:DKIM-Signature; b=SZmtYumgoJcWhO7s8NrNE7PgRwxLEYFdBG/ZUiBBZlv7k/BF87JAvY4CbehiFtjmLSICaxJW1G /rgaHJQfzp1832MhCunSZ1Katk+9NmRYUJCb45Yd4q7bnFPqulRjRvp3knRDTb2wh8CrRiqAlF z6M90t+JLVU0pUufRxVwBoegNjCqG3fZNIXVqArnd9LdYPrCFPpRxpPbNLSErp3bPvICEgtY2C d2q0Yoc+hj4UmOWG/4J9YR5YWRFSyOB25z6KP6LVc0scKAsssBu6XQP1gsQ3hXSQgoarN6yN2A jaM2+yD3MOsiYoWmM40/VwGWEmk556EJ/GX77Lq5gEZGlw==; 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:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=zj/lExMssgcE0xyg2aN1beSi8JB/iCZ+8/b06P1SLBY=; b=U6EaKprBhJuqnIrKHq8iUWMjDv Wu3LK/b7yEiTGkFWKknG7B4oj2M6/s2yYjjlUSkGsr9NlnQp7/HrB1wvDfVWimwenTRwFI7Y9qLOS dKlPL009hRPZfPmlwDJ4muslSYSXIL4gNeXvz5fQfO7E8CWZISZ7XEGBKw8v+DpnE1LN9EBDOsl1j BR2idV+e7Xw20kus5Wc5GV8r4W6ui0xfiaoyFCRsjV0O1bJqOufoPJQVwkCJu7Zxj0lW0ofpTkaL4 az9OOgIbgoANPdzLAWVRdI5QrGhsFg8WVNvs7Kp42D0iyom4ZMMXHCuGbuqAmkAZOwk7L/BIDw0bb Q2X1nN1g==; Received: by zero.zsh.org with local id 1rZOQJ-000P0A-74; Mon, 12 Feb 2024 05:00:07 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f47.google.com) smtp.remote-ip=209.85.218.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-ej1-f47.google.com ([209.85.218.47]:49590) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rZOPx-000OgK-6v; Mon, 12 Feb 2024 04:59:46 +0000 Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a26f73732c5so371250566b.3 for ; Sun, 11 Feb 2024 20:59:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20230601.gappssmtp.com; s=20230601; t=1707713984; x=1708318784; darn=zsh.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zj/lExMssgcE0xyg2aN1beSi8JB/iCZ+8/b06P1SLBY=; b=MLGtMyuFY6XoWB6b9EVB5ZPaGs+9ruMyx8ASNDqqNfCcBlQrZa1GDcLFnZhExwatp2 SbFjbRff/8DHddA21D5uPWmzLW+L8bo2U0qc8AYf+8PsQx6vC2AXKFgsBpPSDa21j13T R3OAtHvFm0kmeIKn9cnxbRa5tao12wCzA5vKu8MtEuybmB0xdiFBuHPKsZhBR/CkJxyB tzlB8nJbNoV5NCikK7dc2ErIgo/+yg7c299LAR0rBKVrzfwYPv/ZjdZKJ2b92ZsGvuZy eLbfGa7EfsfWHlTOjJZgWUWlykM5cCN8kfZC9hSJLD3H2ctVdsQIaTp61xxQtHQWkv8W 0zPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707713984; x=1708318784; h=content-transfer-encoding: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=zj/lExMssgcE0xyg2aN1beSi8JB/iCZ+8/b06P1SLBY=; b=eO2NSbhvY9x/VCYepEO5jzbQFG1RUtCVSvdVxuY85uagQaJUh7c41tmxiphunzWP8f rvWmD+lsqK31K9Igaoli3aThry8RsXCijcf4bqE7nzfDkxPb6KRX2z308UDbQ3rJcsXo hPASuCE09v+kEEZFG1iwtjezltJoDYXWOyQfJ17KEqh1sHMpbl7szLA35OCSi/vSfq+m yacT9a7ff4WVduwACv1b8eYTNY9463npqAJo++UWzZdeEb/CQNSzSpDo168hCSXqLcUM uKv/sL/vJQhQ71wtSAgflffS5ZPznmz7TUkgRnvw+G4Vtyq1I3BxY0XrotxL1KW+KD0y T+sw== X-Gm-Message-State: AOJu0YylAFqCvzAvCP9WhA5oaFpUJIcOxwKCdQNHaimoxNjAv0e3F1pt bg/JdmyAqU9p/AAErvWBwZCRf2RvEDkpkYsl+h2gmGhuZ2JCLQXyNo4eHbnYSHkouQNASYRvcww xZ5MyTQAxiDPF+7K4a9yIdl3RAec8f29pKBK7gdVMYkSvEYQ= X-Google-Smtp-Source: AGHT+IEWXo1yXsLFHuSqwX6fM0PnPWhOMpHDCH+As66TTxWK8LYjzopki1fYa9t4SPjHaVII4b8OsUqHmzYrrnaXPmA= X-Received: by 2002:a17:906:ae53:b0:a3c:ab39:a132 with SMTP id lf19-20020a170906ae5300b00a3cab39a132mr778084ejb.50.1707713984136; Sun, 11 Feb 2024 20:59:44 -0800 (PST) MIME-Version: 1.0 References: <84864-1707708370.319024@8kOf.oEra.sYsr> In-Reply-To: <84864-1707708370.319024@8kOf.oEra.sYsr> From: Bart Schaefer Date: Sun, 11 Feb 2024 22:59:32 -0600 Message-ID: Subject: Re: PATCH: alternate views on .zle.hlgroups To: Zsh workers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 52534 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: I don't do much with zle_highlight so I have only general comments ... On Sun, Feb 11, 2024 at 9:26=E2=80=AFPM Oliver Kiddle wrote: > > This implementation uses dupstring() to return memory from the parameter > string get function. The unset functions generally expect to free the memory from the parameter value, but since these are readonly specials it's probably safe to use the heap (see below). I don't know what oddities might arise from declaring a "local +h" on these names. > Would be good to have > confirmation from someone who has a clearer understanding of what the > lifetime of the memory pools is. There can be a stack of pools so the one that gets used will be the one that's active at the time the parameter is referenced. Assigning the value to another parameter will copy the value, not point to it, so the only iffy bit is whether the getfn refreshes the u.str pointer every time the variable is referenced. I believe there's a new pool during zle widgets, for example, so if you reference one of these both inside a call to "zle user-defined-thing" and then again after zle returns, this could be tickled. > My second thought was support for parsing terminal responses to the > escape sequence for getting the background colour. [...] > very helpful to avoid unreadable colour combinations. What form should > this best take? A builtin? Having a key bound to \e]11;rgb: may be > the best way to avoid interference with a type-ahead buffer but that > inconveniently move the setup code to a zle widget. ungetc() in C may > work better than my current print -z solution, especially where some of > the typeahead text is not even intended for zsh. The shell input is unbuffered** and managed by the shell itself, so I don't know if ungetc() works at all. There are no calls to ungetc remaining in Src/*.c, they all use either ihungetc() or inungetc() via the hungetc code pointer. So I think if there's input not intended for zsh you, either mustn't read it at all or there's nothing you can do about it. I'd use "zle -U" rather than "print -z" (or choose one or the other based on context if "zle -U" isn't always usable at the time). I suppose you do need to account for -U being LIFO, but -z is the buffer stack so popped one entry at a time so probably also won't do the right thing if called more than once successively. **Where support-able, else line buffered.