feat(fold): toggle folds and expandable regions with za / <CR> (#21)#23
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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