akiyosi / goneovim

A GUI frontend for neovim.
MIT License
2.41k stars 63 forks source link

Floating window appears at the edge of the window #382

Closed ZOI-dayo closed 2 years ago

ZOI-dayo commented 2 years ago

It not happens on iTerm or nvim-qt, so I think this is the problem of goneovim.

https://user-images.githubusercontent.com/64856587/177034405-ee7c6bea-542a-4c9e-b344-7ca9952fc1c6.mp4

↑ This floating window is provided by Shougo/pum.vim

My environment:

Features: +acl +iconv +tui See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.7.2/share/nvim"

- goneovim: v0.6.2 (installed by brew)

<details>
<summary>~/.config/nvim/init.lua</summary>

```lua
local api = vim.api
local g = vim.g
local o = vim.o
local opt = vim.opt
local keymap = vim.keymap
local fn = vim.fn
function file_exists(name)
  return fn.empty(fn.glob(path)) == 1
end
opt.fenc = 'utf-8'
opt.backup = false
opt.swapfile = false
opt.autoread = true
opt.hidden = true
opt.showcmd = true
-- o.append({["$LANG"] = "ja"})
opt.helplang = 'ja'
opt.number = true
opt.numberwidth = 3
opt.cursorline = true
opt.virtualedit = 'onemore'
opt.smartindent = true
opt.visualbell = true
opt.showmatch = true
opt.laststatus = 2
opt.wildmode = 'list:longest'
keymap.set('n', 'j', 'gj', {silent=true})
keymap.set('n', 'k', 'gk', {silent=true})
opt.whichwrap = 'b,s,h,l,<,>,[,],~'
opt.title = true
opt.list = true
opt.listchars = 'tab:▸-'
opt.expandtab = true
opt.tabstop = 2
opt.shiftwidth = 2
opt.ignorecase = true
opt.smartcase = true
opt.incsearch = true
opt.wrapscan = true
opt.hlsearch = true
keymap.set('n', '<Esc><Esc>', ':nohlsearch<CR><ESC>', {remap = true})
opt.clipboard = 'unnamed'
vim.cmd('augroup source-vimrc')
vim.cmd('autocmd!')
vim.cmd('autocmd BufWritePost *vimrc source $MYVIMRC | set foldmethod=marker')
vim.cmd('autocmd BufWritePost *gvimrc if has("gui_running") source $MYGVIMRC')
vim.cmd('augroup END')
vim.cmd('augroup auto_comment_off')
vim.cmd('autocmd!')
vim.cmd('autocmd BufEnter * setlocal formatoptions-=r')
vim.cmd('autocmd BufEnter * setlocal formatoptions-=o')
vim.cmd('augroup END')
opt.mouse = 'a'
opt.foldenable = false
opt.foldcolumn = "0"
vim.cmd('filetype plugin on')
g.netrw_liststyle = 1
g.netrw_banner = 0
g.netrw_sizestyle = 'H'
g.netrw_timefmt = '%Y/%m/%d(%a) %H:%M:%S'
g.netrw_preview = 1
vim.cmd('augroup readonly')
vim.cmd('autocmd!')
vim.cmd('autocmd BufEnter * if &readonly == 1 | set nomodifiable | else | set modifiable | endif')
vim.cmd('augroup END')
opt.guifont = 'Cica:h14'
opt.printfont = 'Cica:h9'
-- opt.ambiwidth = 'double'
-- vim.cmd('command Term bo terminal')
-- g.ale_disable_lsp = 1
if not (file_exists('~/.config/nvim/autoload/jetpack.vim')) then
  os.execute('curl -fLo ~/.config/nvim/autoload/jetpack.vim --create-dirs https://raw.githubusercontent.com/tani/vim-jetpack/master/autoload/jetpack.vim')
  -- vim.cmd('autocmd VimEnter * JetpackSync | source $MYVIMRC')
end
if not (file_exists('~/.config/nvim/lua/jetpack.lua')) then
  os.execute('curl -fLo ~/.config/nvim/lua/jetpack.lua --create-dir https://raw.githubusercontent.com/tani/vim-jetpack/master/lua/jetpack.lua')
end
require('jetpack').setup {
  'vim-jp/vimdoc-ja',
  'markonm/traces.vim',
  'itchyny/lightline.vim',
  'hallzy/lightline-iceberg',
  'preservim/nerdtree',
  'jistr/vim-nerdtree-tabs',
  'ryanoasis/vim-devicons',
  'mengelbrecht/lightline-bufferline',
  'udalov/kotlin-vim',
  -- 'w0rp/ale',
  'tpope/vim-fugitive',
  -- 'maximbaz/lightline-ale',
  'zoi-dayo/cheatsheet.vim',
  'Yggdroot/indentLine',
  'thinca/vim-quickrun',
  'mattn/webapi-vim',
  'tyru/open-browser.vim',
  'superbrothers/vim-quickrun-markdown-gfm',
  'digitaltoad/vim-pug',
  {'prettier/vim-prettier', run = 'yarn install --frozen-lockfile --production' },
  'vim-denops/denops.vim',
  'Shougo/ddc.vim',
  'Shougo/ddc-matcher_head',
  'Shougo/ddc-sorter_rank',
  'Shougo/ddc-around',
  'Shougo/ddc-nvim-lsp',
  'neovim/nvim-lspconfig',
  'williamboman/nvim-lsp-installer',
  'LumaKernel/ddc-file',
  'matsui54/ddc-buffer',
  'Shougo/pum.vim',
  'vim-skk/skkeleton',
  {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'},
  'ntpeters/vim-better-whitespace',
  'lewis6991/gitsigns.nvim',
  'jghauser/mkdir.nvim',
  "SmiteshP/nvim-gps",
  'j-hui/fidget.nvim',
  'petertriho/nvim-scrollbar',
  'delphinus/skkeleton_indicator.nvim',
  'Shougo/ddu.vim',
  'Shougo/ddu-ui-ff',
  'Shougo/ddu-kind-file',
  'Shougo/ddu-source-file_rec',
  'Shougo/ddu-filter-matcher_substring',
  'Shougo/ddu-source-file_old',
  'ray-x/lsp_signature.nvim',
  'denops-popup-preview.vim',
  'denops-signature_help',
}
-- require ('settings.ale')
require ('settings.ddc')
require ('settings.lightline')
-- vim.cmd('command Jetpack JetpackSync')
vim.cmd("let NERDTreeShowHidden = 1")
vim.cmd('command! Tree NERDTreeTabsToggle')
g.nerdtree_tabs_open_on_gui_startup = 0
if not(file_exists('~/.config/nvim/colors/iceberg.vim')) then
  os.execute('curl -fLo ~/.config/nvim/colors/iceberg.vim --create-dirs https://raw.githubusercontent.com/cocopon/iceberg.vim/master/colors/iceberg.vim')
end
opt.background = 'dark'
vim.cmd('colorscheme iceberg')
g.WebDevIconsUnicodeDecorateFolderNodes = 1

g.indentLine_enabled = 1
g.indentLine_char = '|'

g.quickrun_config = {
  markdown = {
    type = 'markdown/gfm',
    outputter = 'browser'
  }
}

keymap.set('i', '<Tab>', function()
  if(fn['pum#visible']()) then
    return '<Cmd>call pum#map#insert_relative(+1)<CR>'
  else
    if(fn.col('.') or fn.getline('.')[fn.col('.') - 2] ~= [[\s]]) then
      return '<TAB>'
    else
      fn['ddc#manual_complete']()
    end
  end
end, {silent=true, expr=true})
keymap.set('i', '<S-Tab>', function()
  if(fn['pum#visible']()) then
    return '<Cmd>call pum#map#insert_relative(-1)<CR>'
  else
    return '<S-Tab>'
  end
end, {silent=true, expr=true})
keymap.set('i', '<Enter>', function()
  if(fn['pum#visible']() == 1) then
    return '<Cmd>call pum#map#confirm()<CR>'
  else
    return '<Enter>'
  end
end, {silent=true, expr=true})
keymap.set({'i', 'c'}, 'jk', '<Plug>(skkeleton-toggle)')
fn["skkeleton#register_kanatable"]('rom', {jk = 'disable'})
--[[ keymap.set('i', '<Esc>', function()
  if(fn['skkeleton#is_enabled']()) then
    return '<Plug>(skkeleton-disable)'
  else
    return '<Esc>'
  end
end, {expr=true})
]]
fn['skkeleton#config']({
  eggLikeNewline= true,
  globalJisyo= '~/.skk/SKK-JISYO.L',
  registerConvertResult= true
})
require('nvim-treesitter.configs').setup {
  ensure_installed = {},
  sync_install = false,
  highlight = {
    enable = true,
    --additional_vim_regex_highlighting = false,
  },
  rainbow = {
    enable = true,
    extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
    max_file_lines = nil, -- Do not enable for files with more than n lines, int
  },
  autotag = {
    enable = true
  }
}
require('gitsigns').setup()
require("nvim-gps").setup()
opt.termguicolors = true
require("scrollbar").setup()

keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)

require("nvim-lsp-installer").on_server_ready(function(server)
  local opts = {}

  opts.on_attach = function(client,buffer_number)
    -- print(vim.inspect(client))
    -- print(buffer_number)
  end

  server:setup(opts)
end)
require("nvim-lsp-installer").settings({
  ui = {
    icons = {
      server_installed = '◍',
      server_pending = '◍',
      server_uninstalled = '◍',
    },
    keymaps = {
      toggle_server_expand = '<CR>',
      install_server = 'i',
      update_server = 'u',
      uninstall_server = 'x',
    },
  },
})
require"fidget".setup{}
function _G.disable_arrows()
  if not (file_exists('/Library/Application Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli')) then return end
  os.execute([['/Library/Application Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli' --set-variables '{"nvim_enable_arrows": false}']])
end
function _G.enable_arrows()
  if not (file_exists('/Library/Application Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli')) then return end
  os.execute([['/Library/Application Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli' --set-variables '{"nvim_enable_arrows": true}']])
end
vim.cmd("augroup skkeleton_karabiner")
vim.cmd("  autocmd!")
vim.cmd("  autocmd VimEnter call v:lua.enable_arrows()")
vim.cmd("  autocmd User skkeleton-enable-pre call v:lua.disable_arrows()")
vim.cmd("  autocmd User skkeleton-disable-pre call v:lua.enable_arrows()")
vim.cmd("augroup END")
require('skkeleton_indicator').setup{}
fn["ddu#custom#patch_global"]({
  ui= 'ff',
  sources= {
    {
      name={{name= 'file_rec', params= {}},
          {name= 'file'},
          {name= 'colorscheme'},
          {name= 'buffer'},
          {name= 'file_old'}},
      params= {
        ignoredDirectories= {'.git', 'node_modules', 'vendor', '.next'}
      }
    }
  },
  sourceOptions= {
    ['_']= {
      matchers= {'matcher_substring'},
    },
  },
  filterParams= {
    matcher_substring= {
      highlightMatched= 'Title',
    },
  },
  kindOptions= {
    file= {
      defaultAction= 'open',
    },
  },
  uiParams= {
    ff= {
      startFilter= true,
      prompt= '> ',
      split= 'floating',
    }
  },
})
fn["ddu#custom#patch_local"]('grep', {
   uiParams= {
     ff= {
       startFilter= false,
     }
   },
 })
function ddu_my_settings()
  keymap.set('n', '<CR>', [[<Cmd>call ddu#ui#ff#do_action('itemAction')<CR>]] ,{buffer=true, silent=true})
  keymap.set('n', '<Space>', [[<Cmd>call ddu#ui#ff#do_action('toggleSelectItem')<CR>]] ,{buffer=true, silent=true})
  keymap.set('n', 'i', [[<Cmd>call ddu#ui#ff#do_action('openFilterWindow')<CR>]] ,{buffer=true, silent=true})
  keymap.set('n', 'q', [[<Cmd>call ddu#ui#ff#do_action('quit')<CR>]] ,{buffer=true, silent=true})
end
vim.cmd('autocmd FileType ddu-ff call v:lua.ddu_my_settings()')
function ddu_filter_my_settings()
  keymap.set('i', '<CR>', [[<Esc><Cmd>close<CR>]] ,{buffer=true, silent=true})
  keymap.set('n', '<CR>', [[<Cmd>close<CR>]] ,{buffer=true, silent=true})
  keymap.set('n', 'q', [[<Cmd>close<CR>]] ,{buffer=true, silent=true})
end
vim.cmd('autocmd FileType ddu-ff-filter call v:lua.ddu_filter_my_settings()')
-- keymap.set('n', ';;', [[<Cmd>call ddu#start({})<CR>]] ,{buffer=true, silent=true})
keymap.set('n', ';f', [[<Cmd>call ddu#start({'sources': [{'name': 'file_rec'}], 'sourceOptions': {'file_rec': {'path': getcwd()}}})<CR>]] ,{buffer=true, silent=true})
keymap.set('n', ';h', [[<Cmd>call ddu#start({'sources': [{'name': 'file_old'}]})<CR>]] ,{buffer=true, silent=true})

keymap.set('t', '<ESC>', [[<C-\><C-n>]], {silent=true})

-- require "lsp_signature".setup({})
fn["signature_help#enable"]()
fn["popup_preview#enable"]()

~/.config/nvim/lua/settings/ddc.lua ```lua local fn = vim.fn fn["ddc#custom#patch_global"]('sources', {'around', 'file', 'buffer', 'skkeleton', 'nvim-lsp'}) fn['ddc#custom#patch_global']('sourceOptions', { _= { matchers= {'matcher_head'}, sorters= {'sorter_rank'} }, file= { mark= 'F', isVolatile= true, forceCompletionPattern= [[\S/\S*]], }, buffer= {mark= 'B'}, skkeleton= { mark= 'skkeleton', matchers= {'skkeleton'}, sorters= {} }, ['nvim-lsp']= { mark="L", forceCompletionPattern=[[\.\w*|:\w*|->\w*]], kindLabels = { Class = "c"} } }) fn['ddc#custom#patch_filetype']({'ps1', 'dosbatch', 'autohotkey', 'registry'}, { sourceOptions= { file= { forceCompletionPattern= [[\S\\\S*]], }, } }) fn['ddc#custom#patch_global']('sourceParams', { buffer= { requireSameFiletype=false, limitBytes=5000000, fromAltBuf=true, forceCollect=true, }, }) fn['ddc#custom#patch_global']('completionMenu', 'pum.vim') fn['ddc#enable']() ```
~/.config/nvim/lua/settings/lightline.lua ```lua local g = vim.g g.lightline = { colorscheme = 'iceberg', separator = { left = "", right = "" }, subseparator= { left = "", right = "" }, active = { left = { {'mode', 'paste'}, {'readonly', 'filename', 'modified'}, {'linter_checking', 'linter_errors', 'linter_warnings', 'linter_ok'} } } } g.lightline.component_expand = { linter_checking = 'lightline#ale#checking', linter_warnings = 'lightline#ale#warnings', linter_errors = 'lightline#ale#errors', linter_ok = 'lightline#ale#ok', } g.lightline.component_type = { linter_checking = 'left', linter_warnings = 'warning', linter_errors = 'error', linter_ok = 'left', } g['lightline#ale#indicator_checking'] = [[\uf110]] g['lightline#ale#indicator_infos'] = [[\uf129]] g['lightline#ale#indicator_warnings'] = [[\uf071]] g['lightline#ale#indicator_errors'] = [[\uf05e]] g['lightline#ale#indicator_ok'] = [[\uf00c]] --[[ if fn.has('gui_running') then opt.guioptions:remove({'e'}) end ]] g.lightline.tab = { active= { 'tabnum', 'filename', 'modified' }, inactive= { 'tabnum', 'filename', 'modified' } } ```
ZOI-dayo commented 2 years ago

this also happens with this init.lua(ddc.lua is not changed.)

local api = vim.api
local g = vim.g
local o = vim.o
local opt = vim.opt
local keymap = vim.keymap
local fn = vim.fn
function file_exists(name)
  return fn.empty(fn.glob(path)) == 1
end
require('jetpack').setup {
  'vim-denops/denops.vim',
  'Shougo/ddc.vim',
  'Shougo/ddc-matcher_head',
  'Shougo/ddc-sorter_rank',
  'Shougo/ddc-around',
  'Shougo/ddc-nvim-lsp',
  'LumaKernel/ddc-file',
  'matsui54/ddc-buffer',
  'Shougo/pum.vim',
  'vim-skk/skkeleton',
  'ray-x/lsp_signature.nvim',
}
require ('settings.ddc')
akiyosi commented 2 years ago

@ZOI-dayo Hi :D Thanks for this issue report. I am trying to reproduce it in your shorter setting, but have not yet been able to. Would you be able to provide specific steps to reproduce this?

ZOI-dayo commented 2 years ago

Sorry, I forgot to write some important steps.

  1. install deno on your computer (I using deno 1.23.1 (release, aarch64-apple-darwin), v8 10.4.132.8, typescript 4.7.2)
  2. set init.lua to this:
    local fn = vim.fn
    vim.cmd("runtime */jetpack.vim")
    require('jetpack').setup {
    'vim-denops/denops.vim',
    'Shougo/ddc.vim', 
    'Shougo/ddc-matcher_head',
    'Shougo/ddc-sorter_rank', 
    'Shougo/ddc-around',
    'Shougo/pum.vim',
    }
    fn["ddc#custom#patch_global"]('sources', {'around'})
    fn['ddc#custom#patch_global']('sourceOptions', {
    _= {
        matchers= {'matcher_head'},
        sorters= {'sorter_rank'}
    },
    })
    fn['ddc#custom#patch_global']('completionMenu', 'pum.vim')
    fn['ddc#enable']()
  3. run $ curl -fLo ~/.config/nvim/plugin/jetpack.vim --create-dirs https://raw.githubusercontent.com/tani/vim-jetpack/master/plugin/jetpack.vim
  4. open neovim and run :JetpackSync
  5. exit neovim
  6. open a file with goneovim (this file must have content, because this suggestion is created from the content of current file)
  7. enter some text
  8. this bug happens

https://user-images.githubusercontent.com/64856587/177700619-3534b817-c3c9-4597-9f5d-e022017a6872.mp4

I find that this bug not happen if I press after each new char. (to write "print", press p r <C-n> i <C-n> ....) I think this related to whether the floating window was rewritten...?

akiyosi commented 2 years ago

@ZOI-dayo Thx for the info! I was able to reproduce it. Also, it looks like maybe this problem has already been fixed in the last few fixes. I am not able to reproduce it on my machine with the nightly build. Could you please try it as well?

https://github.com/akiyosi/goneovim/releases/tag/nightly

ZOI-dayo commented 2 years ago

I confirmed that is fixed. Thank you!!! :)