Skip to content

Bug: character following inserted text is deleted #1978

@chrisgrieser

Description

@chrisgrieser

Make sure you have done the following

  • Updated to the latest version of blink.cmp
  • Searched for existing issues and documentation (try <C-k> on https://cmp.saghen.dev)

Bug Description

I noticed this issue when using blink-cmp-git: Kaiser-Yang/blink-cmp-git#60

# original text with `|` marking the cursor position.

# EXAMPLE 1
foobar (|)

# I type `#`, select and confirm an issue that is inserted. Result:
foobar (#123

# expected result
foobar (#123)

# EXAMPLE 2
Foobar | Hello World.

# I type `#`, select and confirm an issue that is inserted. Result:
Foobar #123llo World.

# expected result
Foobar #123 Hello World.

reproduce via:

-- save as `minimal-config.lua`
-- run via: `nvim -u minimal-config.lua`
--------------------------------------------------------------------------------
local spec = {
	{
		"saghen/blink.cmp",
		version = "*",
		dependencies = "Kaiser-Yang/blink-cmp-git",
		opts = {
			sources = {
				default = { "lsp", "path", "snippets", "buffer", "git" },
				providers = {
					git = { module = "blink-cmp-git", name = "Git" },
				},
			},
		},
	}
}

--------------------------------------------------------------------------------
vim.env.LAZY_STDPATH = "/tmp/nvim-repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
require("lazy.minit").repro { spec = spec }
--------------------------------------------------------------------------------

At first, I thought this was a bug related to blink-cmp-git, since this issue did not occur for me with any other sources. However, @Kaiser-Yang (the creator of blink-cmp-git) noted that the issue is in fact caused by blink itself.

Relevant configuration

happens with default config (+ blink-cmp-git)

neovim version

NVIM v0.11.2 Build type: Release LuaJIT 2.1.1748459687

blink.cmp version

1.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions