Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- Bugfix: TAB on an expandable block label no longer blocks the `<tab>` -> `TAB` key translation, extending the fix in #281 to the label's `keymap` text property, which outranks the mode map. It bound the raw `<tab>` event and shadowed layered keymaps binding only `TAB`; it now binds `TAB`, which also makes the label's own binding reachable in terminal frames, where `<tab>` is never sent.
- Show the summaries of tool calls pending approval in the inline prompt overlay status instead of the generic "Waiting for tool call approval" progress text (which overwrote the approval status), so it's clear what is about to run. With multiple pending tools, resolving one now keeps showing the remaining summaries, and approving from another client clears the stale approve/reject hints.
- Bugfix: a region ending at the beginning of a line (whole-lines selection) no longer includes that extra line in the lines range sent by the `eca-chat-add-context-*` commands, and ranges/cursor positions computed in narrowed buffers now use absolute file line numbers.

Expand Down
2 changes: 1 addition & 1 deletion eca-chat-expandable.el
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ NESTED-PROPS is a plist with :parent-id and :label-indent for nested blocks."
(make-string (length eca-chat-expandable-block-open-symbol) ?\s)))))
'keymap (let ((km (make-sparse-keymap)))
(define-key km (kbd "<mouse-1>") (lambda () (interactive) (eca-chat--expandable-content-toggle id)))
(define-key km (kbd "<tab>") (lambda () (interactive) (eca-chat--expandable-content-toggle id)))
(define-key km (kbd "TAB") (lambda () (interactive) (eca-chat--expandable-content-toggle id)))
(define-key km (kbd "RET") (lambda () (interactive) (eca-chat--expandable-content-toggle id)))
km)
'help-echo "mouse-1 / tab / RET: expand/collapse"))
Expand Down
27 changes: 27 additions & 0 deletions test/eca-chat-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -1698,6 +1698,33 @@ does not treat the first line as metadata. Returns FN's value."
(expect (lookup-key eca-chat-mode-map (kbd "C-<return>"))
:to-be #'eca-chat--key-pressed-queue)))

;; ---------------------------------------------------------------------------
;; Expandable block label keymap
;; ---------------------------------------------------------------------------

(defun eca-chat-test--expandable-label-keymap ()
"Render an expandable block and return the label's `keymap' property."
(with-temp-buffer
(let ((eca-chat-expandable--id->ov (make-hash-table :test 'equal)))
(eca-chat--insert-expandable-block "test-id" "Label" "content" "" "" ""))
(get-text-property (point-min) 'keymap)))

(describe "expandable block label keymap"

(it "binds TAB and RET to the toggle"
(let ((km (eca-chat-test--expandable-label-keymap)))
(expect (functionp (lookup-key km (kbd "TAB"))) :to-be t)
(expect (functionp (lookup-key km (kbd "RET"))) :to-be t)))

;; The label keymap comes from a `keymap' text property, which outranks
;; the mode map, so binding the raw events here would block the
;; <tab> -> TAB and <return> -> RET translations while point is on a
;; label and shadow any layered keymap binding only TAB/RET.
(it "does not bind the raw <tab> or <return> events"
(let ((km (eca-chat-test--expandable-label-keymap)))
(expect (lookup-key km (kbd "<tab>")) :to-be nil)
(expect (lookup-key km (kbd "<return>")) :to-be nil))))

;; ---------------------------------------------------------------------------
;; eca-chat--shell-command-state-face
;; ---------------------------------------------------------------------------
Expand Down
Loading