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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 6246 invoked from network); 23 Oct 2022 22:42:46 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 23 Oct 2022 22:42:46 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1666564967; b=ThFrGGvNJlZliYSUKbTL4m8c6ApG4cUe/9nzkpqi6QosAyMCb863LX1qMW2+JEQqGOt2AEj8uz MVoWr3loy4N12eHmEGrfh9XeDqD0I3Hypj1dJg8e9rRAItMq7NP/sTJGplm2gkVVuRD2l7Gh1G RDoUYdaf3nDWsbInzbxVi17JiHg+h4w+bMi2rt9v1iZYdXHdvlSxn8hV5S7GmcbgywMm776SEz LxRvUpCllvvtApBjoKQDS6uoC98/WsY8T7K7C7dSEtN8Y0sue5ozYainzGbZ5NpqLSCTsJSNLc X+SirDC5uREYlthTA2PJWL+9CH5tY8ggYfBNNCVHwIbGvQ==; 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=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1666564967; bh=xQiA0LAkKBd+vM6SVlmk+xJ6AlCZd1HekZ8/SFPZZEE=; 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:References: In-Reply-To:MIME-Version:DKIM-Signature:DKIM-Signature; b=gPZMd/Z6nIkLMF/vg0zKJISr9+8YpRLmjfixopNKdGJ78NFObslcKtP46MnukBucrdPwIjsA+j GnU3Dn1TY7dWy50VK+SGP0GorNByJpfZldO2ot5rR515+vC7GmI/sb+ltioO4+JLm4fRVLM/xY UOo1QmTeD0iL9RMdyzi1wBMTceBUbDqUBiTSuD/OGZA8hLq58tR4DKU/6VM9WZspdAAuvO+akw M2MUq8nYGXuPZOmIfwAXw4ei7FMQvFvmCoBYmItjC3fnZx0LSHR9AagPOkgSHwNb5VSWiKRLwR korOwNlu9ge61dWM3zlXX14mCNvomPDt/sq/ZG9wD5l8Ow==; 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:References:In-Reply-To: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=XWylpM60ZM+2xiohAa6YQtTY8NAHCz+MNM08521FJng=; b=g5zh9G5fFdThfqVWSflMWpgN95 qw/qKHMj+buwxk9oLQTgtTJaICHubVUbNfEXjUu3AYxEsKPk73xPXmwtdlboaoT/1VXiKEZWppJsJ EvireyrS8iH/utONCmGnAcxdDkP9u28Fwpd7BpZHniJt7Yir24SF2smN/K3Zrng/pPjbejieFGNL+ OtF00/9lptvIZJr2fSUEgoBgmekvm52fSslBMZbf1MeTGG5Q8J+9pq3qPeia/iFPLMQogLP1ETYUp I8pvdrqCvQbdKLbtbnF4j6fzt1SNfkMQBSwSR2GvjqCYLBFsmaCyZDsK/zHziO4g/b9akWT9oAuHw JUCFz0IA==; Received: by zero.zsh.org with local id 1omjg4-000F5F-VF; Sun, 23 Oct 2022 22:42:44 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f47.google.com) smtp.remote-ip=209.85.208.47; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ed1-f47.google.com ([209.85.208.47]:45635) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1omjfo-000Eir-Co; Sun, 23 Oct 2022 22:42:28 +0000 Received: by mail-ed1-f47.google.com with SMTP id a67so25119996edf.12 for ; Sun, 23 Oct 2022 15:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=XWylpM60ZM+2xiohAa6YQtTY8NAHCz+MNM08521FJng=; b=jCWqWRRIlck06SKvvLUZ20RAQLijYlB7BSRo8RBLJFkMw3hBg+Zk9wQMGnAH4xOueS 0XBmQTTomRZSC54jAAQbzZJ+rBxZfw8X/YMzFNJo7sStHHtpxWLqczotMGZsUvJWe36C aJ7NI1lptxYefrCyQ+T/JKztdt/PY1O9POaix9/n6s0Tp2bmt7KGbgc3I+rKjztT9aGY 103HIAXmrBjFrrKM6tihSTa2K36OuwziZ7tBkfVfsEn4pOFJWgeq/TnufBE3HAUhb46y n4fTS/ui2pN48a1NANj9SySyy2idpBVhFtjOOh32XNv1JHdsMLVhCnEuL2PHh9C/SE4f hwtA== 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:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XWylpM60ZM+2xiohAa6YQtTY8NAHCz+MNM08521FJng=; b=MUj18vn1/f87WV9v7/VpFPx8a5EQGM8RDROV68ZZTg9x7HlILXNoU959QfA+EYg377 5tFOg0eHlz0eWQyqrdRSt8QNzI59IYBWXsChL6LH4D4k+em676fIPQMnUbQi+tSmtBlY 4SAux9dr6ecURhGIHnbZ6Bqdn7Hyd4rDr5ALlMN4FvvesQWrASVZ+LCwCgP8DF344sHw kYSYbgsOm/FmlGT95ZYxmlH4R1xuGC4FzSv2l9COqEs/A+F3MEFHgC7niqasKLI1ovcy brMmMKc1GjIrR2OPDtdPhRMNA2bnTUQZyujKy7Gk1y0rPp/qwsMg5DRQBDrWiQZVvc5D QMUg== X-Gm-Message-State: ACrzQf3VDmWL/me5VmnzzbdJfaX4EJx5CgVeVXwUlAKSpJz7eCk86c85 oJifERh3w2BobNnDvtiERhQTYZp9dz1f76Jdk0M= X-Google-Smtp-Source: AMsMyM5jMxsImPjf3HsfAjAZzbkkZ9ME010J5tzJDk4cnPOm5p7xISB4+ShzcUVXA3LEFX8TvREgOMAC0D/UFObb1zU= X-Received: by 2002:a17:907:7294:b0:7a9:8a22:74d4 with SMTP id dt20-20020a170907729400b007a98a2274d4mr260405ejc.139.1666564948076; Sun, 23 Oct 2022 15:42:28 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:906:a8a:b0:7a6:9215:51b7 with HTTP; Sun, 23 Oct 2022 15:42:27 -0700 (PDT) In-Reply-To: References: From: Mikael Magnusson Date: Mon, 24 Oct 2022 00:42:27 +0200 Message-ID: Subject: Re: UNICODE Private Use Area characters in BUFFER To: Roman Perepelitsa Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 50822 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: On 10/23/22, Roman Perepelitsa wrote: > On Sun, Oct 23, 2022 at 6:29 PM Mikael Magnusson wrote: >> >> > Note: Private Use Area characters work fine everywhere else. For >> > example, >> > in PS1. >> >> I'm not sure we have any choice, we have to know how wide every >> character we print is, and presumably there is no defined width for >> them as the characters themselves are not defined. > > All terminals by default display characters from Private Use Area as > narrow. There is no reason to assume this to be the case though, since it is explicitly unstandardized. > Zsh also (correctly) treats them as narrow. For example, you > can do this: > > PS1=$'\uE0B0 ' > > Whether your terminal can render this glyph or not, everything will > work fine. The character will take one column and zsh will know that. Whether or not the terminal uses 0, 1 or 2 spaces for the printed character, it is okay that we print them assuming it uses 1 space, since the user has access to the %{%}%G mechanisms to adjust for it in prompts, this is not possible in the interactive buffer obviously. > A few more tests to show that Private Use Area characters work find in > zsh with the exception that you cannot put then in BUFFER: > > % x=$'\uE0B0' > > % print -r -- ${(m)#x} > 1 > > % print -r -- ${${(%):-$x%1(l.at least 1 column.)}[2,-1]} > at least 1 column > > % print -r -- ${${(%):-$x%2(l..less than 2 columns)}[2,-1]} > less than 2 columns I or anyone else can make a terminal that does something else with these codepoints. (I'm just pointing this out). -- Mikael Magnusson