Skip to content

feat(fold): toggle folds and expandable regions with za / <CR> (#21)#23

Merged
delphinus merged 1 commit into
mainfrom
feat/key-toggle-folds
Jun 21, 2026
Merged

feat(fold): toggle folds and expandable regions with za / <CR> (#21)#23
delphinus merged 1 commit into
mainfrom
feat/key-toggle-folds

Conversation

@delphinus

Copy link
Copy Markdown
Owner

Closes #21.

折り畳み (callout / <details>) と展開可能領域 (省略されたコードブロック・テーブル) は、これまでマウスクリックでしかトグルできませんでした。プレビューバッファ内で za / <CR> にバインドし、カーソル行のブロックをトグルできるようにします。マウスなしでもプレビューを操作できます。

変更点

  • za — カーソル行の折り畳み / 展開ブロックをトグル (該当しない行では何もしない)。
  • <CR> — カーソル行のブロックをトグル。該当しなければ、閉じるキーのとき (floating / tab モード) はウィンドウを閉じ、toggle モードでは何もしない。
  • マウス・キーボード両ハンドラで共有する副作用のない fold_at / region_at を抽出。マウスの挙動 (URL 優先処理を含む) は不変。

テスト

  • tests/key_toggle_test.lua を新規追加 (za / <CR> の各経路、計 15 アサーション)。
  • make test 全パス (回帰なし)。

ドキュメント (README.md / README.ja.md / doc/md-render.txt / doc/md-render.jax) のキー一覧・機能一覧・レンダーモードの注記も更新済み。

🤖 Generated with Claude Code

Folds (callouts/details) and expandable regions (truncated code blocks
and tables) could previously only be toggled by clicking. Bind `za` and
`<CR>` in the preview buffer to toggle the block under the cursor, so the
preview is usable without a mouse.

- `za` toggles the fold/region under the cursor (no-op otherwise).
- `<CR>` toggles the block under the cursor, otherwise closes the window
  when it is a close key (float/tab mode), and is a no-op in toggle mode.
- Extract side-effect-free `fold_at` / `region_at` finders shared by the
  mouse and keyboard handlers; mouse behavior (incl. URL precedence) is
  unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@delphinus delphinus merged commit f875422 into main Jun 21, 2026
4 checks passed
@delphinus delphinus deleted the feat/key-toggle-folds branch June 21, 2026 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Toggle folding blocks with keys in addition to mouse clicking

1 participant