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 {
44
44
return m
45
45
}
46
46
47
+ const contextLines = 15
48
+
47
49
func (m * ftModel ) scrollSelectedFileIntoView (t * tree.Tree ) {
48
50
children := t .Children ()
49
51
for i := 0 ; i < children .Length (); i ++ {
@@ -54,11 +56,10 @@ func (m *ftModel) scrollSelectedFileIntoView(t *tree.Tree) {
54
56
case filetree.FileNode :
55
57
if child .Path () == * m .selectedFile {
56
58
// 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
59
60
// we also need to subtract 1 if the root is not shown
60
61
if m .tree .Value () == "." {
61
- offset = child . YOffset - 1
62
+ offset = offset - 1
62
63
}
63
64
m .vp .SetYOffset (offset )
64
65
}
You can’t perform that action at this time.
0 commit comments