Skip to content

Commit

Permalink
Add force update for recoloring
Browse files Browse the repository at this point in the history
  • Loading branch information
boatbomber committed Feb 10, 2022
1 parent 820d442 commit 7e1d8be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ local function SanitizeControl(s: string): string
return string.gsub(s, "[\0\1\2\3\4\5\6\7\8\11\12\13\14\15\16\17\18\19\20\21\22\23\24\25\26\27\28\29\30\31]+", "")
end

local function highlight(textObject: Instance, src: string?)
local function highlight(textObject: Instance, src: string?, forceUpdate: boolean?)
src = SanitizeTabs(SanitizeControl(src or textObject.Text))
if LastText[textObject] == src then
if forceUpdate ~= true and LastText[textObject] == src then
return
end
LastText[textObject] = src
Expand Down Expand Up @@ -188,7 +188,7 @@ local function updateColors(colors: HighlighterColors?)
for _, lineLabel in ipairs(lineLabels) do
lineLabel.TextColor3 = TokenColors.iden
end
highlight(label)
highlight(label, label.Text, true)
end
end
pcall(updateColors)
Expand Down
4 changes: 3 additions & 1 deletion wally.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[package]
name = "boatbomber/highlighter"
description = "RichText highlighting Lua code with a pure Lua lexer"
version = "0.4.3"
version = "0.4.5"
license = "MIT"
authors = ["boatbomber (https://boatbomber.com)"]
registry = "https://github.com/upliftgames/wally-index"
realm = "shared"
include = ["src", "src/**", "wally.toml", "wally.lock", "default.project.json"]
exclude = ["**"]

0 comments on commit 7e1d8be

Please sign in to comment.