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

non-latin keymap doesn't work for a <Plug>(YCMFindSymbolInDocument) #3881

Closed
habamax opened this issue May 2, 2021 · 10 comments · Fixed by #3885
Closed

non-latin keymap doesn't work for a <Plug>(YCMFindSymbolInDocument) #3881

habamax opened this issue May 2, 2021 · 10 comments · Fixed by #3885

Comments

@habamax
Copy link
Contributor

habamax commented May 2, 2021

Just to let you know it doesn't work. Not sure there is/will be non latin things to filter upon.

But it is still possible to name functions and variables using UTF8, so here it is :)

  1. have a function named with non-latin (russian alphabet)
  2. set keymap=russian-jcukenwin
  3. press <C-6> to switch to ru keymap
  4. use <Plug>(YCMFindSymbolInDocument)
  5. try to search for the function...

No russian letters are produced.

ycm-find-symbol-keymap

@bstaletic
Copy link
Collaborator

I've just made a quick test and cyrillic characters can appear in a prompt buffer, but indeed get lost in our prompt buffer.

@puremourning
Copy link
Member

puremourning commented May 3, 2021

I don’t know how to keymap. Can someone break down a repro case with like actual key presses? This seems like a vim bug to me, so I’ll mimimise a test case for it.

@habamax
Copy link
Contributor Author

habamax commented May 3, 2021

This seems like a vim bug to me

it works fine with prompt buffer I have for vim-select

Can someone break down a repro case with like actual key presses

It works with regular prompt buffers, it doesn't work with what you have in ycm :)

  1. open vim with file where <Plug>(YCMFindSymbolInDocument) has an effect
  2. :set keymap=russian-jcukenwin
  3. type something into a buffer to check if you have a russian letters.
  4. call <Plug>(YCMFindSymbolInDocument)
  5. type smth in russian

@habamax
Copy link
Contributor Author

habamax commented May 3, 2021

Keymap and a regular prompt buffer:

ycm-find-symbol-keymap2

@puremourning
Copy link
Member

I’m thinking prompt buffer + popup with keyboard filter as the base combination to check

@puremourning
Copy link
Member

This is the result of mapping: 0 in the popup options:

set keymap=russian-jcukenwin

function! s:Filter( id, key ) abort
  return 0
endfunction

let p = popup_create( 'this is a popup', #{
      \ filter: function( 's:Filter' ),
      \ mapping: v:false,
      \ } )

let bufnr = bufadd( '_ycm_filter_' )
silent call bufload( bufnr )
silent topleft 1split _ycm_filter_

setlocal buftype=prompt noswapfile modifiable nomodified noreadonly
setlocal nobuflisted bufhidden=unload textwidth=0

call prompt_setprompt( bufnr, 'This is a prompt: ' )

This has the same effect.

I don't see an obvious solution other than not restricting mappings, but that has other implications.

Seems like keymap and :map are handled the same, not sure if that's a vim bug or feature.

@puremourning
Copy link
Member

Minimal repro

set keymap=russian-jcukenwin

function! s:Filter( id, key ) abort
  return 0
endfunction

let p = popup_create( 'this is a popup', #{
      \ filter: function( 's:Filter' ),
      \ mapping: v:false,
      \ } )

I don't know if that's intentional behaviour on the part of vim or not. Maybe ask on vim_dev?

@habamax
Copy link
Contributor Author

habamax commented May 3, 2021

so there is no direct prompt input -- you filter it through popup, right?

@puremourning
Copy link
Member

the input goes to the prompt buffer, and the popup has a filter function for keys like <CR>, <Tab> etc.
the TextChangedI event is used to refresh the search.

@puremourning
Copy link
Member

puremourning commented May 3, 2021

It might be possible to solve this by rewriting it all to use buffer-local mappings in the prompt buffer. Though that's a fair bit of work. Let's see what Bram says about keymap before deciding.

@mergify mergify bot closed this as completed in #3885 May 4, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants