       for token in tokenizedLine.tokens
         if not token.firstNonWhitespaceIndex
           return [[lineNumber, 0], [lineNumber, offset]]
-        if token.firstNonWhitespaceIndex isnt token.bufferDelta
+        if token.firstNonWhitespaceIndex isnt token.value.length
           return [[lineNumber, 0], [lineNumber, offset + token.firstNonWhitespaceIndex]]
-        offset += token.bufferDelta
+        offset += token.value.length
     when 'E262', 'E265'
       # E262 - inline comment should start with '# '
       # E265 - block comment should start with '# '

      for token in tokenizedLine.tokens
        if 'meta.function-call.python' in token.scopes
          if token.value is 'locals'
            return [[lineNumber, offset], [lineNumber, offset + token.bufferDelta]]
        offset += token.bufferDelta
    when 'W291'
      # W291 - trailing whitespace
      screenLine = tokenizedLineForRow(textEditor, lineNumber)

tokenizedLineForRow = (textEditor, lineNumber) ->
  # Uses non-public parts of the API, liable to break at any time!
  if (textEditor.hasOwnProperty('displayBuffer'))
    # Atom < 1.9.0
    # FIXME: Remove when 1.9.0 is released!
    tokenBuffer = textEditor.displayBuffer.tokenizedBuffer
  else
    tokenBuffer = textEditor.tokenizedBuffer
  tokenBuffer.tokenizedLineForRow(lineNumber)
fs = require('fs')
path = require('path')
{CompositeDisposable} = require 'atom'
