@@ -119,12 +119,34 @@ BlameListView = React.createClass
119
119
error : true
120
120
dirty : false
121
121
else
122
+ data = @ prepareDataForCurrentEditorState (data)
122
123
@setState
123
124
loading : false
124
125
error : false
125
126
dirty : false
126
127
annotations : data
127
128
129
+ # Modifies the blame data for the current editor state, taking
130
+ # folds into account.
131
+ # TODO: Handle soft wraps here as well
132
+ prepareDataForCurrentEditorState : (originalData ) ->
133
+ filteredLineData = []
134
+ highestScreenRowSeen = 0
135
+ e = @ editor ()
136
+
137
+ # loop through the blame data and filter out the blame line rows
138
+ # for lines that are not visible on the screen due to wrapped code
139
+ # TODO: Handle soft wraps here.
140
+ # Using each instead of _.filter() since I will need to add empty rows
141
+ # for line wraps
142
+ _ .each originalData, (lineData , index ) ->
143
+ screenRow = e .screenPositionForBufferPosition ([index, 0 ]).row
144
+ if screenRow == index or screenRow > highestScreenRowSeen
145
+ filteredLineData .push lineData
146
+ highestScreenRowSeen = screenRow
147
+
148
+ return filteredLineData
149
+
128
150
# bound callback for Editor 'contents-modified' event
129
151
contentsModified : ->
130
152
return unless @ isMounted ()
@@ -137,8 +159,9 @@ BlameListView = React.createClass
137
159
138
160
# bound callback for Editor 'screen-lines-changed' event
139
161
screenLinesChanged : ->
140
- console .log ' screen-lines-changed!'
141
- return
162
+ return unless @ isMounted ()
163
+ @ loadBlame () if @state .visible
164
+ @ matchScrollPosition ()
142
165
143
166
toggle : ->
144
167
if @state .visible
0 commit comments