Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

preview selected file on key 'right' #413

Closed
wants to merge 1 commit into from
Closed

preview selected file on key 'right' #413

wants to merge 1 commit into from

Conversation

monsterkodi
Copy link

  • Added a new command preview-selected-entry and attached it to the right cursor key.
  • The preview-selected-entry command is the same as open-selected-entry but with a false activatePane argument for the openSelectedEntry method.
  • Added specs to test the new behaviour.
    Fixed specs for tree-view:open-selected-entry, they didn't test the command properly.

@thedaniel
Copy link
Contributor

I think this is going to need to be rethought in the context of atom's preview tabs (cf. atom/tabs#145), though I'm generally pro adding a preview keybinding to tree-view. Thoughts?

You can simulate this behavior by turning on preview tabs in the tabs package, then hitting enter will open a preview tab that will go away unless it's modified. So this could be reimplemented as a keybinding to tree-view:open-selected-entry that then refocuses the tree-view.

It might be confusing if the tabs package has preview tabs turned off, though. Then right-arrow would be something like 'open without focus' in that context, which is perhaps useful but also potentially confusing.

@atom/feedback any thoughts here? I'm not sure if @monsterkodi is still interested in this after six months but previewing/opening does seem to be like a very comfortable binding for right-arrow in the tree view.

@monsterkodi
Copy link
Author

yes, I would still be interested in a fix for this, even after six month ;-)

I don't think there would be any problem with the preview tabs settings on or off.

The point is this:
I can open/preview a file without setting focus on the editor by clicking with the mouse in the treeview.
But I can't do the same via the keyboard.

@monsterkodi
Copy link
Author

I made myself a command that implements your suggestion, so I don't have to wait another half a year.
thanks for the hint :-)

atom.commands.add '.tree-view', 'tree-view:preview', ->
    for panel in atom.workspace.getLeftPanels()
        if panel.item.constructor.name == "TreeView"
            panel.item.openSelectedEntry(false)
            return

I still think that somthing similar should be implemented in the tree-view itself.

@thedaniel
Copy link
Contributor

Glad you were able to solve it for yourself - I'm going to tag this with help-wanted in case anyone else wants to pick it up again for tree-view.

@monsterkodi
Copy link
Author

you helped me help myself :-) thank you.

@kuychaco
Copy link
Contributor

Feature added in #712. Thanks @monsterkodi!

@kuychaco kuychaco closed this Jan 27, 2016
@monsterkodi
Copy link
Author

Thank you, kuychaco.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants