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

drawwhitespace: Cache whitespace location #1030

Merged
merged 3 commits into from
Jun 16, 2022

Conversation

Guldoman
Copy link
Member

This adds Highlighter:update_notify which should help plugins to keep track of retokenized lines.

Now whitespace position and replacements are cached. The cache is invalidated on font change.

In some cases this gives a nice performance boost. For example use this config:

config.plugins.drawwhitespace = {
  show_middle_min = 2,
  substitutions = {
    {
      char = " ",
      sub = "·",
      show_trailing = false,
    },
    {
      char = "\t",
      sub = "»",
    },
    {
      char = " ",
      sub = "",
      show_leading = false,
      show_middle = false,
      show_trailing = true,
      trailing_color = style.error,
    },
  },
}

and open the README on the plugins repo.
Scrolling should feel way smoother. Also try repeatedly pressing home then end on a long line.

Guldoman added 2 commits June 11, 2022 06:21
This is helpful for plugins that need to know when a line has been 
retokenized.
@jgmdev
Copy link
Member

jgmdev commented Jun 15, 2022

Tested but now doing runtime config changes doesn't takes place as before, one needs to close currently opened documents and reopen them for config changes to take place:

Mainly the show leading, middle and trailing, doesn't works from settings gui and shouldn't also from the user init.lua:
2022-06-15_15:47:43

@jgmdev
Copy link
Member

jgmdev commented Jun 16, 2022

With latest commit it is now working again on runtime config changes, merging!

@jgmdev jgmdev merged commit 380cfb9 into lite-xl:master Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants