mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-30 06:37:14 +09:00
Fix relocate at the end of buffer when scrollmargin is 0 (#2578)
* Add LessEqual and GreaterEqual for SLoc * Fix relocate at the end of buffer when scrollmargin is 0 Fix the following issue: when scrollmargin is set to 0 and we move the cursor to the end of buffer (e.g. via Ctrl-End), the buffer view doesn't move. The cause is that the condition c.LessThan(w.Scroll(bEnd, -scrollmargin+1)) doesn't hold, since Scroll() takes care not to return a location beyond the end of buffer, so in this case Scroll() just returns bEnd.
This commit is contained in:
@@ -219,7 +219,7 @@ func (w *BufWindow) Relocate() bool {
|
||||
w.StartLine = c
|
||||
ret = true
|
||||
}
|
||||
if c.GreaterThan(w.Scroll(w.StartLine, height-1-scrollmargin)) && c.LessThan(w.Scroll(bEnd, -scrollmargin+1)) {
|
||||
if c.GreaterThan(w.Scroll(w.StartLine, height-1-scrollmargin)) && c.LessEqual(w.Scroll(bEnd, -scrollmargin)) {
|
||||
w.StartLine = w.Scroll(c, -height+1+scrollmargin)
|
||||
ret = true
|
||||
} else if c.GreaterThan(w.Scroll(bEnd, -scrollmargin)) && c.GreaterThan(w.Scroll(w.StartLine, height-1)) {
|
||||
|
||||
Reference in New Issue
Block a user