Skip to content

Commit 945085a

Browse files
committed
add in bound callback for Editor 'screen-lines-changed' event
1 parent 09047d2 commit 945085a

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

lib/views/blame-list-view.coffee

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,6 @@ BlameListView = React.createClass
110110
else
111111
"translate(0px, #{-scrollTop}px)"
112112

113-
componentWillMount: ->
114-
# kick off async request for blame data
115-
@loadBlame()
116-
@editor().on 'contents-modified', @contentsModified
117-
@editor().buffer.on 'saved', @saved
118-
119113
loadBlame: ->
120114
@setState loading: true
121115
@props.projectBlamer.blame @editor().getPath(), (err, data) =>
@@ -131,14 +125,21 @@ BlameListView = React.createClass
131125
dirty: false
132126
annotations: data
133127

128+
# bound callback for Editor 'contents-modified' event
134129
contentsModified: ->
135130
return unless @isMounted()
136131
@setState dirty: true unless @state.dirty
137132

133+
# bound callback for Editor.buffer 'saved' event
138134
saved: ->
139135
return unless @isMounted()
140136
@loadBlame() if @state.visible and @state.dirty
141137

138+
# bound callback for Editor 'screen-lines-changed' event
139+
screenLinesChanged: ->
140+
console.log 'screen-lines-changed!'
141+
return
142+
142143
toggle: ->
143144
if @state.visible
144145
@setState visible: false
@@ -151,9 +152,17 @@ BlameListView = React.createClass
151152
# blame gutter.
152153
@scrollbar().on 'scroll', @matchScrollPosition
153154

155+
componentWillMount: ->
156+
# kick off async request for blame data
157+
@loadBlame()
158+
@editor().on 'contents-modified', @contentsModified
159+
@editor().on 'screen-lines-changed', @screenLinesChanged
160+
@editor().buffer.on 'saved', @saved
161+
154162
componentWillUnmount: ->
155163
@scrollbar().off 'scroll', @matchScrollPosition
156164
@editor().off 'contents-modified', @contentsModified
165+
@editor().off 'screen-lines-changed', @screenLinesChanged
157166
@editor().buffer.off 'saved', @saved
158167

159168
# Makes the view arguments scroll position match the target elements scroll

0 commit comments

Comments
 (0)