7ute / symbols-list

An alternate symbol list sidebar for Atom.io text editor
GNU General Public License v3.0
32 stars 24 forks source link

Configure scroll position of target symbol on click #18

Closed gnbl closed 7 years ago

gnbl commented 8 years ago

When I click a symbol for a Python file, the editor window scrolls to the resulting cursor, but the behaviour is a bit irritating as the line in question may be all the way at the bottom of the editor window, so the function is not visible and I need to scroll down further manually. If would be nice if this behaviour were customisable, i.e. scroll-after-jump so that the cursor is vertically centered or say 10 lines from the top or even in the top line..

However, Atom's "Symbols" package seems to behave similarly -- is this desired behaviour? If yes, why?

7ute commented 8 years ago

Yup, it does annoy me too. I think that its related to the function called to scroll to the line. It seem to seek the line and stop as soon as it's in the code view. The function is texteditor's scrollToCursorPosition ( https://atom.io/docs/api/v1.2.4/TextEditor#instance-scrollToCursorPosition ) and the only option it gets is "center", which behaves in an also annoying way : it centers the target line in the middle of the view.

Maybe i should let the user decide which way it prefers by adding an option in the plugin's settings?

mbuc82 commented 7 years ago

Hello together,

i've added new configuration settings in the meantime (Positioning), which take care of adjusting the scroll positions after clicking on a symbol. It's now possible select from three options: "Center", "ScrollFromTop" and "ScrollFromBottom".

If "Center" is selected, it vertically centers the selected line after jumping to the symbol. If "ScrollFromTop" or "ScrollFromBottom" is selected, the value of the setting "Position Scroll" will be used to scroll either the amount of lines from the top of the visible screen or from the bottom.

This gives the user as much freedom as possible to modify the behavior as desired.

Regards Marco

gnbl commented 7 years ago

Wow, time flies. Thank you, I'll check it out.