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

restore cursor position after fix command #853

Merged
merged 2 commits into from
Mar 20, 2017

Conversation

yacut
Copy link
Contributor

@yacut yacut commented Mar 17, 2017

The cursor at the moment jumps to the beginning of the file after the fix command. It infuriates me :)

Copy link
Member

@Arcanemagus Arcanemagus left a comment

Choose a reason for hiding this comment

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

This code will not do what you are saying, since by definition the buffer will have changed so the position you save initially will no longer be the position after the fixes are applied.

That being said though... this will get close in most situations, and is better than what we have currently so I'd be okay with merging this in pending approval from @IanVS.

Copy link
Member

@IanVS IanVS left a comment

Choose a reason for hiding this comment

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

This seems reasonable. We can't consistently reproduce the buffer reset problem, so unfortunately we can't test that this actually has the intended effect. But it doesn't seem to hurt anything. The only request I would make is to add some comments to explain why this is being done. I don't think it's obvious by looking at the code why we would need to do this.

@IanVS IanVS merged commit 27d5570 into AtomLinter:master Mar 20, 2017
@IanVS
Copy link
Member

IanVS commented Mar 20, 2017

Thanks for the contribution, @yacut!

@yacut
Copy link
Contributor Author

yacut commented Apr 3, 2017

@IanVS, could you please publish the changes?

@IanVS
Copy link
Member

IanVS commented Apr 3, 2017

Actually, I've been using master lately which includes this change, and it does not seem to have fixed the underlying problem, unfortunately. We may need to revert it back out, since it does not have the intended effect. Before we do that, it would be great if I could get confirmation from someone else that this does not solve the cursor problem.

To do that, uninstall linter-eslint from atom, clone this repo, then apm link from inside the repo. Then use it for a while and see if the cursor still jumps to the start of the file occationally when fixing on save.

@yacut
Copy link
Contributor Author

yacut commented Apr 3, 2017

I already installed it from the master and it's works works for me: https://media.giphy.com/media/3o7bubhh3ZUgFe41qg/giphy.gif
The cursor stays in the current position after the autofix.

@IanVS
Copy link
Member

IanVS commented Apr 3, 2017

It usually works for me too, the cursor resetting is intermittent. Can you leave it on for several days and report back whether it never resets. It happens once or twice a day for me, usually.

Arcanemagus added a commit that referenced this pull request Apr 6, 2017
@Arcanemagus Arcanemagus mentioned this pull request Apr 6, 2017
Arcanemagus added a commit that referenced this pull request Apr 13, 2017
Arcanemagus added a commit that referenced this pull request Apr 13, 2017
Arcanemagus added a commit that referenced this pull request Apr 27, 2017
Arcanemagus added a commit that referenced this pull request May 3, 2017
Arcanemagus added a commit that referenced this pull request May 3, 2017
Arcanemagus added a commit that referenced this pull request May 19, 2017
Arcanemagus added a commit that referenced this pull request May 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants