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

feat(cursorline)!: add cursorline bg option for visual selection color #101

Closed
wants to merge 6 commits into from
Closed

feat(cursorline)!: add cursorline bg option for visual selection color #101

wants to merge 6 commits into from

Conversation

5-pebbles
Copy link
Collaborator

@5-pebbles 5-pebbles commented Jan 3, 2024

closes #100

  • Add cursorline.bg option with default value of "#191D24".
  • Remove cursorline.theme option.
  • Update docs to reflect new defaults.

BREAKING CHANGE: cursorline.theme option removed, replaced by cursorline.bg.

- Add cursorline.bg option with default value of "#191D24".
- Remove cursorline.theme option.
- Update docs to reflect new defaults.

BREAKING CHANGE: cursorline.theme option removed, replaced by cursorline.bg.
@5-pebbles
Copy link
Collaborator Author

Some time this week, I will create another pull request to allow use of the palette in default options.

@5-pebbles
Copy link
Collaborator Author

Oops it breaks if there is a transparent background, I don't know how those work so give me a while an I will fix it.

@5-pebbles
Copy link
Collaborator Author

Okay, I can't figure out how lua/nordic/colors/init.lua handles transparent backgrounds.

I will try to figure it out tomorrow, but for now this whole thing don't work.

    C.bg = (O.transparent_bg and C.none) or C.gray0

    -- Diffs
    C.diff = {
        change0 = U.blend(C.blue1, C.bg, 0.05),
        change1 = U.blend(C.blue2, C.bg, diff_blend),
        add = U.blend(C.green.base, C.bg, diff_blend),
        delete = U.blend(C.red.base, C.bg, diff_blend),
    }

@5-pebbles
Copy link
Collaborator Author

Does it work?
When I change the default on my local clone of the main, I get the same error as my fork...

@AlexvZyl AlexvZyl added the Enhancement New feature, request or suggestion label Jan 4, 2024
@5-pebbles
Copy link
Collaborator Author

After #103 it should pass tests.

@AlexvZyl
Copy link
Owner

AlexvZyl commented Jan 4, 2024

So it the test actually failed with that bug? Odd, it did not fail on main.

@5-pebbles
Copy link
Collaborator Author

I changed where the options are imported, in mine they are re-imported with each call of setup, I don't really know how Lua imports work but my guess is that they weren't being applied on the second run of setup() in the tests.

@AlexvZyl
Copy link
Owner

AlexvZyl commented Jan 4, 2024

Ah. The options have to be re-imported when extending the palette. Nice catch

@AlexvZyl
Copy link
Owner

AlexvZyl commented Jan 4, 2024

I also want to add callbacks for pre and post extension, but we can do that in a different PR.

@AlexvZyl
Copy link
Owner

AlexvZyl commented Jan 4, 2024

Actually, I am still confused. When you call require, a reference is returned. I will check when I am back form vacation

@5-pebbles
Copy link
Collaborator Author

5-pebbles commented Jan 4, 2024

When I print the options in extend_palette I get the same values for each of the tests.

This pull request should fix that though, accidentally...

Main output:

ts_context = table: 0x7f5cf5e26828
on_palette = function: 0x7f5cf5e263f8
transparent_bg = false
reduced_blue = true
cursorline = table: 0x7f5cf5e26470
swap_backgrounds = false
override = table: 0x7f5cf5e26428
bright_border = false
bold_keywords = false
italic_comments = true
leap = table: 0x7f5cf5e267a8
telescope = table: 0x7f5cf5e26728
noice = table: 0x7f5cf5e266a8

ts_context = table: 0x7f5cf5e26828
on_palette = function: 0x7f5cf5e263f8
transparent_bg = false
reduced_blue = true
cursorline = table: 0x7f5cf5e26470
swap_backgrounds = false
override = table: 0x7f5cf5e26428
bright_border = false
bold_keywords = false
italic_comments = true
leap = table: 0x7f5cf5e267a8
telescope = table: 0x7f5cf5e26728
noice = table: 0x7f5cf5e266a8 

This PR:

swap_backgrounds = false
on_palette = function: 0x7f10031be4b0
ts_context = table: 0x7f1002904758
leap = table: 0x7f10029048d8
reduced_blue = false
cursorline = table: 0x7f1002904a58
transparent_bg = true
override = table: 0x7f1002904ba0
noice = table: 0x7f1002905768
bright_border = false
italic_comments = true
bold_keywords = false
telescope = table: 0x7f10029055e8

swap_backgrounds = true
on_palette = function: 0x7f1002977268
ts_context = table: 0x7f1002909c80
transparent_bg = false
reduced_blue = true
cursorline = table: 0x7f100290a100
telescope = table: 0x7f100290b290
override = table: 0x7f100290a308
noice = table: 0x7f100290b4d0
italic_comments = false
bright_border = true
bold_keywords = true
leap = table: 0x7f1002909ec0

…hen transparent_bg is true."

This reverts commit ea86462.
@5-pebbles
Copy link
Collaborator Author

reverted fix that can be implemented in #105 or a similar pr.

…g is true.

& fix error message colors/init.lua:64: attempt to index global 'O' (a nil value).
@5-pebbles
Copy link
Collaborator Author

Its a good thing you didn't get to merging this because it was broken...

But it should be fixed now.

@5-pebbles
Copy link
Collaborator Author

5-pebbles commented Feb 22, 2024

Also it closes #108 due to change in where the options are imported

@AlexvZyl
Copy link
Owner

Let's come back to this ater #113!

@5-pebbles
Copy link
Collaborator Author

I am closing this in favor of a more general solution to changing the palette & extended palette.

@5-pebbles 5-pebbles closed this Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature, request or suggestion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cursorline option to set visual selection color
2 participants