Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all colors from the current theme are being used #1198

Open
acidrums4 opened this issue Jul 26, 2024 · 4 comments
Open

Not all colors from the current theme are being used #1198

acidrums4 opened this issue Jul 26, 2024 · 4 comments
Labels
lua:lexer lua meta:help-wanted Good for developers with limited familiarity with the codebase.

Comments

@acidrums4
Copy link

acidrums4 commented Jul 26, 2024

Problem

There's something since 0.9 going on and it's bugging me out a bit: some (text) colors set in the current theme are not being used by vis.

I've noticed this specially with HTML files - for example, the HTML attributes are being painted with a color set for the shell/terminal emulator, green, rather than the colors set in the vis theme. No matter what theme is used, those are always being painted with the green color set for the shell/terminal emulator.

On the other hand, tabs are being painted with the default text color set in the vis theme rather than the color set by lexers.STYLE_WHITESPACE.

Steps to reproduce

  1. Use vis-0.9
  2. Open an HTML file
  3. Show tabs with set showtabs
  4. Set whatever theme for vis, even a default theme like solarized or zenburn

vis version (vis -v)

vis 0.9 +curses +lua +tre +acl

Terminal name/version

konsole 24.05.2

$TERM environment variable

xterm-256color

@rnpnr
Copy link
Collaborator

rnpnr commented Jul 26, 2024

I've known about this for a while but I haven't invested the time to write a proper fix. There is an old assumption here:

vis/ui.h

Line 37 in 2d87fdc

UI_STYLE_LEXER_MAX = 64,

that the number of lexer styles is small but in new scintillua that does not seem to be the case. The function for defining styles returns a bool status but that is never checked in the lua code. HTML probably has more styles than the maximum and so a lot of them are just not getting stored and failing silently.

(Below is an outline of what I think should be done, I'm leaving it here as a good first issue for someone else to solve).
UI_STYLE_LEXER_MAX should be increased and the lua code should check if it actually succeeds in defining the style. The maximum style id that gets defined should also be stored somewhere accessible from lua so that users/plugins that want to define their own styles know which slots are available. Also a test should be written that loops through the lexers and checks that they can successfully define all their styles (plus some headroom for users/plugin authors).

@rnpnr rnpnr added meta:help-wanted Good for developers with limited familiarity with the codebase. lua lua:lexer labels Jul 26, 2024
@dcallea
Copy link

dcallea commented Sep 24, 2024

I've known about this for a while but I haven't invested the time to write a proper fix. There is an old assumption here:

vis/ui.h

Line 37 in 2d87fdc

UI_STYLE_LEXER_MAX = 64,

that the number of lexer styles is small but in new scintillua that does not seem to be the case. The function for defining styles returns a bool status but that is never checked in the lua code. HTML probably has more styles than the maximum and so a lot of them are just not getting stored and failing silently.

(Below is an outline of what I think should be done, I'm leaving it here as a good first issue for someone else to solve). UI_STYLE_LEXER_MAX should be increased and the lua code should check if it actually succeeds in defining the style. The maximum style id that gets defined should also be stored somewhere accessible from lua so that users/plugins that want to define their own styles know which slots are available. Also a test should be written that loops through the lexers and checks that they can successfully define all their styles (plus some headroom for users/plugin authors).

Something about whitespace handling seems to be inherently off, as this occurs with all filetypes i tested so far. Even increasing UI_STYLE_LEXER_MAX does not help.

@fre3nando
Copy link

the HTML attributes are being painted with a color set for the shell/terminal emulator, green, rather than the colors set in the vis theme

Setting lexers.STYLE_ATTRIBUTE on my theme allowed me to change the colors of HTML attributes. Is this a theme issue then?

@acidrums4
Copy link
Author

Setting lexers.STYLE_ATTRIBUTE on my theme allowed me to change the colors of HTML attributes. Is this a theme issue then?

I'd like you to share your theme then, as I haven't been able to replicate that - as said, not even the default themes that are shipped with vis are using the colors set in the theme. Everyone paints HTML attributes with the same green from the terminal emulator theme (and "unknown" tags like <svg> with the same red from the terminal emulator theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lua:lexer lua meta:help-wanted Good for developers with limited familiarity with the codebase.
Projects
None yet
Development

No branches or pull requests

4 participants