@@ -13,29 +13,26 @@ class DiffListView extends SelectListView
13
13
14
14
viewForItem : ({oldStart, newStart, oldLines, newLines}) ->
15
15
bufferRow = if newStart > 0 then newStart - 1 else newStart
16
+ lineText = @editor .lineForBufferRow (bufferRow) ? ' '
16
17
$$ ->
17
18
@ li class : ' two-lines' , =>
18
- @ div atom . workspace . getActiveEditor () ? . lineForBufferRow (bufferRow) , class : ' primary-line'
19
+ @ div lineText , class : ' primary-line'
19
20
@ div " -#{ oldStart} ,#{ oldLines} +#{ newStart} ,#{ newLines} " , class : ' secondary-line'
20
21
21
22
populate : ->
22
- if editor = atom .workspace .getActiveEditor ()
23
- diffs = atom .project .getRepo ()? .getLineDiffs (editor .getPath (), editor .getText ()) ? []
24
- @ setItems (diffs)
23
+ diffs = atom .project .getRepo ()? .getLineDiffs (@editor .getPath (), @editor .getText ()) ? []
24
+ @ setItems (diffs)
25
25
26
26
toggle : ->
27
27
if @ hasParent ()
28
28
@ cancel ()
29
- else
29
+ else if @editor = atom . workspace . getActiveEditor ()
30
30
@ populate ()
31
31
@ attach ()
32
32
33
33
confirmed : ({newStart})->
34
34
@ cancel ()
35
35
36
- editorView = atom .workspaceView .getActiveView ()
37
- if editor = editorView ? .getEditor ? ()
38
- bufferRow = if newStart > 0 then newStart - 1 else newStart
39
- editorView .scrollToBufferPosition ([bufferRow, 0 ], center : true )
40
- editor .setCursorBufferPosition ([bufferRow, 0 ])
41
- editor .moveCursorToFirstCharacterOfLine ()
36
+ bufferRow = if newStart > 0 then newStart - 1 else newStart
37
+ @editor .setCursorBufferPosition ([bufferRow, 0 ], autoscroll : true )
38
+ @editor .moveCursorToFirstCharacterOfLine ()
0 commit comments