[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Exposing wcwidth(3) as a built-in function
From: |
Arnold Robbins |
Subject: |
Re: [bug-gawk] Exposing wcwidth(3) as a built-in function |
Date: |
Thu, 21 Jun 2018 21:02:55 +0300 |
User-agent: |
Heirloom mailx 12.5 6/20/10 |
Hi.
If you want to use gawk, there is a new "mbs" extension in
gawkextlib that provides an mbs_wcswidth function to compute
the width of a string. So far it's been tested on Linux and Cygwin.
Thanks,
Arnold
> Date: Fri, 1 Dec 2017 08:41:25 -0800
> From: Eric Pruitt <address@hidden>
> To: address@hidden
> Subject: Re: [bug-gawk] Exposing wcwidth(3) as a built-in function
>
> On Tue, Nov 28, 2017 at 11:34:30PM -0800, Eric Pruitt wrote:
> > I was able to create a working wcwidth function in pure AWK script
> > without converting characters to numeric codepoints by (ab)using lexical
> > comparisons. I have no clue how portable this is. I've attached the
> > generated file in the event that it might be useful to someone else.
>
> I decided to make a less hacky, portable version of the wcwidth
> function. The rewritten script is much smaller, and it doesn't kill the
> MAWK parser like its predecessor. Lookups are done using a binary search
> on a table that is lazy-loaded at runtime. I've attached the updated
> script to this email, but the canonical repository is
> https://github.com/ericpruitt/wcwidth.awk .
>
> Last update on this, I swear ;).
> Eric
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [bug-gawk] Exposing wcwidth(3) as a built-in function,
Arnold Robbins <=