Zsh Mailing List Archive
Messages sorted by:
Re: Better handling of wide glyphs (ask the terminal, not wcwidth)
- X-seq: zsh-workers 39852
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Better handling of wide glyphs (ask the terminal, not wcwidth)
- Date: Sun, 6 Nov 2016 18:54:54 -0800
- 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=nW8zzkUqAojqlgtAFvj80sJ5e/YhG617jgoBlb5Yq4g=; b=w2TRw9IC19NFcUsT3pnO34gtVq90dChKlKeuoQeUcKJCl091+hW5FysB8fhXct+dN/ 7vhGEKf6v6lFLCmsgRyP3jHGAjy65i/YSdfrjPO379mgAJUztsaf8/DI+mjti06PAntw e6dptce4iTBxVl+80aYHURP6Fzy9I7sVw+6kjbQU63EB1sop4veIl3dlg5nFlk8eXSyp o9x04YWjRWJVEWJV79gcpm5oAfpNU/+vU/VC7ACqphYhr8u4L8qJ6stcwWWpPKbPz4XD v786QpZ7qWmc7RjC4VGwN0cDvve1l1yAh6ZTEKLvGoilpOwEAUf2Stq6VRqVj2/TjaZp Nq6g==
- In-reply-to: <firstname.lastname@example.org>
- List-help: <mailto:email@example.com>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <email@example.com> <161105153708.ZM19128@torch.brasslantern.com> <firstname.lastname@example.org>
On Nov 7, 2:09am, Daniel Hahler wrote:
} Where would I have to look / poke to do this for the prompt and ZLE only?
Mostly in Src/prompt.c, surprisingly enough. There are a couple of
routines in Src/utils.c and the code in Src/Zle/complist.c has its
own variants for output with color controls.
} There it should be mostly about chars that are about to be displayed,
} and in this case the "painting in an innocuous spot" is not required at
} all (given that those chars are displayed one by one).
The problem there is that the prompt formatting code needs to be able
to calculate the width before it begins printing, so that it can stop
before printing something that won't fit. Otherwise you run into all
sorts of auto-margin issues that are already bad enough.
And then there's the code used by e.g. zsh-syntax-highlighting which
also needs to compute widths in advance in order to populate the array
of positions where terminal attributes change.
} > a utility to generate such a configuration from the terminal
} How would that work then? Based on the method described above?
Yes, basically the way zkbd works except it wouldn't need to be
} Then it would be a pre-generated cache basically?!
} It might be hard to predict what glyphs are being used in the future
} though, and it is probably rather big.
Yes; if you tried to store them all it'd probably be about the size of
the terminfo database multiplied by the number of fonts. But it could
omit any glyphs that are only 1 column wide, and you'd just need to
generate the tables for the presumably manageable combination of fonts
and terminals that a particular user is commonly using.
} It's also basically a custom wcwidth(3) implementation then, isn't it?
Yes again; but if you can supply the table of glyphs separately then
you don't need to update the linked library every time new glyphs or
fonts are introduced. (I would not be surprised to find a standards
body working on something like this already.)
Messages sorted by: