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=DKIM_ADSP_CUSTOM_MED, 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 5cfe338f for ; Mon, 30 Dec 2019 10:17:49 +0000 (UTC) Received: (qmail 8858 invoked by alias); 30 Dec 2019 10:17: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: 45157 Received: (qmail 16746 invoked by uid 1010); 30 Dec 2019 10:17:41 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f48.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25677. spamassassin: 3.4.2. Clear:RC:0(209.85.166.48):SA:0(-2.0/5.0):. Processed in 2.568017 secs); 30 Dec 2019 10:17:41 -0000 X-Envelope-From: roman.perepelitsa@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.166.48 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:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oAzb6Zv2Ew0JhM5//MP+ui8MIbL6mqccASLbqvnDH1A=; b=EXlX2tu6zxgei3Dl/5w2apkpiMnZ15pUiFEt1WKkqUmpBoPO/KTwY1yqf5DNWSkvsm oC5c0f2a6g+UoCTVCgcqqOh+NLp1ep0yHstNuWx7HCBmx0dLEnOCUN0jcLCb26uTIPEo zK5vcHUiIH+F0bHLEji8HfqIBAsKfi8F0j0jDw7xOD60zpVXfZvIbz/dKkzgWEAs8M4v RfbaQLlM0RD/Tf1om6xIYiS8D5ZBok+SLQBzkILJfcW89Eic8uhkCeMhdlDitTfNFwzD 7er6sJkNbB08Y0bEPEqP9naRSN8XpHb0MYDEiMckWbxctul+KPw6VUhE/9TYDHg57XOJ f4KQ== X-Gm-Message-State: APjAAAUY80Q6Eyb+MkpFHLo0ela7ZNc1F5XQjrhm+YtjgCl/jFM1WGx2 H2Za/R0Vi6NLKJEa2G/o+8IQv+fZBlRNxswr/Zo= X-Google-Smtp-Source: APXvYqw7ifCW+7TOhubCj1U4+k/nzQaJ4T9goPcR1929R7j/2+3ZdW/UJbZns8GL1Wr7i9PQh4xPq+J+FIReHIL3BNI= X-Received: by 2002:a6b:b941:: with SMTP id j62mr46180512iof.168.1577701025138; Mon, 30 Dec 2019 02:17:05 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Roman Perepelitsa Date: Mon, 30 Dec 2019 11:16:53 +0100 Message-ID: Subject: Re: Feature request: italic style in region_highlight To: Sebastian Gniazdowski Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" On Mon, Dec 30, 2019 at 2:30 AM Sebastian Gniazdowski wrote: > > Hi, > it would be nice if the italic escape (\e[3m) would have been > supported in the region_highlight array. Currently supported are only > bold, standout and underline. The escape is widely supported, e.g.: it > works on urxvt out of the box. Zsh sort of supports italicized text through "standout" attribute in ncurses. ncurses translates standout to italicized on some terminals and to negative image on others. % zle_highlight=(default:standout) % export TERM=screen-256color % print -P '%Shello%s' hello % export TERM=xterm-256color % print -P '%Shello%s' hello With TERM=screen-256color standout is italicized while with TERM=xterm-256color it's negative image. The terms "italicized" and "negative image" come from ECMA-48. Note that it doesn't define "standout". When printing text, you can use `colors` from contrib to bypass ncurses. Confusingly enough, in `color` associative array the key for italicized text is "standout" (negative image goes by "reverse"). % autoload -Uz colors % colors % echo "\e[$color[standout]mhello$reset_color" The only difference between $color[standout] and plain `3` is readability. I know which version I prefer. As far as I can tell, there is no way to specify italicized attribute through zle_highlight or region_highlight. zle_highlight allows you to override the default escape sequences used by fg and bg attributes. It seems natural to extend this API to also allow overriding escape sequences used by standout style. Then you would be able to do this: zle_highlight=(default:standout standout_begin_code:'\e[3m' standout_stop_code:'\e[23m') fg_start_code and fg_end_code specify the prefix and the suffix of a single escape sequence. To avoid confusion, I've used begin/stop with standout. It's awkward, as the natural pairing would be start/stop and begin/end. Oh well. Roman.