nvim-navic icon indicating copy to clipboard operation
nvim-navic copied to clipboard

Highlight not applied for last character

Open irfanbacker opened this issue 2 years ago • 4 comments

Screenshot from 2022-07-15 17-52-19 As shown in the above image, There is a last character to which the highlight isn't applied to. Moreover, it seems to apply some other color. This color doesn't show up when navic is removed. I have set bg for all highlights mentioned in the readme as black.

irfanbacker avatar Jul 15 '22 12:07 irfanbacker

Can you share which statusline plugin are you using? Also share the output of set statusline?

SmiteshP avatar Jul 17 '22 07:07 SmiteshP

I'm using lualine along with navarasu/onedark.nvim theme.

Output of set statusline:

statusline=%{%v:lua.require'lualine'.statusline()%}

irfanbacker avatar Jul 20 '22 07:07 irfanbacker

Hey! Are you still facing this issue? Try keeping only nvim-navic as a component in lualine and then see if it is occuring? What is the output for lua require'lualine'.statusline() ?

SmiteshP avatar Sep 04 '22 07:09 SmiteshP

This still happens for me. I tried deleting all components after nvim-navic (so it is the only component on the line) and it still appears.

SethBarberee avatar Sep 07 '22 00:09 SethBarberee

I'm seeing this issue as well with lualine. It seems related to the padding. I have temporarily fixed this by applying a 0 padding on the right side after the navic output:

lualine_c = {
    { 'filetype' },
    { 'filename' },
    {
        navic.get_location,
        cond = navic.is_available,
        padding = { left = 1, right = 0 },
    }
}

rodneykeeling avatar Nov 04 '22 20:11 rodneykeeling

issue is apparent specially on slanted styles

metaory avatar Mar 08 '23 05:03 metaory

Sorry for being so late, but I looked into this... And yep, its an issue with how lualine is handling the padding. For some reason it is applying incorrect colour for the space character in padding. Should be issue on lualine's repo.

SmiteshP avatar Apr 14 '23 21:04 SmiteshP

I had the same issue, the string that nvim-navic get_location() returns for the statusline includes "%* <some_text> %*" at the end, that is used to reset the highlighting to the default one, which is named "StatusLine". That different color is the "guibg" field of this "StatusLine" global highlight. I don't know if there's a better fix, for now I simply set this bg field to the required color, in your case, since you're making the background black, it would be like this:

vim.cmd("highlight StatusLine guibg=#000000")

For those who'd like to make it blend with lualine's background:

-- Get current lualine theme
local curr_theme = require('lualine.themes.your_theme_name')

-- Get the background color for the section that you put nvim-navic into,
-- here I am getting it for the normal mode since for me it's the same
-- for all modes, you can adjust accordingly if yours differ
local sec_bg = curr_theme.normal.c.bg

-- Update StatusLine highlight's guibg field
vim.cmd(string.format("highlight StatusLine guibg=%s", sec_bg))

furkan-altintas avatar Nov 29 '23 16:11 furkan-altintas