Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: (m)-flag for boundary cases
- X-seq: zsh-workers 40872
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: (m)-flag for boundary cases
- Date: Mon, 20 Mar 2017 09:43:33 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=G5QZCq8UGpLOD1796xWUjsWw/3eN0btLwcd5NJkLBcE=; b=EC6A6fvThz2K/5w9PGPKuwwwKN+KqIWE9sk138p3ivBLtmeP/DZXJAI/ji4tgb6dcg fAsiVFw94dhQ9PioyBax2yC38pRiMC/Ip8SqxVg0z1bZZRENWyeT2boEeSTgqNxFkYtO hVcZ1MavpokXmKKlA7ylcZ+znM7ftIhDw5I9MFAdjP0Nm9sRhjl6bB9t45xNQJCWO5e+ g47vD6LsxhDQxEqayOFBtvt+0MenlP3TDdW8Mmro5y+NIYqTGXTGp2g1MRRCZAHQJfoj GyAfMD33IxoqRXZIYbob5ZeZKT9go6aDlV0mIlQ6LPSx2Vp1DBUMucEPRB9w5Sf1FWBX fBVg==
- In-reply-to: <1490020425.2614066.917182456.0E56E387@webmail.messagingengine.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1490020425.2614066.917182456.0E56E387@webmail.messagingengine.com>
On Mar 20, 7:33am, Sebastian Gniazdowski wrote:
} Subject: (m)-flag for boundary cases
}
} Hello,
}
} % a="0x6F220x5B57"
} % echo ${(mr:3::_:)a}
} 0x6F220x5B57
} % echo ${(mr:2::_:)a}
} 0x6F22
}
} I think it would be better to trim first case down to single Asian
} character, and display: 0x6F22_. The point is that it gives predictable
} width.
Try this? Works for characters that are 2 columns wide. If you have
a mix of character widths, probably a custom math function to use in the
subscript ...
dw=3 # Desired width
echo ${(mr:dw::_:)a[1,${(m)#a[1,dw-1]}>dw?dw/2:dw]}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author