On Sun, Jun 04, 2017 at 06:15:10PM +0200, Hiltjo Posthuma wrote:
> On Sun, Jun 04, 2017 at 05:25:36PM +0200, Arkadiusz Hiler wrote:
> > This escape sequence comes from  xterm and derivatives and allows
> > terminal to change cursor color.
> > 
> > In xterm it supported only #RRGGBB color format, but starting with rxvt
> > it allows to change the color using indexes from the color table.
> > 
> > We support only color indexes.
> > 
> > Use: echo -ne "\033]12;$COLOR_INDEX\007"
> > Where $COLOR_INDEX is index of color in colorname[]
> > ---
> >  st.c | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> > 
> > diff --git a/st.c b/st.c
> > index 8d4a9f2..1e9b92e 100644
> > --- a/st.c
> > +++ b/st.c
> > @@ -1897,6 +1897,20 @@ strhandle(void)
> >                             redraw();
> >                     }
> >                     return;
> > +           case 12:
> > +                   if (narg == 2)
> > +                   {
> > +                           int j = atoi(strescseq.args[1]);
> > +
> > +                           if (j >= 0 && j < sizeof(colorname))
> 
> I've not tested the patch, but I think this line should be:
> 
> > +                           if (j >= 0 && j < sizeof(colorname) / 
> > sizeof(*colorname))

Indeed, my bad. Tested it with above change and works well.

> > +                           {
> > +                                   defaultcs = j;
> > +                                   redraw();
> > +                                   return;
> > +                           }
> > +                   }
> > +                   fprintf(stderr, "erresc: invalid OSC 12 use");

Also added missing \n at the end.

I will send a reply with fixed patch, thanks.

-- 
Cheers,
Arek

> > +                   return;
> >             }
> >             break;
> >     case 'k': /* old title set compatibility */
> > -- 
> > 2.13.0
> > 
> > 
> 
> -- 
> Kind regards,
> Hiltjo
> 

Reply via email to