Skip to content

Commit

Permalink
Fixed buffers decoration
Browse files Browse the repository at this point in the history
  • Loading branch information
jubianchi committed Nov 19, 2015
1 parent fe1ca14 commit 4940d6f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions lib/decorator.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{ CompositeDisposable } = require 'atom'

module.exports =
class AtoumDecorator
constructor: ->
@reset()

reset: ->
@subscriptions?.dispose()

@subscriptions = new CompositeDisposable
@markers = {}

findLineStart: (line) ->
Expand All @@ -21,11 +26,16 @@ class AtoumDecorator
decorate: (editor, file) ->
return unless @markers[file]

gutter = editor.addGutter
name: 'atoum'
priority: 100
gutter = editor.gutterWithName 'atoum'

unless gutter
gutter = editor.addGutter
name: 'atoum'
priority: 100

@markers[file].forEach (test, index) =>
return unless test.line

line = editor.lineTextForBufferRow(test.line - 1)
range = [[test.line - 1, @findLineStart(line)], [test.line - 1, @findLineEnd(line)]]
marker = editor.markBufferRange range, invalidate: 'touch'
Expand Down
2 changes: 1 addition & 1 deletion lib/parser.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class AtoumParser extends Emitter
if matches
if fs.existsSync(matches[1])
@test.file = matches[1]
@test.line = matches[2]
@test.line = parseInt(matches[2], 10) if matches[2]
else
@test.diag += line.replace(/^#\s+/g, '') + '\n'
else
Expand Down

0 comments on commit 4940d6f

Please sign in to comment.