Skip to content

Add r.runSelectionRetainCursor#325

Merged
renkun-ken merged 1 commit intoREditorSupport:masterfrom
renkun-ken:run-retain-cursor
May 16, 2020
Merged

Add r.runSelectionRetainCursor#325
renkun-ken merged 1 commit intoREditorSupport:masterfrom
renkun-ken:run-retain-cursor

Conversation

@renkun-ken
Copy link
Copy Markdown
Member

What problem did you solve?

Closes #324

This PR adds a new command r.runSelectionRetainCursor that runs selection but does not move cursor.

(If you do not have screenshot) How can I check this pull request?

Run command r.runSelectionRetainCursor when cursor is at the first line of the following code:

m <- rnorm(100)
n <- rnorm(100)

then the first line should be sent to terminal but the cursor does not move.

It should also work with multi-line expression. Run when cursor is at first of last line:

m <- local({
  x <- rnorm(100)
  y <- rnorm(100)
})

Both should send the entire expression but cursor should not move.

@renkun-ken renkun-ken requested a review from andycraig May 16, 2020 02:21
Comment thread package.json
},
{
"command": "r.runSelectionRetainCursor",
"key": "alt+enter",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set up the key binding here but I'm not sure why it does not come to be my default key bindings when I run the extension.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me alt+enter worked without needing to change anything. Maybe you have something else bound to alt+enter that has higher priority?

Copy link
Copy Markdown
Collaborator

@andycraig andycraig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tested on Windows.

@renkun-ken
Copy link
Copy Markdown
Member Author

Thanks for testing!

@renkun-ken renkun-ken merged commit c596758 into REditorSupport:master May 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run code block but leave cursor in existing position (Rstudio feature)

2 participants