Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes navigation scrolls to the right #1139

Merged
merged 1 commit into from
Jul 6, 2019
Merged

Conversation

stoivo
Copy link
Member

@stoivo stoivo commented Jul 5, 2019

No description provided.

# The following shouldn't strictly be necessary, but Sublime sometimes
# jumps to the right when show_at_center for a column-zero-point occurs.
_, vp_y = view.viewport_position()
view.set_viewport_position((0, vp_y), False)
Copy link
Collaborator

Choose a reason for hiding this comment

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

view is undefined. (Maybe we should start using flake8?)

@@ -32,6 +32,11 @@ def run(self, edit, forward=True):
sel.add(sublime.Region(new_position, new_position))
self.view.run_command("show_at_center")
Copy link
Collaborator

Choose a reason for hiding this comment

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

The modern version of this is self.view.show_at_center(new_position)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Following a rule for legacy code: Whenever you open a file to edit, leave it in a better state.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thats true, thanks

@kaste
Copy link
Collaborator

kaste commented Jul 6, 2019

That's probably a good idea!

The commit message is wrong, it should be more like "Pin viewport's x-axis to 0 after navigate".

Sometimes navigation scrolls to the right, allways scroll back to left.
@kaste
Copy link
Collaborator

kaste commented Jul 6, 2019

👍 :shipit:

@stoivo stoivo merged commit 6d402de into dev Jul 6, 2019
@kaste
Copy link
Collaborator

kaste commented Jul 6, 2019

The same 'shift-to-right' can happen if we replace the buffers content, so maybe we should add that to our replace-content command as well.

@stoivo stoivo deleted the navigate_show_at_center branch July 6, 2019 20:04
@stoivo
Copy link
Member Author

stoivo commented Jul 6, 2019

I have never experienced that, but if you say so. Would you make that PR.

I am for adding flake8. We have used pycodestyle for a while. As I quickly rescearch I fould that we can run both and that should confilict.
#1140

@stoivo
Copy link
Member Author

stoivo commented Jul 6, 2019

A small correction. We did have flake8 setup in setup.cfg but we should run it on CI and I should setup the linter in sublime.

@kaste
Copy link
Collaborator

kaste commented Jul 6, 2019

The whole project has a dozens flake8 errors right now that's why I never turned them on on CI 😁

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.

None yet

2 participants