Skip to content

Bug: Error detected while processing CursorMoved Autocommands for "*": in function matchdelete() #31

@ibrahimmkhalid

Description

@ibrahimmkhalid

Issue

If ":call clearmatches()" was performed, it would break the cursorword highlighting for that window

Error detected while processing CursorMoved Autocommands for "*":
Error executing lua callback: Vim:E803: ID not found: 1000
stack traceback:
        [C]: in function 'call'
        ...rline-debug/lazy/nvim-cursorline/lua/nvim-cursorline.lua:35: in function 'matchadd'
        ...rline-debug/lazy/nvim-cursorline/lua/nvim-cursorline.lua:96: in function <...rline-debug/lazy/nvim-cursorline/lua/nvim-cursorline.lua:95>

Discovery

I discovered this bug while installing and testing out ThePrimeagen's latest harpoon update. When opening the harpoon menu, the clearmatches() function was called. This would cause an error message to pop up anytime the cursor moved in the popup menu. Closing the popup menu would fix it in the open file however.

I believe this is a bug in this plugin as there is a check on the existence of cursorword_id on the w object, but that does not take into account whether that that id actually gets deleted.

How to reproduce (discovery)

  1. minimal init.lua: https://pastebin.com/DUp8H0Yx
  2. open a file with some text greater than 3 characters
  3. move cursor over to that word
  4. open quick menu with mm
  5. error!

How to reproduce (general case)

  1. open a file with some text greater than 3 characters
  2. move cursor over to that word
  3. do ":call clearmatches()"
  4. error!

Fix

PR: #30

p.s. I am new to open source development. If there's anything i can fix about my post, please let me know. I would really appreciate it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions