chrisbra / Colorizer

color hex codes and color names
547 stars 30 forks source link

multiple buffers with highlights #4

Closed teschmitz closed 12 years ago

teschmitz commented 12 years ago

I am not using auto_color. Currently, I am just activating Color_Highlight for CSS files.

There is a wee problem when opening multiple CSS files at the same time: I cycled through ColorContrast in file1.css until fg was set to bg. Then I clicked on the file2.css tab. There I found that the X11 colours were shown as solid blocks (fg=bg) but the RGB colours were still at the default contrast setting.

What is the intended behaviour?

I know the contrast setting is a global variable, but I would have expected the contrast toggling to just affect the buffer I'm viewing.

chrisbra commented 12 years ago

On Sun, March 18, 2012 20:01, teschmitz wrote:

I am not using auto_color. Currently, I am just activating Color_Highlight for CSS files.

There is a wee problem when opening multiple CSS files at the same time: I cycled through ColorContrast in file1.css until fg was set to bg. Then I clicked on the file2.css tab. There I found that the X11 colours were shown as solid blocks (fg=bg) but the RGB colours were still at the default contrast setting.

What is the intended behaviour?

I know the contrast setting is a global variable, but I would have expected the contrast toggling to just affect the buffer I'm viewing.

Could it be, that those colors which appeared in both buffers with a solid color (fg=bg) are present in both buffers?

The issue is, that the plugin does not iterate over all defined matches, but for performance reasons only modifies the contrast of those colors that are defined in the current buffer. So the old matches from your file2.css stay with the old contrast setting and have not been modified.

regards, Christian

teschmitz commented 12 years ago

On Mon, 19 Mar 2012 03:05:52 -0700 chrisbra reply@reply.github.com wrote:

On Sun, March 18, 2012 20:01, teschmitz wrote:

I cycled through ColorContrast in file1.css until fg was set to bg. Then I clicked on the file2.css tab. There I found that the X11 colours were shown as solid blocks (fg=bg) but the RGB colours were still at the default contrast setting.

Could it be, that those colors which appeared in both buffers with a solid color (fg=bg) are present in both buffers?

Just tested this again and indeed, this was only the case for colours present in both buffers.

It's not exactly a matter of life and death. ;)

Best Regards, Tarlika Elisabeth Schmitz, Scotland

chrisbra commented 12 years ago

Yes, I don't think this can be fixed from the plugin. Since getmatches() seems to only return local matches from the current buffer. I have no way to apply the matching to colors from other buffers, well except to iterate over all buffers and update the highlighting. This might be slow, however.