[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 64e25cd: More robust NS hex colour string parsing

From: Mattias Engdegård
Subject: Re: master 64e25cd: More robust NS hex colour string parsing
Date: Sat, 13 Jun 2020 17:39:29 +0200

13 juni 2020 kl. 13.59 skrev Eli Zaretskii <eliz@gnu.org>:

>> except the low bits in some cases on Windows (try "#123")
> I don't think I understand what I should try; please elaborate.

Try (color-values "#123"). The correct result is (#x1111 #x2222 #x3333).
If you get something else on Windows, then that is a bug fixed by the patch.
If the patch doesn't help, then it may be a bug in the patch.

Note that the Windows backend will still discard the low 8 bits in any case; 
(color-values "#123456789abc") will probably return (#x1212 #x5656 #x9a9a). The 
patch doesn't change that.

>> Malformed arguments are now consistently rejected.
> How exactly are they rejected?

In the same way that detected errors were rejected before: as if given an 
undefined colour such as "fuchsia green".

>  I see the return value of
> parse_color_spec, but what happens in its callers, and what happens on
> the Lisp levels when those callers are called?

None of that has changed.

>> Not sure what you mean here. Mind giving a concrete example?
> The first two branches of the 'cond' would always return a list before
> your changes, but after your changes they could return nil if
> color-values-from-numeric-string (not the best name, btw) returns nil
> and the input is of one of the two forms parsed by those two branches.

This is still a tad vague and speculative. Can you give a concrete example of 
an argument that, in your opinion, isn't handled correctly?
As far as I can tell, well-formed arguments yield correct values and others are 
rejected in the same way as before, although error-checking now is less spotty.

I don't particularly like that function name either. What about one of these:


Xlib uses the term 'numerical colour specification', but 
color-values-from-numerical-color-specification is a mouthful even in Lisp.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]