atom / symbols-view

Jump to symbols in Atom
MIT License
165 stars 115 forks source link

go-to-declaration does not center around symbol #181

Closed anaskiee closed 8 years ago

anaskiee commented 8 years ago

When triggerring function go-to-declaration, the editor window is not center around the symbol as expected.

I fixed it by doing this in lib/symbols-view.coffee :

-      editor.scrollToBufferPosition(position, center: true)
       editor.setCursorBufferPosition(position)
       editor.moveToFirstCharacterOfLine() if beginningOfLine
+      editor.scrollToBufferPosition(position, center: true)

You can analyse it by breaking into text-editor-presenter.js functions :

It seems that the functions setCursorBufferPosition and moveToFirstCharacterOfLine override the option {center: true} of scrollToBufferPosition. As a consequence, the function commitPendingLogicalScrollTopPosition doesn't have the option anymore. It is due to the fact that the calls are not synchronous, they're stored as event and are somehow concurrent...

I can open a pull request if needed

50Wliu commented 8 years ago

I can open a pull request if needed

Yes please! Contributions always welcome.

anaskiee commented 8 years ago

Actually, I found that there is already a pull request associated to this bug https://github.com/atom/symbols-view/pull/136

The issue associated is the following : https://github.com/atom/symbols-view/issues/132

50Wliu commented 8 years ago

Ok, then I'm closing this issue in favor of #132.