The change to the Perl overlay handling needs a fixup:

```
commit 1ce5da8f (HEAD -> display-wide-glyphs)
Author: Daniel Hahler <[email protected]>
Date:   Sun Dec 24 12:01:02 2017 +0100

    fixup! squash! overlay: set font only once

diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs
index 6abdaca8..139ed3c4 100644
--- a/src/rxvtperl.xs
+++ b/src/rxvtperl.xs
@@ -240,11 +240,14 @@ overlay::overlay (rxvt_term *THIS, int x_, int y_, int 
w_, int h_, rend_t rstyle
           *rp = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (t2));
         }
       else
-        for (int x = w; x-- > 0; )
-          {
-            *tp++ = 0x0020;
-            *rp++ = r;
-          }
+        {
+          r = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (0x0020));
+          for (int x = w; x-- > 0; )
+            {
+              *tp++ = 0x0020;
+              *rp++ = r;
+            }
+        }
     }
 
   show ();
@@ -346,8 +349,6 @@ void overlay::set (int x, int y, SV *text, SV *rend)
   for (int col = min (wcslen (wtext), w - x - border); col--; )
     this->text [y][x + col] = wtext [col];
 
-  free (wtext);
-
   if (rend)
     {
       if (!SvROK (rend) || SvTYPE (SvRV (rend)) != SVt_PVAV)
@@ -359,6 +360,12 @@ void overlay::set (int x, int y, SV *text, SV *rend)
         this->rend [y][x + col] = SvIV (*av_fetch (av, col, 1));
     }
 
+  for (int col = min (wcslen (wtext), w - x - border); col--; )
+    if (!GET_FONT(this->rend [y][x + col]))
+      this->rend [y][x + col] = SET_FONT (OVERLAY_RSTYLE, THIS->fontset 
[GET_STYLE (OVERLAY_RSTYLE)]->find_font (wtext[col]));
+
+  free (wtext);
+
   THIS->want_refresh = 1;
   THIS->refresh_check ();
 }
```

Please let me know if I should post the whole patch again, and if it
makes sense to you after all.

The code itself could be improved likely, e.g. by moving
SET_FONT/GET_FONT out of the loops etc.


Regards,
Daniel.

On 23.12.2017 20:21, Daniel Hahler wrote:
> Here is another follow-up, which keeps the original font information
> with the ISO14755 popup.
> 
> I am attaching the diff for all 3 patches.
> 
> ```
> commit 2892adc3 (HEAD -> display-wide-glyphs)
> Author: Daniel Hahler <[email protected]>
> Date:   Sat Dec 23 20:12:46 2017 +0100
> 
>     squash! overlay: set font only once
>     
>     rxvt_term::iso14755_51: keep font from original rent_t
>     rxvt_term::scr_overlay_set: only set/find font if not present in rend_t
> 
> diff --git a/src/command.C b/src/command.C
> index 340915fb..e2e9f0f9 100644
> --- a/src/command.C
> +++ b/src/command.C
> @@ -220,7 +220,8 @@ rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, 
> int y, int y2)
>  
>    scr_overlay_set (0, 0, rowcol);
>  
> -  r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r));
> +  r = SET_FONT (OVERLAY_RSTYLE, GET_FONT(r));
> +  r = SET_STYLE (r, GET_STYLE (r));
>  
>    for (int y = 0; y < len; y++)
>      {
> diff --git a/src/screen.C b/src/screen.C
> index dd07ae7b..e7038767 100644
> --- a/src/screen.C
> +++ b/src/screen.C
> @@ -3668,7 +3668,9 @@ rxvt_term::scr_overlay_set (int x, int y, text_t text, 
> rend_t rend) NOT
>    x++, y++;
>  
>    ov.text[y][x] = text;
> -  ov.rend[y][x] = SET_FONT (rend, FONTSET (rend)->find_font (text));
> +  ov.rend[y][x] = rend;
> +  if (!GET_FONT(rend))
> +    ov.rend[y][x] = SET_FONT (rend, FONTSET (rend)->find_font (text));
>  }
>  
>  void
> ```
> 
> On 22.12.2017 04:41, Daniel Hahler wrote:
>> The same makes sense for the overlay used in the Perl bindings (e.g. for
>> scrollback search):
>>
>> ```diff
>> diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs
>> index 3144b951..6abdaca8 100644
>> --- a/src/rxvtperl.xs
>> +++ b/src/rxvtperl.xs
>> @@ -227,16 +227,17 @@ overlay::overlay (rxvt_term *THIS, int x_, int y_, int 
>> w_, int h_, rend_t rstyle
>>              t0 = 0x255a, t1 = 0x2550, t2 = 0x255d;
>>  
>>            *tp++ = t0;
>> -          *rp++ = r;
>> +          *rp++ = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font 
>> (t0));
>>  
>> +          rend_t r_t1 = SET_FONT (r, THIS->fontset [GET_STYLE 
>> (r)]->find_font (t1));
>>            for (int x = w - 2; x-- > 0; )
>>              {
>>                *tp++ = t1;
>> -              *rp++ = r;
>> +              *rp++ = r_t1;
>>              }
>>  
>>            *tp = t2;
>> -          *rp = r;
>> +          *rp = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (t2));
>>          }
>>        else
>>          for (int x = w; x-- > 0; )
>> @@ -326,7 +327,7 @@ void overlay::swap ()
>>        for (int x = ov_w; x--; )
>>          {
>>            text_t t = *t1; *t1++ = *t2; *t2++ = t;
>> -          rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, THIS->fontset 
>> [GET_STYLE (r)]->find_font (t));
>> +          rend_t r = *r1; *r1++ = *r2; *r2++ = r;
>>          }
>>      }
>> ```
>>
>>
>> Regards,
>> Daniel.
>>
>>
>> On 10.12.2017 17:47, Daniel Hahler wrote:
>>> From: Daniel Hahler <[email protected]>
>>>
>>> This keeps the existing font when `rxvt_term::scr_swap_overlay` is used,
>>> instead of setting it anew.
>>>
>>> While this appears to be good in general, it is important for when the
>>> font has been explicitly set to match the previous one, like I am doing
>>> for spaces in my wide-glyphs patchset.
>>> ---
>>>  src/screen.C | 11 ++++++-----
>>>  1 file changed, 6 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/src/screen.C b/src/screen.C
>>> index f3c6d576..85014e40 100644
>>> --- a/src/screen.C
>>> +++ b/src/screen.C
>>> @@ -3598,16 +3598,17 @@ rxvt_term::scr_overlay_new (int x, int y, int w, 
>>> int h) NOTHROW
>>>          t0 = 0x255a, t1 = 0x2550, t2 = 0x255d;
>>>  
>>>        *tp++ = t0;
>>> -      *rp++ = r;
>>> +      *rp++ = SET_FONT (r, FONTSET (r)->find_font (t0));
>>>  
>>> +      rend_t r_t1 = SET_FONT (r, FONTSET (r)->find_font (t1));
>>>        for (x = w - 2; x > 0; --x)
>>>          {
>>>            *tp++ = t1;
>>> -          *rp++ = r;
>>> +          *rp++ = r_t1;
>>>          }
>>>  
>>>        *tp = t2;
>>> -      *rp = r;
>>> +      *rp = SET_FONT (r, FONTSET (r)->find_font (t2));
>>>      }
>>>  }
>>>  
>>> @@ -3638,7 +3639,7 @@ rxvt_term::scr_overlay_set (int x, int y, text_t 
>>> text, rend_t rend) NOTHROW
>>>    x++, y++;
>>>  
>>>    ov.text[y][x] = text;
>>> -  ov.rend[y][x] = rend;
>>> +  ov.rend[y][x] = SET_FONT (rend, FONTSET (rend)->find_font (text));
>>>  }
>>>  
>>>  void
>>> @@ -3687,7 +3688,7 @@ rxvt_term::scr_swap_overlay () NOTHROW
>>>        for (int x = ov.w; x--; )
>>>          {
>>>            text_t t = *t1; *t1++ = *t2; *t2++ = t;
>>> -          rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET 
>>> (r)->find_font (t));
>>> +          rend_t r = *r1; *r1++ = *r2; *r2++ = r;
>>>          }
>>>      }
>>>  }
>>>
>>
>>
>>
>>
>> _______________________________________________
>> rxvt-unicode mailing list
>> [email protected]
>> http://lists.schmorp.de/mailman/listinfo/rxvt-unicode
>>
> 
> 
> 
> _______________________________________________
> rxvt-unicode mailing list
> [email protected]
> http://lists.schmorp.de/mailman/listinfo/rxvt-unicode
> 


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/mailman/listinfo/rxvt-unicode

Reply via email to