Shougo / pum.vim

Original popup completion menu framework library
MIT License
110 stars 19 forks source link

highlight_columns offset is wrong #46

Closed 4513ECHO closed 1 year ago

4513ECHO commented 1 year ago

Problems summary

highlight_columns offset is wrong.

Expected

It should be rendered without overhanging highlights.

Environment Information (Required!)

Neovim ``` NVIM v0.10.0-dev-713+gf2ce31d3d-Homebrew Build type: Release LuaJIT 2.1.0-beta3 Run ":verbose version" for more info ```
Vim ``` VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Jul 09 2023 01:38:28) macOS 版 - arm64 適用済パッチ: 1-1677 Compiled by Homebrew Huge 版 without GUI. 機能の一覧 有効(+)/無効(-) +acl +cmdline_hist +ex_extra +jumplist +mouse_dec +perl +sodium +textobjects +wildmenu +arabic +cmdline_info +extra_search +keymap -mouse_gpm +persistent_undo +sound +textprop +windows +autocmd +comments -farsi +lambda -mouse_jsbterm +popupwin +spell +timers +writebackup +autochdir +conceal +file_in_path +langmap +mouse_netterm +postscript +startuptime +title -X11 -autoservername +cryptv +find_in_path +libcall +mouse_sgr +printer +statusline -toolbar -xfontset -balloon_eval +cscope +float +linebreak -mouse_sysmouse +profile -sun_workshop +user_commands -xim +balloon_eval_term +cursorbind +folding +lispindent +mouse_urxvt -python +syntax +vartabs -xpm -browse +cursorshape -footer +listcmds +mouse_xterm +python3 +tag_binary +vertsplit -xsmp ++builtin_terms +dialog_con +fork() +localmap +multi_byte +quickfix -tag_old_static +vim9script -xterm_clipboard +byte_offset +diff +gettext +lua +multi_lang +reltime -tag_any_white +viminfo -xterm_save +channel +digraphs -hangul_input +menu -mzscheme +rightleft -tcl +virtualedit +cindent -dnd +iconv +mksession +netbeans_intg +ruby +termguicolors +visual -clientserver -ebcdic +insert_expand +modify_fname +num64 +scrollbind +terminal +visualextra +clipboard +emacs_tags +ipv6 +mouse +packages +signs +terminfo +vreplace +cmdline_compl +eval +job -mouseshape +path_extra +smartindent +termresponse +wildignore システム vimrc: "$VIM/vimrc" ユーザー vimrc: "$HOME/.vimrc" 第2ユーザー vimrc: "~/.vim/vimrc" ユーザー exrc: "$HOME/.exrc" デフォルトファイル: "$VIMRUNTIME/defaults.vim" 省略時の $VIM: "/opt/homebrew/share/vim" コンパイル: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -I/opt/homebrew/Cellar/libsodium/1.0.18_1/include -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 リンク: clang -L/usr/local/lib -o vim -lm -lncurses -L/opt/homebrew/Cellar/libsodium/1.0.18_1/lib -lsodium -liconv -lintl -framework AppKit -L/opt/homebrew/opt/lua/lib -llua5.4 -mmacosx-version-min=13.3 -fstack-protector-strong -L/opt/homebrew/opt/perl/lib/perl5/5.36/darwin-thread-multi-2level/CORE -lperl -L/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/config-3.11-darwin -lpython3.11 -framework CoreFoundation -lruby.3.2 -L/opt/homebrew/Cellar/ruby/3.2.2_1/lib ```

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

set rtp^=~/Develops/github.com/Shougo/pum.vim

" For visibility
hi def PumKind ctermbg=blue guibg=#0000ff

call pum#set_option(#{
      \ highlight_columns: #{ kind: 'PumKind' },
      \ })

inoremap <Tab> <Cmd>call pum#open(col('.'), [
      \ #{ word: 'hoge', kind: 'Test', menu: '[test]' },
      \ #{ word: 'fuga', kind: 'Test', menu: '[test]' },
      \ ])<CR>

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

  1. Press <Tab> in insert mode.

Screen shot (if possible)

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

Nothing.

uga-rosa commented 1 year ago

Highlight width seems to shift if multibyte characters are included.

inoremap <Tab> <Cmd>call pum#open(col('.'), [
      \ #{ word: 'hoge', kind: '😀😀😀😀', menu: '[test]' },
      \ #{ word: 'fuga', kind: 'TestTest', menu: '[test]' },
      \ ])<CR>

image