Skip to content

feat(keymap): close preview with q / <Esc> / <C-c>, not <CR> (#22)#24

Merged
delphinus merged 1 commit into
mainfrom
close-keys-no-enter
Jun 21, 2026
Merged

feat(keymap): close preview with q / <Esc> / <C-c>, not <CR> (#22)#24
delphinus merged 1 commit into
mainfrom
close-keys-no-enter

Conversation

@delphinus

Copy link
Copy Markdown
Owner

Closes #22.

プレビューウィンドウ (フローティング / タブ) を <Enter> で閉じるのは直感的ではない、というフィードバックを受けての変更です。デフォルトの閉じるキーから <CR> を外し、<C-c> を追加しました。Issue タイトルにある Q は閉じるキーとして不自然なので採用していません。

変更点

  • デフォルトの閉じるキーを q / <Esc> / <CR> から q / <Esc> / <C-c> に変更。
  • <CR>Toggle folding blocks with keys in addition to mouse clicking #21 で入れたカーソル行のブロックトグル動作のみを担い、該当しない行では何もしない (ウィンドウは閉じない) ようになりました。
  • 呼び出し側が明示的に close_keys<CR> を含めた場合は従来どおり閉じる (cr_is_close フォールバックは維持)。

テスト

  • tests/key_toggle_test.lua を更新 (<CR> がデフォルトで閉じないこと、<C-c> / q が閉じること、<CR> 明示時のフォールバックを追加。計 18 アサーション)。
  • make test 全パス (回帰なし)。

ドキュメント (README.md / README.ja.md / doc/md-render.txt / doc/md-render.jax) のキー一覧も更新済み。

🤖 Generated with Claude Code

Closing the floating/tab preview window on <Enter> is unintuitive
(feedback on #22). Drop <CR> from the default close keys and add <C-c>;
the title's proposed `Q` is omitted as an odd binding.

<CR> keeps the block-toggle behavior from #21 and is now a pure no-op
when the cursor is not on a fold / expandable region. The cr_is_close
fallback remains so callers can still opt <CR> into close_keys.

Docs (README.md / README.ja.md / doc/md-render.txt / doc/md-render.jax)
and tests/key_toggle_test.lua updated accordingly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@delphinus delphinus merged commit 57e6f2d into main Jun 21, 2026
4 checks passed
@delphinus delphinus deleted the close-keys-no-enter branch June 21, 2026 04:21
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.

Close opened floating window with q/Q/<C-c>, not with Enter

1 participant