File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -1144,7 +1144,7 @@ func (nav *nav) high() bool {
1144
1144
1145
1145
old := dir .ind
1146
1146
beg := max (dir .ind - dir .pos , 0 )
1147
- offs := gOpts .scrolloff
1147
+ offs := min ( nav . height / 2 , gOpts .scrolloff )
1148
1148
if beg == 0 {
1149
1149
offs = 0
1150
1150
}
@@ -1175,7 +1175,14 @@ func (nav *nav) low() bool {
1175
1175
old := dir .ind
1176
1176
beg := max (dir .ind - dir .pos , 0 )
1177
1177
end := min (beg + nav .height , len (dir .files ))
1178
- offs := gOpts .scrolloff
1178
+
1179
+ offs := min (nav .height / 2 , gOpts .scrolloff )
1180
+ // use a smaller value for half when the height is even and scrolloff is
1181
+ // maxed in order to stay at the same row when using both high and low
1182
+ if nav .height % 2 == 0 {
1183
+ offs = min (nav .height / 2 - 1 , gOpts .scrolloff )
1184
+ }
1185
+
1179
1186
if end == len (dir .files ) {
1180
1187
offs = 0
1181
1188
}
You can’t perform that action at this time.
0 commit comments