jayhjkwon / atom-block-comment

block comment/uncomment for atom editor
MIT License
13 stars 11 forks source link

[wish] Cursor positioning between comment brackets #2

Open rhoconlinux opened 10 years ago

rhoconlinux commented 10 years ago

Hi! Great work! I think a really cool feature could be just to move the cursor a couple of characters back, so the writing start just inside the block-comment. For instance, in css the comment is /* / and the cursor after the shortcut is on the "X", like /* /X. It would be great to have the cursor inside the comment, so the writing is immediate, hence the cursor position should be something like /* X */. Thanks!

jneuendorf commented 10 years ago

In the file "block-comment.coffee" (in the lib folder) add the following code after the line editor.insertText("#{commentStart+selection+commentEnd}") (around line 40):

pos = editor.getCursorBufferPosition() editor.setCursorBufferPosition([pos.row, pos.column - commentEnd.length])