jakewvincent / mkdnflow.nvim

Fluent navigation and management of markdown notebooks
GNU General Public License v3.0
683 stars 41 forks source link

newListItem Fails for Ordered List on First Line of File #199

Closed roman1267 closed 5 months ago

roman1267 commented 7 months ago

The Issue

For ordered lists only (it seems), the update_numbering function fails when the newListItem function is called if the ordered list begins on the first line of the file.

Steps to Reproduce

  1. Open a new markdown file
  2. Add an OL item on the first line:
  3. lorem ~ ~ ~
  4. Run any Mkdn command that generates a new list item
  5. This error and stack trace will appear:
    Error executing Lua callback: ...cal/share/nvim/lazy/mkdnflow.nvim/lua/mkdnflow/lists.lua:170: attempt to index local 'line' (a nil value)
    stack traceback:
        ...cal/share/nvim/lazy/mkdnflow.nvim/lua/mkdnflow/lists.lua:170: in function 'update_numbering'
        ...cal/share/nvim/lazy/mkdnflow.nvim/lua/mkdnflow/lists.lua:492: in function 'newListItem'
        ....local/share/nvim/lazy/mkdnflow.nvim/plugin/mkdnflow.lua:104: in function <....local/share/nvim/lazy/mkdnflow.nvim/plugin/mkdnflow.lua:103>
jakewvincent commented 5 months ago

@roman1267, thanks for the bug report. This should be fixed in the latest. Please let me know here if it is not.