Skip to content
This repository has been archived by the owner on Aug 14, 2022. It is now read-only.

Commit

Permalink
For lineNumber use getCursorBufferPosition()
Browse files Browse the repository at this point in the history
When using getCursorScreenPosition() with soft wrap the line number is
incorrect and the location in the document is incorrect. Instead use
getCursorBufferPosition() which does not count wrapped lines.
For further details see
https://atom.io/docs/api/v0.187.0/TextEditor#buffer-vs-screen-coordinates

Closes #68
  • Loading branch information
jacoblchapman authored and thomasjo committed Mar 17, 2015
1 parent bbf3ec1 commit c934ee2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/composer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class Composer

editorDetails =
filePath: editor.getPath()
lineNumber: editor.getCursorScreenPosition().row + 1
lineNumber: editor.getCursorBufferPosition().row + 1

alterParentPath: (targetPath, originalPath) ->
targetDir = path.dirname(targetPath)
Expand Down

0 comments on commit c934ee2

Please sign in to comment.