Shougo / ddu.vim

Dark deno-powered UI framework for Vim/NeoVim
MIT License
292 stars 23 forks source link

mismatched highlight in ddu-column #91

Closed kamecha closed 9 months ago

kamecha commented 9 months ago

Warning: I will close the issue without the minimal init.vim and the reproduction instructions.

Problems summary

highlights set by the each column plugin does not work well.

Expected

each highlights is set correctly.

Environment Information

Provide a minimal init.vim/vimrc without plugin managers (Required!)

Firstly, you have to clone this repository and install nerdfont. this repository is created for testing ddu-column.

https://github.com/kamecha/ddu-column-test

and write vimrc like bellow. ( the vimrc is included in ddu-column-test as min.vim)

" Your minimal init.vim/vimrc
set rtp+=~/.cache/dein/nvim/repos/github.com/vim-denops/denops.vim

" ddu
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu.vim
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-ui-ff

set rtp+=~/workspace/Plugin/ddu-column-test

filetype plugin indent on

" setting for ddu
let s:ddu_setting_json =<< trim END
{
    "ui": "ff",
    "sources": ["otameshi"],
    "sourceOptions": {
        "_": {
            "columns": ["icon", "icon"]
        }
    }
}
END

call ddu#custom#patch_global(s:ddu_setting_json->join('')->json_decode())

nnoremap <silent> <Leader>d <Cmd>call ddu#start()<CR>

" filetype(ddu-ff) setting

autocmd FileType ddu-ff call s:ddu_ff_setting()

function s:ddu_ff_setting()
    nnoremap <buffer><silent> q
                \   <Cmd>call ddu#ui#do_action('quit')<CR>
    nnoremap <buffer><silent> e
                \   <Cmd>call ddu#ui#ff#do_action('expandItem', #{ mode: "toggle" })<CR>
endfunction

How to reproduce the problem from neovim/Vim startup (Required!)

  1. start vim
  2. type \ d for start ddu. (\ or specified <Leader> key)
  3. in ddu window, highlight is sed incorrectly

Screenshot (if possible)

image

Upload the log messages by :redir and :message (if errored)

kamecha commented 9 months ago

I think the white space between each column should be none.

Shougo commented 9 months ago

I think the white space between each column should be none.

No. It is feature.

Shougo commented 9 months ago

OK. Reproduced. You must use strlen() instead of strdisplaywidth(). Because Vim/neovim highlight is length instead of width!

kamecha commented 9 months ago

sorry I didn't understand the specifications of the highlight. From now on I will use strlen().

kamecha commented 9 months ago

using strlen() the column viewed like bellow. image

the highlight is correctly set. Thankyou! 👍

Shougo commented 9 months ago

I have updated the documentation. width may be confused. Sorry.

And I have added the padding for it.