Only a new comment opens in insert mode, and :CommentList lands on a
span's text. The wording is plainer throughout. The README now maps the
code layout and says how to run the checks.
The picker and the markdown export use location.describe, the window
title's format: "line 3", "lines 3–5", "line 3, col 5–12". This fixes the
picker's "lines 3" for one line. Quickfix gets a span's columns, so ]q
lands on the text.
plugin/scratch-comments.lua defines the commands and loads the plugin
when one runs. The autocmds and the sign highlight are set when their
modules first load, so nothing runs on text changes before a comment
command has. setup() is kept as a no-op for configs that call it.
Lists that were called items are views, anchored or comments. actions
finds a buffer's comments through views.in_buffer, so views.find and
find_all go. Helpers used only inside their module become local.
annotate.lua becomes actions.lua, with toggle and clear from init.lua.
Rendering and :CommentExport move into export/init.lua, and ui.lua
becomes ui/quickfix.lua for :CommentList. init.lua is the Lua API and
setup.
navigate.jump either cycles the open comment window or moves the cursor
to the next comment's line. Cycling shows a comment, so navigate calls
annotate.show. The buffer's views and index_of move into model/views.
ui/window.lua has the two-pane frame and tracks the open comment window,
so the frame no longer needs an on_close hook. ui/notify.lua replaces
notify(message, kind) with info, warn and error.
Adding, editing, deleting, clearing and forgetting a buffer's comments
go through comments.lua, which keeps anchors and signs in sync, so the
hand-written sign redraws go. state.lua becomes model/views.lua.
markdown.lua, json.lua and the clipboard copy (export.lua) move into
export/, unchanged. Unit specs check the whole markdown output and the
json fields.
The store holds the comments and their ids and makes no Neovim calls.
One remove(predicate) replaces remove_ids and remove_buffer. state.lua
keeps only the views: where each comment is now, and its snippet.
Specs for the unnamed-buffer warning, the window border, cancelled
pickers, deleting with nothing to delete, :CommentToggle usage,
navigation with other files or a changed comment, clipboard failure,
sorting across files, nested code fences and :checkhealth.
helpers.notified() runs scheduled notifications before reading them,
and reset flushes them so none reach the next spec.
smoke.lua becomes commenting, window, show_delete, navigation and signs
specs, plus cases in list_export and anchoring. :e! gets a fixture file
instead of the repo's LICENSE. The old runner and minimal_init.lua go,
so make test runs mini.test only.
reflow.lua and orphans.lua become anchoring_spec.lua, and spans.lua
becomes spans_spec.lua. Each case builds its own buffer instead of
continuing from the edits before it.
In-process specs are enough: helpers fire TextChanged and break undo
blocks where headless Neovim doesn't, and answer vim.ui.select.
make test clones mini.test at a pinned version into deps/, once per
version, and runs tests/**/*_spec.lua in-process before the old suites.
Specs use describe/it/before_each with mini.test's expect, and each one
starts from a reset editor through tests/helpers.lua.
The export suite is the first one ported, as list_export_spec.lua.
A comment opens in one window, as in Google Docs: :CommentShow shows it
in normal mode, and you edit it there and :w to save. :CommentEdit and
scratch.edit() are gone, and :Comment on a commented range opens the
same window.
:CommentNext and :CommentPrev move any open comment window to the next
or previous comment, a new one included. With unsaved changes they
refuse, like :bnext, so nothing is lost. The title shows the count and
the mode: "comment (3 of 4) [NORMAL]".
The test runner matched FAIL only at the start of a line, but Neovim can
print mode messages before it, so failures showed as ok. It now finds
FAIL anywhere and treats a suite that never reports ok as failed.
That exposed two failures: the padding test still expected the old
winhighlight, and the long title test expected the wrong columns and
measured with strdisplaywidth, which counts linebreak padding in the
current window. Title fitting now uses nvim_strwidth too.