mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-16 13:57:07 +09:00
simplify code
This commit is contained in:
@@ -291,13 +291,7 @@ func (w *BufWindow) diff(s1, s2 SLoc) int {
|
||||
// within the buffer boundaries.
|
||||
func (w *BufWindow) Scroll(s SLoc, n int) SLoc {
|
||||
if !w.Buf.Settings["softwrap"].(bool) {
|
||||
s.Line += n
|
||||
if s.Line < 0 {
|
||||
s.Line = 0
|
||||
}
|
||||
if s.Line > w.Buf.LinesNum()-1 {
|
||||
s.Line = w.Buf.LinesNum() - 1
|
||||
}
|
||||
s.Line = util.Clamp(s.Line + n, 0, w.Buf.LinesNum()-1)
|
||||
return s
|
||||
}
|
||||
return w.scroll(s, n)
|
||||
|
||||
Reference in New Issue
Block a user