mangecoeur / document-outline

Atom plugin for showing interactive document outlines
GNU General Public License v3.0
37 stars 20 forks source link

Also auto-jump to the right position in markdown-preview(-plus) when clicking document outline [feature request] #38

Open salim-b opened 6 years ago

salim-b commented 6 years ago

Right now when I click on a header in the document outline, the editor jumps automatically to the corresponding position in the source file. When I write Markdown, I normally have a preview opened side-by-side with the source (using package markdown-preview-plus). Therefore it would be awesome to have the same auto-jump functionality for the preview, too!

awmartin commented 6 years ago

How does one enable this click-to-jump feature? When I click on a header in the document outline, nothing happens.

awmartin commented 6 years ago

I see. It just scrolls, unless you are already there. I would expect it to focus the editor and place the cursor on that header line.

mangecoeur commented 6 years ago

@awmartin it doesn't move the cursor, under the idea that you might want to jump to a heading to look up something without loosing the place where you were typing.

awmartin commented 6 years ago

@mangecoeur Yeah, I understand, but that doesn't really match my workflow. I want to click to navigate, not just look things up and go back, which is much rarer for me and involves too much clicking. This is also consistent with other editors I use, like Google Docs. I also generally remember where I'm coming from, and use bookmarks to hold my place.

But that's ok, I've already modified my fork to do what I need (move the cursor, select the header in the editor, and focus the editor pane). Sounds like a behavior that could be an option though, if you're open to PRs.

salim-b commented 6 years ago

it doesn't move the cursor, under the idea that you might want to jump to a heading to look up something without loosing the place where you were typing.

Generally that seems sensible. But there's a problem: By clicking an entry in the document outline the cursor currently loses focus. This makes it kinda hard to figure out where you came from (at least in large documents; the only hint seems the highlighting in the document outline). Is there a shortcut to get back to your cursor position or something?

I've already modified my fork to do what I need (move the cursor, select the header in the editor, and focus the editor pane). Sounds like a behavior that could be an option though

:+1:

mangecoeur commented 6 years ago

by clicking an entry in the document outline the cursor currently loses focus

that's a bit atom's fault, this didn't happen with the old 'panels' system but the new 'docks' messes with the focus. Not really dug enough into this. If you just start typing it should jump back to where you were before (though TBH not sure if that detail actually works right now).

salim-b commented 6 years ago

If you just start typing it should jump back to where you were before (though TBH not sure if that detail actually works right now).

Nope, doesn't work. Nothing happens when you start typing ('cause the cursor doesn't have focus 😜 ).

mangecoeur commented 6 years ago

@salim-b bum, I opened #58 issue for that problem. FYI the latest version supports the outline view from Atom-IDE which might behave better (this package will simply provide the heading outline for their view, you can then disable the built-in one by disabling 'auto display')