Closed orontee closed 4 months ago
From: Matthias Meulien @.***> Date: Sat, 11 May 2024 02:39:35 -0700
Context
When running a shell command that write to standard output, the buffer scrolls but the cursor stays invisible, hidden by the resized modeline (See the small pink rectangle on the shared screenshot).
Oh, this is tricky! I can't think of a good solution at the level of spacious-padding because all we do is tweak window/frame spaces.
Perhaps you can automatically run a 'recenter' in the affected buffer? What is this shell exactly? Does it have any hooks we may use?
-- Protesilaos Stavrou https://protesilaos.com
Oh, this is tricky!
Yes, I'll try to investigate, I understand it's not directly related to this library; I'll close the issue.
I can't think of a good solution at the level of spacious-padding because all we do is tweak window/frame spaces. Perhaps you can automatically run a 'recenter' in the affected buffer? What is this shell exactly?
Well, centering trice using recenter-top-bottom
keeps the cursor at the same position!
Looking at the implementation of recenter-top-bottom
, I evaluate window-body-height
with spacious-padding
disabled: 55, and enabled: 52; But spacious-padding-width
has :mode-line-width 6
. I'll have a look at window-body-height
implementation.
EDIT: Nothing wrong, window-body-height
returns a number of characters. Sorry for the noise.
Does it have any hooks we may use?
It's the default shell-mode
derived from comint-mode
defined in shell.el
.
Thanks for your work, I am hooked to the modus + spacious-padding look :-)
From: Matthias Meulien @.***> Date: Sat, 11 May 2024 04:25:14 -0700
Oh, this is tricky!
Yes, I'll try to investigate, I understand it's not directly related to this library; I'll close the issue.
I can't think of a good solution at the level of spacious-padding because all we do is tweak window/frame spaces. Perhaps you can automatically run a 'recenter' in the affected buffer? What is this shell exactly?
Well, centering trice using
recenter-top-bottom
keeps the cursor at the same position!
Oh, right! What happens if you instead try to move the cursor one line down?
Looking at the implementation of
recenter-top-bottom
, I evaluatewindow-body-height
withspacious-padding
disabled: 55, and enabled: 52; Butspacious-padding-width
has:mode-line-width 6
. I'll have a look atwindow-body-height
implementation.
It must be that this is not 'window-height', which includes the mode line (and others).
Does it have any hooks we may use?
It's the default
shell-mode
derived fromcomint-mode
defined inshell.el
.
Good to know! I use it as well but wanted to be sure.
Thanks for your work, I am hooked to the modus + spacious-padding look :-)
You are welcome!
-- Protesilaos Stavrou https://protesilaos.com
For the record, the following seems to fix the problem:
(defun comint-postoutput-scroll-to-bottom (_string)
"Go to the end of buffer in some or all windows showing it.
Do not scroll if the current line is the last line in the buffer.
Depends on the value of `comint-move-point-for-output' and
`comint-scroll-show-maximum-output'.
This function should be in the list `comint-output-filter-functions'."
(let* ((current (current-buffer))
(process (get-buffer-process current)))
(unwind-protect
(cond
((null process))
((bound-and-true-p follow-mode)
(follow-comint-scroll-to-bottom))
(t
(dolist (w (get-buffer-window-list current nil t))
(comint-adjust-window-point w process)
;; Optionally scroll to the bottom of the window.
(and comint-scroll-show-maximum-output
(eq (window-point w) (point-max))
(with-selected-window w
(recenter (- (window-body-height) 1))))))) ; I changed this, was (recenter (- -1 scroll-margin)))))))
(set-buffer current))))
Context
When running a shell command that write to standard output, the buffer scrolls but the cursor stays invisible, hidden by the resized modeline (See the small pink rectangle on the shared screenshot).