File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ func (m ftModel) SetCursor(cursor int) ftModel {
4444 return m
4545}
4646
47+ const contextLines = 15
48+
4749func (m * ftModel ) scrollSelectedFileIntoView (t * tree.Tree ) {
4850 children := t .Children ()
4951 for i := 0 ; i < children .Length (); i ++ {
@@ -54,11 +56,10 @@ func (m *ftModel) scrollSelectedFileIntoView(t *tree.Tree) {
5456 case filetree.FileNode :
5557 if child .Path () == * m .selectedFile {
5658 // offset is 1-based, so we need to subtract 1
57- // we subtract another another 2 because offset should show the node and it's parent
58- offset := child .YOffset - 3
59+ offset := child .YOffset - 1 - contextLines
5960 // we also need to subtract 1 if the root is not shown
6061 if m .tree .Value () == "." {
61- offset = child . YOffset - 1
62+ offset = offset - 1
6263 }
6364 m .vp .SetYOffset (offset )
6465 }
You can’t perform that action at this time.
0 commit comments