On Tue, Nov 08, 2016 at 10:47:24AM +0000, Maxime Coste <[email protected]> 
wrote:
> I've recently added OSC 104 support in http://kakoune.org so reset the color 
> palette on exit,
> this fixes a bug that has been bothering some users for some time, the fact 
> that the palette
> was garbled on exit, and their use of 256 colors in DIR_COLORS was broken.
> 
> This worked nicely with Xterm and VTE based terminals, but rxvt-unicode does 
> not support that
> escape sequence. I believe it should, as it supports changing the color 
> palette, it seems
> being able to reset a color (or the whole palette) to its initial color is a 
> natural side feature.

It's nice to hear that some terminals have standardised on a OSC for
that. I considered it for urxvt many years ago, but as you found out,
it's not easy because urxvt does not even know what the defaults are, and
the resource expense for just that feature didn't seem warranted at the
time. So I shelved the plan.

> The problem is that to get back the default values, we would need to parse 
> again the .Xdefaults
> file, which seems very innefficient, or we should keep the default palette 
> (as modified by
> .Xdefaults) in an array that does not change during runtime.
> 
> Is my analysis correct, what would be the preferred approach ?

Hard to say, it's a trade-off, obviously. The .Xdefaults are already
parsed and do not need to be reparsed, just queried again (which I would
still count as inefficient). If that would result in relatively little
code size increase, I would prefer such an approach, to keep memory down
(for what is essentially a very rare feature).

I.e. if it could be made to reuse existing code, by maybe changing some
code into it's own function and having a reusable interface, I would
greatly prefer this approach, even if it is a bit slower: changing the
whole palette already is a very slow process with potentially many
server turnarounds, so a bit of extra parsing shouldn't matter on modern
machines.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      [email protected]
      -=====/_/_//_/\_,_/ /_/\_\

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

Reply via email to