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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26471 invoked from network); 10 Nov 2022 20:23:30 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 10 Nov 2022 20:23:30 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1668111810; b=B0ynG8WyvMRSh8On+0g1Kmd5HXsw2PxyZC6WiyhrGR6kX50VtcxBKct9Qd7gjoR6Pj5Rs5UAnn I66eEcgcGbTcDgMx8J10oFStVEmjF8UPxjbwn1SSBjAfrZ8SjBpv7Qo57v7YAzKJW4deFo9AcD F782v1COhEHvCxqLaZvKOWT9eZtz/iIKKvLCr/7qRWsaSqVI7R8eVFKDI0s+J7tzZHaoY/u7TT lD1BfedAsxNdLtOMRAvMnfFK5S2xPN4qDyCY4CUHtAfZBTBoOqM6D0VK2oYfeGALnkfhndf9g3 c892RNhbfqSaK93nSX1yZMi/9O1AhpbzsaTBztzhSxcNrw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f54.google.com) smtp.remote-ip=209.85.218.54; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 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=1668111810; bh=ThKYYaiEp/8csj6wV4fksUKGI0mfqfmeCVV6UVctUyo=; 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:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=j6p+27Xk6aLWXXJBsrvk6fKBxXRq5VjEHvvreCGYfJPzrhyRih/tmVFgQsqkWfhjpXUqVAkF39 OZNg8wjmzqsk+x+09JgeWMTnWWcXExsR4226xi7KNfgsl42lu6t8XfPgBiNdAWM87jmsyy/o7S QQGxD0ZeclslpLEUTGO28AGlIEUng86bHXrlojGtOTHP6sMIVwpiHgVvkw1TX4XoB/MvP93hCI i86VR9OCnhsu0qHJDdjV1AiRNPaquVgycUMod2gvn+I5mp6Ch46MLLfYIdW+HbQ4egBRUavnbK bRtmAv4pK9xTNbkt5Lduj6plWj/oBTxq72ExKFq2ebR5AA==; 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:In-Reply-To:References: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=ShadzG00rSC8JISYBXMTsLLTjKfRzM5Pf+YifzKnJMs=; b=KImwIoF0ipOQocjizyM9cXL81M JhOmRX3TEKS/t6yfvlIJZ3+NNDGvmvcNzgWhmSeykJb+oY9gTMK3m6itbEKbqhkMA5nMuBmA5tnP7 SXGNIaflQbRAD034ddEzPclsUb74LfGmm9ogHhtZHGpN9NprjkTwLjRYT6aAW9LIdyPShJgfy2oHA zobI+EdCVCeXGlp5y0Xlg1PueVClcLkzH0FjXzAs3hSa1qI/nRDKqFUJq6oSdyDeHXp4c/A38E4O0 cCpDF3MtHL73U6BgKlzzvmhvLgPHEX8cichEO9Fdi1hz3PER9Pn0idqMf/fQtrL0hnvWrddBKxCNw /W6L+v+w==; Received: by zero.zsh.org with local id 1otE5B-00099c-PC; Thu, 10 Nov 2022 20:23:29 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f54.google.com) smtp.remote-ip=209.85.218.54; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ej1-f54.google.com ([209.85.218.54]:37571) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1otE4J-0008SX-GR; Thu, 10 Nov 2022 20:22:36 +0000 Received: by mail-ej1-f54.google.com with SMTP id ud5so8031014ejc.4 for ; Thu, 10 Nov 2022 12:22:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ShadzG00rSC8JISYBXMTsLLTjKfRzM5Pf+YifzKnJMs=; b=58uPfl5APxG5f04upqO4ErhQZ6kotg75lFjjJSGK9bKSD/vGv5ufNozhtVUm5HpbuS J8ZSA0r5TReTrs5jO23n6Pe3Sd6oZNtQ0TS+8P9BxejKKJba/SMWjlT0pCdtN8LkmjIh GwX/ZvezyorL57TjZDrpNtQQmwE6chBkV/f1VAakWjxAaI1+O8IShKmD7FMBV5VNnUPj J31NJPSvy8Pvoek33Mn+CB2mcAhlZOJjLkvQGgpc+08A4IB+Vk5LFP0An15DHWUP+P2h 8vz/pQYb1I7wRS1XbQCcRGiP1KX8tRSUAXlB2DpmHKCVR5oKEUI2cjSkF6Hc7lcXi9++ ibMg== 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:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ShadzG00rSC8JISYBXMTsLLTjKfRzM5Pf+YifzKnJMs=; b=B1vg46JHRiQMVdd+02C3zUK61SaCWbCFx4xfcqerqvCRvxWySlD8P9O3gj5qGvZ8+S EpH5VoeokjNgRBkx4haogU5o9xqh6QpM3RJFcPF5ghsPElhmXMUaWNsHDsw1nRUxRqbW V6VFYYoiXbRPiLzS3lnkAqzrsa6gWfTDPI1JffJw8/IBuNVu+JpoNJfVjahfnViu7uaE ka2YJ/SuN1QQauOLjfgNz91hREQUNwPeMhsAJJGn230YHqSRYCHccsfgKmZZGbViNQBl XjnGNFQIUWXFaSHyO/Ugz7snB43xkBYce/J8xtIhqUh+N7zQ9e5JhCxtGiDBu5Fp8Ei1 Dsfg== X-Gm-Message-State: ACrzQf2s48UPDzdUPsqCVc6E1LjYvWZnPAlunVcB5pY5GLtNgr4E8axj CBMZm1pjyqVkIJfPjiR51Y8vDDNgBTT+SyFgytZuOA== X-Google-Smtp-Source: AMsMyM4gVhMe1SWdRTSyhHyx5z2l1O/xGbOTWKVwGoyzMwTqgni2k3MzKasmxoMxqAEq2vwniP7KT3xFzwaTanGdCdI= X-Received: by 2002:a17:906:804b:b0:7aa:23ac:608e with SMTP id x11-20020a170906804b00b007aa23ac608emr3718279ejw.450.1668111754965; Thu, 10 Nov 2022 12:22:34 -0800 (PST) MIME-Version: 1.0 References: <549715c2-8b36-8b7e-e3ac-cac02f43dd0f@eastlink.ca> <0a7dbe0d-1554-269a-f420-bfe320c7c838@eastlink.ca> In-Reply-To: <0a7dbe0d-1554-269a-f420-bfe320c7c838@eastlink.ca> From: Bart Schaefer Date: Thu, 10 Nov 2022 12:22:23 -0800 Message-ID: Subject: Re: coloring substitution seems to eat next line. To: Ray Andrews Cc: zsh-users@zsh.org Content-Type: text/plain; charset="UTF-8" X-Seq: 28362 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 Thu, Nov 10, 2022 at 11:28 AM Ray Andrews wrote: > > I'll leave it to more adept people to understand why that's > ever wanted. It's just a quick way to lengthen or shorten arrays when not merely adding elements at the end. > Anyway, I stopped slicing (or did I start slicing? ...) anyway: > > cc[$aa]=( ${cc[$aa]/(#b)((#i)$filter)/$'\e['$color;1m${match[1]}$'\e[0m'} ) > > ... is the now slightly understandable strange output That would only be "strange" if the result in the parens somehow came out as either nothing, or as two or more strings with a space between, but ordinarily the fact that you're doing a single ${cc[$aa]} (regardless of the replacements) would mean you get exactly one element. > I've gotten into the habit of always using the > parentheses just because. Most of the time you want the parens when assigning all the elements of an array at once. You should not use the parens for anything that's meant to be a single string (or number). > BTW I'm not using Roman's '(#M)' syntax because it seems to want to > print all sorts of values to the terminal. That's almost certainly because of > > local MATCH MBEGIN MEND which should never appear except inside a function, and should only appear at the beginning of the function and not inside a loop. > ... I have not idea what '$~' means, but it works. $~foo (or ${~foo} means that the value of $foo should be interpreted as a glob pattern rather than as a literal string.