Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Jun 19, 2017

This PR allows for API calls of the form:

.rs.api.navigateToFile("file", -1L, -1L)

to preserve the preserve cursor position when the file "file" is opened. A corresponding change in the rstudioapi package will be made to take advantage of this behavior.

rstudio/rstudioapi#48

@kevinushey kevinushey force-pushed the feature/rstudioapi-source-navigation-preserve-position branch from 23573b8 to 548dff3 Compare June 19, 2017 18:49
// preserve whatever position was used in the document earlier
boolean navigateToPosition =
position != null &&
(position.getLine() != -1 && position.getColumn() != -1);
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Doesn't this treat any position with a -1 component as non-navigable rather than the -1, -1 special pair?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right! Nice catch; I'll fix that up.

allow navigation when either is not -1
@jmcphers jmcphers merged commit 272588b into master Jun 19, 2017
@valerie-rstudio valerie-rstudio deleted the feature/rstudioapi-source-navigation-preserve-position branch January 21, 2022 17:23
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.

3 participants