Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: (m)-flag for boundary cases



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