Closed rakyi closed 8 years ago
Fix:
(add-hook 'term-mode-hook
(lambda ()
(set (make-local-variable 'scroll-margin) 0)))
I think term-mode
is the only place where this needs to be fixed? Shell mode isn't a terminal emulator so top
shouldn't run in shell mode anyway. However, things like top
or vi
should be able to run in term-mode
; the above snippet fixes this bug (see https://github.com/syl20bnr/spacemacs/issues/3204).
I'll make a PR if I don't forget; anyone else is welcome to steal this easy fix.
It's not just for fixing top, it's also for killing that stupid five-line gap at the bottom of the buffer when you're in a mode where you are literally always at the end.
I apply this in eshell-mode, term-mode, erc-mode, messages-buffer-mode, inferior-emacs-lisp-mode and inferior-pyhon-mode. The inferior-... modes can be covered using comint-mode instead, but the others do not derive from comint. (Shell-mode does derive from comint)
By the way, setq-local
is equivalent to (set (make-local-variable ...) ...)
This may not be the right place to ask this. But why do we need to set the scroll margin to 5? Is it for smooth scrolling?
@dsdshcym To have some context always visible when we're hitting top/bottom of buffer.
@nixmaniack Thank you for your reply! I think I'd better try to set the margin to 0 for a while to find out the differences.
It doesn't make much sense to have a scroll-margin in shell (breaks
top
for example) or erc, so I think it should be disabled there. I don't know if there are some comint mode derived modes where it makes sense to have the margin set.