Highlight on `rgba` does not fit the standard #15

Closed
suxpert opened this Issue May 21, 2013 · 3 comments

Projects

None yet

2 participants

suxpert commented May 21, 2013

It seems that the alpha value should be a real number like 0.8 (see http://w3schools.com/cssref/css_colors_legal.asp ), but such a value can not be highlighted by this plugin. However, sometimes any integers or even string as the alpha value can be accepted by Colorizer (use the \cT map, because sometimes the \cC command does not work. I don't know why :(. )

BTW, Colorizer use the CursorHold(I) event, hence any modify on the colors can be highlighted only if I wait some seconds, I think it should be better if the highlighting takes place immediately after some modification, like this one does ( https://github.com/lilydjwg/colorizer ), hence I modified the CursorHold into CursorMoved, but the movement in vim then became much slower. Will there be some future version which will solve those problems?

@chrisbra chrisbra added a commit that referenced this issue May 21, 2013
@chrisbra chrisbra rbga() coloring not correct for float value of a
This fixes issue #15
89b1cfe
Owner

Hi LiTuX.!

On Mo, 20 Mai 2013, LiTuX. S wrote:

It seems that the alpha value should be a real number like 0.8 (see
http://w3schools.com/cssref/css_colors_legal.asp ), but such a value
can not be highlighted by this plugin. However, sometimes any integers

A yes, this is true. Fixed it in the github repository.

or even string as the alpha value can be accepted by Colorizer (use
the \cT map, because sometimes the \cC command does not work. I don't
know why :(. )

Please give me examples of wrong colored strings.

BTW, Colorizer use the CursorHold(I) event, hence any modify on the
colors can be highlighted only if I wait some seconds, I think it
should be better if the highlighting takes place immediately after
some modification, like this one does (
https://github.com/lilydjwg/colorizer ), hence I modified the
CursorHold into CursorMoved, but the movement in vim then became much
slower. Will there be some future version which will solve those
problems?

That's why, I didn't use the CursorMoved event. CursorHold(I)
autocommands are therefore a good tradeoff of speed vs. accuracy and
additionally, the InsertLeave autocommand takes care, that at least the
last line the cursor was on in Insert mode will get correctly
highlighted. I don't think I can do any thing more to improve the speed.
This is clearly a Vim issue there.

regards,

Christian

Vollkommenheit kann mit Disproportion bestehen, Schönheit
allein mit Proportion.
-- Goethe, Maximen und Reflektionen, Nr. 1198

suxpert commented May 23, 2013

According to the code, something like rgba(88, 66, 0, 9.9) will be highlighted too (Am I too much trouble :D ).
In the previous version, rgba(88, 66, 0, asdfg) would sometimes be highlighted, but I think it wouldn't exist in this version.

The plugin I mentioned above DO use CursorMoved event, but its speed is acceptable, perhaps we can borrow something from it, to make this one better. :)

@chrisbra chrisbra closed this in 256d92c May 23, 2013
Owner

Hi LiTuX.!

On Mi, 22 Mai 2013, LiTuX. S wrote:

According to the code, something like rgba(88, 66, 0, 9.9) will be highlighted too (Am I too much trouble :D ).
In the previous version, rgba(88, 66, 0, asdfg) would sometimes be highlighted, but I think it wouldn't exist in this version.

The plugin I mentioned above DO use CursorMoved event, but its speed is acceptable, perhaps we can borrow something from it, to make this one better. :)

Can you check, if the latest version works better for you?

regards,

Christian

Frieden ist viel wertvoller als ein Stück Land.
-- Muhamad Anwar Al Sadat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment