diff --git a/CHANGELOG.md b/CHANGELOG.md index 462e435..5ddba06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to claude-code.el will be documented in this file. +## [0.4.5] + +### Added +- New `claude-code-display-window-fn` customization option (#100) to control display of Claude COde buffer + +### Changed + +### Fixed +- Fixed bug reporting line position when narrowring is in effect (#74) + ## [0.4.4] ### Added diff --git a/README.md b/README.md index 923e559..ad67952 100644 --- a/README.md +++ b/README.md @@ -574,7 +574,7 @@ You can customize how Claude Code windows are displayed by setting `claude-code- #### Using display-buffer-alist -You can also control how the Claude Code window appears using Emacs' `display-buffer-alist`. For example, to make the Claude window appear in a persistent side window on the right side of your screen with 33% width: +You can also control how the Claude Code window appears using Emacs' `display-buffer-alist`. For example, to make the Claude window appear in a persistent side window on the right side of your screen that is 90 characters wide: ```elisp (add-to-list 'display-buffer-alist diff --git a/claude-code.el b/claude-code.el index 97df32c..2c9a92a 100644 --- a/claude-code.el +++ b/claude-code.el @@ -1,7 +1,7 @@ ;;; claude-code.el --- Claude Code Emacs integration -*- lexical-binding: t; -*- ;; Author: Stephen Molitor -;; Version: 0.4.4 +;; Version: 0.4.5 ;; Package-Requires: ((emacs "30.0") (transient "0.9.3")) ;; Keywords: tools, ai ;; URL: https://github.com/stevemolitor/claude-code.el @@ -790,6 +790,17 @@ _BACKEND is the terminal backend type (should be \\='vterm)." _BACKEND is the terminal backend type (should be \\='vterm)." vterm-copy-mode) +(defun claude-code--vterm-window-scroll-advice (&rest _) + "Turn on vterm-copy-mode when scrolling in vterm claude buffer. + +This allows the user to scroll backwards while the LLM is outputing new +text." + (advice-add 'set-window-vscroll :after + (when (and (claude-code--buffer-p (current-buffer)) (eq major-mode 'vterm-mode)) + (if (> (window-end) (buffer-size)) + (when vterm-copy-mode (claude-code-exit-read-only-mode)) + (claude-code-read-only-mode))))) + (cl-defmethod claude-code--term-configure ((_backend (eql vterm))) "Configure vterm terminal in current buffer. @@ -817,7 +828,9 @@ _BACKEND is the terminal backend type (should be \\='vterm)." ;; Set up bell detection advice (advice-add 'vterm--filter :around #'claude-code--vterm-bell-detector) ;; Set up multi-line buffering to prevent flickering - (advice-add 'vterm--filter :around #'claude-code--vterm-multiline-buffer-filter)) + (advice-add 'vterm--filter :around #'claude-code--vterm-multiline-buffer-filter) + ;; Allow scrolling in Claude buffer when LLM is streaming a response + (advice-add 'set-window-vscroll :after #'claude-code--adjust-window-size-advice)) (cl-defmethod claude-code--term-customize-faces ((_backend (eql vterm))) "Apply face customizations for vterm terminal.