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

Wrong behavior of telescope.mapping.put actions #160

Closed
bak-t opened this issue Nov 9, 2023 · 5 comments · Fixed by #164
Closed

Wrong behavior of telescope.mapping.put actions #160

bak-t opened this issue Nov 9, 2023 · 5 comments · Fixed by #164
Labels
bug Something isn't working

Comments

@bak-t
Copy link

bak-t commented Nov 9, 2023

Brief

Currently action from mapping.put('p') puts text before cursor position & mapping.put('P') puts text before character that precedes cursor position.

Steps to reproduce

Paste after

  1. Set cursor to desired position
  2. Run Telescope UI for Yanky History: :lua require("telescope").extensions.yank_history.yank_history()
  3. Select item & press C-Enter

Actual result

Item is inserted before cursor position.

Expected result

Item is inserted after cursor position.

Paste before

  1. Set cursor to desired position
  2. Run Telescope UI for Yanky History: :lua require("telescope").extensions.yank_history.yank_history()
  3. Select item & press S-Enter

Actual result

Item is inserted before character that precedes cursor position.

Expected result

Item is inserted before cursor position.

Additional details

Neovim version: 0.9.4
Plugin version: 2.0.0
Config for the plugin:

	config = function()
		local utils = require("yanky.utils")
		local mapping = require("yanky.telescope.mapping")
		local action = {
			paste_after = mapping.put('p'),
			paste_before = mapping.put('P'),
			set_default_register = mapping.set_register(utils.get_default_register()),
			delete = mapping.delete(),
		}

		require('yanky').setup({
			system_clipboard = {
				sync_with_ring = false,
			},
			picker = {
				telescope = {
					use_default_mappings = false,
					mappings = {
						default = action.paste_after,
						i = {
							['<S-CR>'] = action.paste_before,
							['<C-CR>'] = action.paste_after,
							['<M-r>'] = action.set_default_register,
							['<M-d>'] = action.delete,
						},
						n = {
							['<leader>p'] = action.paste_after,
							['<leader>P'] = action.paste_before,
							['<S-CR>'] = action.paste_before,
							['<leader>r'] = action.set_default_register,
							['<leader>d'] = action.delete,
						},
					},
				}
			},
		})
	end
@gbprod
Copy link
Owner

gbprod commented Nov 15, 2023

Thanks for reporting this issue, for the moment, I'm not able to reproduce this...
It could comes from another plugin you have installed, car you try without other plugins ?

@gbprod gbprod added the bug Something isn't working label Nov 15, 2023
@bak-t
Copy link
Author

bak-t commented Nov 17, 2023

I was able to reproduce the bug with minimum set of plugins (yanky.nvim, telescope.nvim, plenary.nvim, lazy.nvim). Here is the config I used: nvim_min.zip.

Also I forget to mention that I used Windows 10.

@gbprod
Copy link
Owner

gbprod commented Nov 24, 2023

I can't manage to reproduce your issue but I think I've a possible fix here : #164
Is it possible for you to test with this branch ?

@bak-t
Copy link
Author

bak-t commented Nov 25, 2023

Confirming that fix works for me (both GUI & Terminal version).

@gbprod
Copy link
Owner

gbprod commented Nov 27, 2023

Great !
I merge :)
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants