Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

evil-scroll-down cannot make it to the end of the file #618

Closed
TheBB opened this issue Feb 8, 2016 · 21 comments
Closed

evil-scroll-down cannot make it to the end of the file #618

TheBB opened this issue Feb 8, 2016 · 21 comments

Comments

@TheBB
Copy link
Member

TheBB commented Feb 8, 2016

Originally reported by: Aaron Jensen (Bitbucket: aaronjensen1, GitHub: Unknown)


The new C-d works pretty well, but for some reason, it does not always make it to the end of the file. You get End of buffer when you're still about 5-6 lines from the bottom.


@TheBB
Copy link
Member Author

TheBB commented Feb 9, 2016

Original comment by JAremko (Bitbucket: JAremko, GitHub: JAremko):


Hm. It's really strange. The old scroll seems to be also broken.

@TheBB
Copy link
Member Author

TheBB commented Feb 15, 2016

Original comment by Elliott Darfink (Bitbucket: atomen, GitHub: atomen):


I'm experiencing the same issue with evil-git-0562f05

@TheBB
Copy link
Member Author

TheBB commented Feb 16, 2016

Original comment by Amos Bird (Bitbucket: amosbird, GitHub: amosbird):


This misbehavior has bothered me for nearly a month. Wish it be fixed soon :-)

@TheBB
Copy link
Member Author

TheBB commented Feb 16, 2016

Original comment by JAremko (Bitbucket: JAremko, GitHub: JAremko):


Someone has to take one for the team. Just saying

@TheBB
Copy link
Member Author

TheBB commented Feb 16, 2016

Original comment by Wouter Bolsterlee (Bitbucket: wbolster, GitHub: wbolster):


i'm encountering the same issue. it looks like my scroll settings influence the number of lines left at the end (the "unscrollable" lines).

#!lisp
(setq scroll-conservatively 101)
(setq scroll-margin 5)

setting scroll-margin to a different value seems to influence the behaviour.

@TheBB
Copy link
Member Author

TheBB commented Feb 16, 2016

Original comment by Wouter Bolsterlee (Bitbucket: wbolster, GitHub: wbolster):


it looks like this change helps:

#!diff
--- a/elpa/evil-20160214.1141/evil-commands.el
+++ b/elpa/evil-20160214.1141/evil-commands.el
@@ -869,6 +869,7 @@ Scrolls half the screen if `evil-ud-scroll-count' equals 0."
             (win-end (window-end nil 'update)))
         (when (= win-end (point-max))
           (scroll-down (- (evil-num-visible-lines)
+                          (scroll-margin)
                           (evil-count-lines win-beg win-end)))))
       (when (= 0 (count-lines p (point)))
         (signal 'end-of-buffer nil)))))

@TheBB
Copy link
Member Author

TheBB commented Feb 16, 2016

Original comment by Frank Fischer (Bitbucket: lyro, GitHub: lyro):


For some reason I cannot reproduce the problem. Can somebody provide a reproducible example? Preferably starting with make emacs or (maybe better) make term in Evil's source directory. The height of the window could also be important (M-: (window-body-height)).

@TheBB
Copy link
Member Author

TheBB commented Feb 17, 2016

Original comment by Wouter Bolsterlee (Bitbucket: wbolster, GitHub: wbolster):


i experience this in emacs gui on osx, maximized frame, two split windows (vertically), long file that does not fit on the screen, and with scroll setup as posted above.

@TheBB
Copy link
Member Author

TheBB commented Feb 17, 2016

Original comment by Frank Fischer (Bitbucket: lyro, GitHub: lyro):


Could you please give a more detailed example? File content (might be
something like

line 1
line 2
...
line 42

) and the number of lines of your windows (terminal might be better
because then the number of lines does not depend on your fonts)? These
attributes are important for reproducing the problem. Currently
everything works well here.

@TheBB
Copy link
Member Author

TheBB commented Feb 17, 2016

Original comment by Wouter Bolsterlee (Bitbucket: wbolster, GitHub: wbolster):


on a 80x25 terminal window:

#!sh
$ seq 100 > numbers.txt
$ emacs -nw numbers.txt

hit ctrl-d repeatedly. scrolling refuses to go below the line containing the number 95.

note that i have this in my init.el:

#!elisp
(setq scroll-conservatively 101)
(setq scroll-margin 5)

@TheBB
Copy link
Member Author

TheBB commented Feb 17, 2016

Original comment by Wouter Bolsterlee (Bitbucket: wbolster, GitHub: wbolster):


by default scroll-margin is 0, so the problem does not manifest if it's left at the default. increasing the number results in more lines of context around point to be visible at all times (which i strongly prefer).

@TheBB
Copy link
Member Author

TheBB commented Feb 22, 2016

Original comment by JAremko (Bitbucket: JAremko, GitHub: JAremko):


@Lyro You can compare how C-d works in Vim and Evil
In Vim if there are not enough lines to scroll, between the buffer's end and the pointer, then the pointer will be placed at the last line in the buffer.

@TheBB
Copy link
Member Author

TheBB commented Feb 23, 2016

Original comment by Sooheon Kim (Bitbucket: sooheon, GitHub: sooheon):


@wbolster Even when scroll-margin is 0, there is a difference with vim behaviour: When the last line is visible, C-d brings you to the third to last line, every time. If you put point on the last line, C-d actually moves the cursor up, to the third to last line. Same with C-f, successive calls with end of file visible will beep out and refuse to move point, while in vim, C-f will take you to the very last line before beeping out.

@TheBB
Copy link
Member Author

TheBB commented Feb 23, 2016

Original comment by Frank Fischer (Bitbucket: lyro, GitHub: lyro):


Respect scroll-margin in evil-scroll-down (re #618)

@TheBB
Copy link
Member Author

TheBB commented Feb 23, 2016

Original comment by Frank Fischer (Bitbucket: lyro, GitHub: lyro):


Move point to eob/bob when scrolling near the end (re #618)

@TheBB
Copy link
Member Author

TheBB commented Feb 23, 2016

Original comment by Frank Fischer (Bitbucket: lyro, GitHub: lyro):


Please test with the latest changes.

@sooheon: I cannot reproduce your problem with the cursor going up. Please provide a minimal example (starting with make emacs or make term) that demonstrates the problem.

@TheBB
Copy link
Member Author

TheBB commented Mar 1, 2016

Original comment by reed1 (Bitbucket: reed1, GitHub: reed1):


I'm using Emacs: 24.5.1 with latest evil (v 1.2.10, changeset: 1774:7456d7013801), empty emacs, just evil, when on GUI mode and terminal mode, still can't scroll down to the bottom (Using C-d), although sometimes with certain linenumbers it will scroll down to the very bottom of page, but most of the times it won't work. Just stuck at first line above the last line. But when I use the full fledged spacemacs, it stucks on about 5-10 lines above the last line. Strange, I can do further debugging if required.

@TheBB
Copy link
Member Author

TheBB commented Mar 31, 2016

Original comment by Frank Fischer (Bitbucket: lyro, GitHub: lyro):


New implementation of scroll commands (fixes #618)

  • based on window positions
  • handle visual line mode reasonably
  • deal with scroll-margin at buffer boundaries

@TheBB
Copy link
Member Author

TheBB commented Mar 31, 2016

Original comment by Magnus Therning (Bitbucket: magthe, GitHub: magthe):


Could this fix syl20bnr/spacemacs#5643 as well?

@TheBB
Copy link
Member Author

TheBB commented Mar 31, 2016

Original comment by Frank Fischer (Bitbucket: lyro, GitHub: lyro):


Handle scroll margin in scroll-to-top/bottom functions (re #618)

@TheBB
Copy link
Member Author

TheBB commented Apr 3, 2016

Original comment by JAremko (Bitbucket: JAremko, GitHub: JAremko):


Cool thanks, @Lyro !

@TheBB TheBB closed this as completed Jan 19, 2017
TheBB pushed a commit that referenced this issue Dec 11, 2019
TheBB pushed a commit that referenced this issue Dec 11, 2019
* based on window positions
* handle visual line mode reasonably
* deal with scroll-margin at buffer boundaries
axelf4 added a commit to axelf4/evil that referenced this issue Sep 30, 2022
Reverts commit bbe92d1 (Handle scroll margin in scroll-to-top/bottom
functions (re emacs-evil#618), 2016-03-31) which introduced a bug in
evil-scroll-bottom-line-to-top (due to recenter argument becoming
negative.) recenter itself has clamped to scroll_margin for at least 18
years now, so it is unclear why that commit was even necessary.

Also fixes the docstring for evil-scroll-top-line-to-bottom and avoids
scanning down from (point-min) to the line the point is already at.
tomdl89 pushed a commit that referenced this issue Oct 3, 2022
Reverts commit bbe92d1 (Handle scroll margin in scroll-to-top/bottom
functions (re #618), 2016-03-31) which introduced a bug in
evil-scroll-bottom-line-to-top (due to recenter argument becoming
negative.) recenter itself has clamped to scroll_margin for at least 18
years now, so it is unclear why that commit was even necessary.

Also fixes the docstring for evil-scroll-top-line-to-bottom and avoids
scanning down from (point-min) to the line the point is already at.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant