Skip to content

Commit 4a9eb59

Browse files
committed
Fix copy-mode M-> landing at bottom-right and exit not scrolling back
M-> (end-of-buffer) in copy-mode was overriding the native cursor position with (goto-char (point-max)), landing at the bottom-right corner instead of the terminal cursor (after the last prompt). Remove the explicit goto since ghostel--redraw already positions point correctly. Exiting copy-mode after scrolling up left the viewport frozen at the scrolled position. Add ghostel--scroll-bottom before the invalidate so the subsequent redraw shows the current terminal state.
1 parent 56ef155 commit 4a9eb59

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ghostel.el

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,9 @@ pasted using bracketed paste."
946946
(ghostel--scroll-bottom ghostel--term)
947947
(let ((inhibit-read-only t))
948948
(ghostel--redraw ghostel--term ghostel-full-redraw))
949-
(goto-char (point-max))))
949+
;; The native redraw already positions point at the terminal cursor,
950+
;; so no explicit goto-char needed here.
951+
))
950952

951953
(defun ghostel-copy-mode-end-of-line ()
952954
"Move to the last non-whitespace character on the line."
@@ -1095,6 +1097,8 @@ Press \\`q' or \\[ghostel-copy-mode-exit] to exit without copying."
10951097
(setq buffer-read-only nil)
10961098
(setq mode-name "Ghostel")
10971099
(force-mode-line-update)
1100+
(when ghostel--term
1101+
(ghostel--scroll-bottom ghostel--term))
10981102
(ghostel--invalidate)
10991103
(message "Copy mode exited")))
11001104

0 commit comments

Comments
 (0)