Fix: string index error causes failed load in kitty#959
Open
mathematicalninja wants to merge 1 commit intocatppuccin:mainfrom
Open
Fix: string index error causes failed load in kitty#959mathematicalninja wants to merge 1 commit intocatppuccin:mainfrom
mathematicalninja wants to merge 1 commit intocatppuccin:mainfrom
Conversation
```lua
local red_green_string = hex:sub(1, 5)
local blue_value = tonumber(hex:sub(6, 7), 16)
```
would read the first 5 digits as red-green and the last digit as blue
then
```lua
ans[accent] = string.format("%s%.2x", red_green_string, blue_value)
```
would format the 6th digit to be 2 characters wide.
So the hex_to_rgb would parse a 7-digit hex code and crash
Collaborator
|
im sorry if this is a stupid question but isn't the (1, 5) including the hash sign at the start of the hex code, so yes it would be a 7 char hex code: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
would read the first 5 digits as red-green and the last digit as blue
then
would format the 6th digit to be 2 characters wide.
So the hex_to_rgb would parse a 7-digit hex code and crash