Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Better handling of wide glyphs (ask the terminal, not wcwidth)
- X-seq: zsh-workers 39845
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: "Zsh Hackers' List" <zsh-workers@xxxxxxx>
- Subject: Re: Better handling of wide glyphs (ask the terminal, not wcwidth)
- Date: Sat, 5 Nov 2016 15:37:08 -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=lYqs4cMS6/1z+1hHfX5FYqj7/PxAeOtp1ypHQbXiGrc=; b=TDSvvnheYJSUzBMOjef6acfK2BMniHMcrt/Wt7rk/uMc7MTcrpze3IBt1vEcajCt31 m2oBNngEayCqfo0x2elulWISZrfwEppaNdLZQag6VEgdo6bRoRDRsIq0+thzdkG3i3tA OUxbaAr7A/6RvTbok+/o2qnvO3FVpoUTO0FCNvndi1IGqjQ+mfHaGkx5/KLwl8eGHQBP MagfE4hDwmm4u6DOQ2peOHFaCQNcvdIdplMOI/hL1AUqhmof+uukwxZQmzx4TdXWXm8P wIsCxKPP0FHpPd59VL2nGur07/8EYs9iZ7caHNU3Xs6NjWJVxTRw2atgrJED8ygllQNH Av1w==
- In-reply-to: <3126f405-b1a0-b29c-df2b-a3376aabb702@thequod.de>
- 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: <3126f405-b1a0-b29c-df2b-a3376aabb702@thequod.de>
On Nov 5, 11:04pm, Daniel Hahler wrote:
}
} This method gets provided as a shared object then, which allows to
} LD_PRELOAD it (overwriting wcwidth and wcswidth). In this case Zsh
} will use the same method, and everything is fine!
}
} But this shows that there is a problem between Zsh and the terminal,
Just to clarify, you mean the problem "between Zsh and the terminal" is
present even *with* this LD_PRELOAD?
} So I wondered if Zsh could be smarter even without the custom
} wcwidth(3) in LD_PRELOAD: there is CSI 6 n ('\e[6n'), which can be
} used to ask the terminal about the current position.
This is error-prone (network inefficiency/inconsistency may cause it to
fail) and in most cases zsh internals will be asking for the width of
a character that isn't on the screen yet at all, or at least is not in
the position where the cursor is located.
So for this to work we'd have to move the cursor to an innocuous spot
(already difficult enough with terminal variances), print CIS 6, read
the position, print the character we care about, print CIS 6 again,
read again, and finally erase what we just did (with no way to put
back what was overwritten), all while hoping that the network didn't
glitch on us in the meantime. That's a lot of round trips to the
terminal for what might be inside a loop over a long string.
} What do you think?
I think unicode glyphs have been allowed to go entirely overboard. I
blame Sirius Cyberne -- er, I mean, Apple.
A zsh module that reads glyph widths from a config file might be a way
to approach this, plus a utility to generate such a configuration from
the terminal -- sort of a termcap library for glyphs.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author