[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Exposing wcwidth(3) as a built-in function

From: Eric Pruitt
Subject: Re: [bug-gawk] Exposing wcwidth(3) as a built-in function
Date: Fri, 1 Dec 2017 08:41:25 -0800
User-agent: NeoMutt/20170113 (1.7.2)

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 ;).

Attachment: wcwidth.awk
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]