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.0 required=5.0 tests=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 0bd0d101 for ; Fri, 17 Jan 2020 12:05:49 +0000 (UTC) Received: (qmail 12011 invoked by alias); 17 Jan 2020 12:05:42 -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: 45325 Received: (qmail 8568 invoked by uid 1010); 17 Jan 2020 12:05:42 -0000 X-Qmail-Scanner-Diagnostics: from mail-qk1-f195.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25691. spamassassin: 3.4.2. Clear:RC:0(209.85.222.195):SA:0(-1.8/5.0):. Processed in 5.315669 secs); 17 Jan 2020 12:05:42 -0000 X-Envelope-From: nathanmsidwell@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.222.195 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qnRjPAqXh9vc42S4Kut+68/wYOyEVdvbqo/VL2hqUWw=; b=SbJSIxMVrh+W3exE0OYkNCKgksfQ7jROW0bKdu4kPJtdpi+U9u1n3IRIvPwLa4GlVy 4wIMzm6YmFPx1RFU/cAbF096R+b3anMASABfJLYcyyhSg3nICd6Fr1Itnt+KyrpAKXe+ zPZJerY0SIqvdppdZo8uxUrxbKuzIXkk3+Ghyc40pspZteMhu61adTfVrDZVsJIm2GFd tAKMHpyqJh8kkjQt/Yvm313s3QkUr0YgOScALNAMdc7GaOkgY7Kc1zTH7o4AORYTP3LJ Asesj1oigCv89NKZwEO389ziZWhjvSjGHcMS/Hlpi8rQneVAuWCWoT6FtbxIQydeL6gW e0zw== X-Gm-Message-State: APjAAAUAb2TQHXiFa2w+s8xMt53tEIVh/cTWm/10T05nK9mzdGOrpmkz b2Jpoqqj6wyxn9AJYfPVVCk= X-Google-Smtp-Source: APXvYqwMFKDr0PW7+os4zh2qXy8Xh3FIzh7bWBKwp6GbENq8Scxz3m/0wDGMCR79ICegFLDGRPRyIA== X-Received: by 2002:a37:a656:: with SMTP id p83mr36751981qke.306.1579262702556; Fri, 17 Jan 2020 04:05:02 -0800 (PST) Sender: Nathan Sidwell Subject: Re: unicode in prompt breaks command search To: dana , roman.perepelitsa@gmail.com Cc: zsh-workers@zsh.org References: <6D242ADC-BAEC-450D-B7BC-974988C38066@dana.is> From: Nathan Sidwell Message-ID: Date: Fri, 17 Jan 2020 07:05:00 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <6D242ADC-BAEC-450D-B7BC-974988C38066@dana.is> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit On 1/16/20 8:25 PM, dana wrote: > On 16 Jan 2020, at 15:43, Nathan Sidwell wrote: >> For reasons, I put a multibyte unicode char in $PROMPT, this ends up messing >> with zsh's idea of the current column, as it doesn't understand the display >> width of $PROMPT. > > You need to tell it what it is with the %{/%} and/or %G escape sequences. For > example, all of these are roughly equivalent and let zsh know that アイウエオ > takes up ten columns: > > PROMPT='%10{アイウエオ%}' > PROMPT='%{アイウエオ%10G%}' > PROMPT='%{%2Gア%2Gイ%2Gウ%2Gエ%2Gオ%}' > > %{...%} without a leading digit or embedded %G is zero-width (useful for > invisible escape sequences). > > http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Visual-effects > > (I don't think the behaviour of these sequences has changed since 5.2, but you > can check your zshmisc(1) to be sure) On 1/17/20 3:23 AM, Roman Perepelitsa wrote: > Zsh can figure out how many columns Unicode characters take provided > that you configure locale correctly. The most common reason why Zsh > might think that every byte is one character is because the encoding > in the current locale is not UTF-8. thanks for the pointers! nathan -- Nathan Sidwell