Subject: Re: bug#58379: 29.0.50; eww: can't align table row

From: Yuan Fu <[email-masked]>
Date: Tue, 11 Oct 2022 13:01:41 -0700

Jean Louis <[email-masked]> writes:

> * Lars Ingebrigtsen <[email-masked]> [2022-10-08 16:45]:
>> Jean Louis <[email-masked]> writes:
>> 
>> > It would be good to have proper eww table rendering.
>> 
>> The Emacs display engine doesn't support flowing text around images --
>> an image is just one very big character, so you can't have two lines of
>> text next to an image.
>> 
>> So shr just puts all images in tables after tables.
>
> Closing the bug does not make it less bug. Please do not close.
>
> I have researched today and found that Telega can splice images and
> thus show very nicely image and text next to each other, including in
> multiple lines.
>
> Would that not be good improvement in Emacs to be able to display
> image and text side by side?
>
> I suggest looking into Telega, as the trick that author uses is
> splicing images. I can see chars side by side to the image and image
> appears very correctly and is scrollable.
>
> ;; Author: Zajcev Evgeny <[email-masked]>
> ;; Created: Wed Nov 30 19:04:26 2016
> ;; URL: https://github.com/zevlg/telega.el
>
> telega-ins--image-slices is a byte-compiled Lisp function in
> ‘telega-ins.el’.
>
> (telega-ins--image-slices IMAGE &optional PROPS SLICE-FUNC)
>
> Insert sliced IMAGE at current column.
> PROPS - additional image properties.
> SLICE-FUNC - function called after inserting slice. Called with
> single argument - slice number, starting from 0.
>
> I do not understand the code yet. It would be nice if somebody can
> help on this to become able to construct image and text on the side.

Telaga can do that because it uses fixed-width characters, so everything
aligns nicely. As far as I know shr uses veriable-width characters so
the same is much harder to do in shr, not to mention that telaga only do
this for the profile image on the beginning of a line, whereas shr needs
to handle complicated layout, like tables.

Yuan