Skip to content

fix(ui): Harden extmark decorations and detect unknown config keys#38

Merged
mhiro2 merged 3 commits into
mainfrom
fix/harden-extmarks-and-detect-unknown-config-keys
Jun 2, 2026
Merged

fix(ui): Harden extmark decorations and detect unknown config keys#38
mhiro2 merged 3 commits into
mainfrom
fix/harden-extmarks-and-detect-unknown-config-keys

Conversation

@mhiro2
Copy link
Copy Markdown
Owner

@mhiro2 mhiro2 commented Jun 2, 2026

Summary

  • Wrap origin / diagnostic / viewport extmark calls in pcall and clamp the origin row so a stale row or an out-of-range end_col drops only that decoration instead of breaking the popup.
  • Consolidate the two diverged ensure_non_header_cursor implementations into a single stack_view.state helper.
  • Warn (via vim.notify) on unknown or mistyped setup() config keys while still degrading gracefully.

Changes

  • 094f6df : fix(ui): harden extmark decorations against out-of-range coordinates
    • Clamp the origin highlight row to the buffer line count and pcall the extmark so a buffer that shrank after the popup opened no longer raises.
    • Make diagnostic underline / virt_lines and viewport truncation markers best-effort, keeping the rest of the decoration when one extmark would error on an out-of-range end_col.
    • Add feedback_spec and a diagnostics case covering out-of-range coordinates.
  • afd5384 : refactor(stack_view): consolidate ensure_non_header_cursor into state
    • Move a single header-cursor guard into stack_view.state and call it from render, keymaps, and init, removing the duplicated copies.
    • Keep the header-only no-op behaviour and nil-safe header_lines handling; require direction stays acyclic (modules -> state only).
  • ead353b : feat(config): warn on unknown or mistyped config keys
    • Compare the merged config against the default schema and report unrecognised keys (e.g. ui.popups vs ui.popup) with the known keys at that level.
    • Skip user-keyed subtrees (ui.title.icons.map, ui.title.context.node_types) and array / empty-table values to avoid false positives, and document the validation behaviour in the README.

mhiro2 added 3 commits June 3, 2026 08:38
Origin highlight, diagnostic underline, and viewport truncation markers
now wrap nvim_buf_set_extmark in pcall and clamp the origin row to the
buffer line count, so a stale row or an end_col past a truncated line
drops only that decoration instead of raising and breaking the popup.
The render and keymap modules carried slightly diverged copies of the
header-cursor guard. Move a single implementation to stack_view.state and
call it from render, keymaps, and init, keeping the header-only no-op
behaviour and the nil-safe header_lines handling.
setup() now compares the merged config against the default schema and
reports keys it does not recognise (e.g. ui.popups instead of ui.popup)
via vim.notify, while skipping user-keyed subtrees such as the icon map
and node_types so custom providers and filetypes are not flagged.
@mhiro2 mhiro2 self-assigned this Jun 2, 2026
@mhiro2 mhiro2 added bug Something isn't working enhancement New feature or request labels Jun 2, 2026
@mhiro2 mhiro2 merged commit 563af70 into main Jun 2, 2026
5 of 6 checks passed
@mhiro2 mhiro2 deleted the fix/harden-extmarks-and-detect-unknown-config-keys branch June 2, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant