Focus project by shortcut / click

Hi,

I do a lot with keyboard shortcuts, so it would be nice you can focus a project via a shortcut. Like CMD-] in TP2 (in TP3 this shortcut is used for line right).

Now there is also no option to focus on a project (f.e. when sidebar is closed) via a mouse click. An option could be CMD-click on the project title.

An other thing: when hovering over the blue dot, the mouse pointer is not changing into a hand, so you know that you can click.

regards,
feek

For me it turns into an arrow… that’s not happening for you?

nope, not for me! No changes when hovering.

Adding to my list, thanks.

@jessegrosjean Do you plan to add a command to focus on projects?

Here’s a scenario I’m constantly facing: from a filtered view I want focus on the project which the cursor is placed. Today, I have to type CMD+L than navigate to the project in the sidebar (with the arrow keys or typing some characters of its name to use the fuzzy filter). But this could be achieved with just one keyboard shortcut, for example CMD+OPT+L, if we had a “Focus Project” or “Go to Current Project” command.

As I don’t use the mouse when interacting with Taskpaper, I’d like a keyboard shortcut for the action available when I OPT+CLICK the bullet of the project title.

Yes, I am planning to add a command to focus the current project with menu item/keyboard shortcut.

1 Like

I think the caret probably does change to an arrow for feek. I think he just misread your reply because he’s expecting the cartoony hand. In the last version of TP, the cursor changed into the hand, not an arrow. The hand definitely makes more sense, cognitively. The pointer communicates that the blue dot is not clickable, which is weird, because it is clickable.

I agree with feck, I miss the option to focus a project by mouse when the sidebar is closed. Maybe it could be a toggleable preference, whether the click on the blue dot results in focusing or folding? Which would make the other option the one that would work with a Command-click, for instance.

Hey @jessegrosjean - just wondering, was this option already implemented?

Yes, there are now the “Go in” and “Go out” menu commands that focus in on the current item or focus out. You can also Option-Click on an item handle to “hoist” that item… I need to change that to “focus” the item I think.

Hoist means only show the items children. Focus means show the item and it’s children.

I’ve just tried the “Go In” and “Go out” commands as I was looking for a way to focus from the project from the keyboard. The results are inconsistent in the sense that “going in” and “going out” afterwards give different results. As an illustration for a sample project which is one project of many

Sample Project 1:
      - some other no so important item

 Sample Project 2:
       - Item 1
       - Item 2
       - Item 3
             - subitem 1

Let’s say I’ve got the cursor on Item2 in Project 2 and would like to focus on that project. The “go in” only gives me Item2 by itself. If I “go out” again I get all of Sample Project 2 (which is what I wanted) and a final “go out” and I get all projects again.

From my perspective It would be more a consistent behaviour if the first “go-in” showed Project 2 and then a 2nd “go in” the Item (+ possible subitems) as it does for the “go-out”.

Malcolm

I agree it should be changed so that Go In/Go Out mirror each other… so I need to maintain a stack of “Go In” items. I’ve added that to my list.

I’m less sure how the “Go In” behavior should work. Three choices:

  1. Curent behavior, alway focus the item with text caret.
  2. Focus item with text caret if it has children.
  3. Focus item if it’s a project, or enclosing project if item is not a project.

I think you are advocating #3, which I think is also TaskPaper 2’s behavior, though TaskPaper 2’s implementation was different in a number of ways. The reason that I’ve chosen to go with behavior 1 is because it’s the most direct and the most flexible.

In particular:

  • It always acts on the selected item.
  • You can use it to focus even if you don’t use projects for organization.

Thanks Jesse. I was asking myself the same question. I prefer #3 for two reasons:

  • Conceptually it’s easy and consistent for me to understand that each “go-in” drills down one level in the hierarchy (project, item, subitem etc…) until it reaches the level of the selected item. “go-out” already does this but in reverse
  • Once you know the keyboard shortcut this is very quick and convenient to step through a number of levels and the project view is always useful.

For some users it may be convenient at times to go directly to the level of the selected item. In that case I would recommend a separate “go to” rather than “go in” command or similar which does what go-in currently does.

Hey, @jessegrosjean, what about keeping the active search persistent when Going In and Going Out?

For example: I’m viewing a filtered list of my @today tasks from various projects and I want to Go In a project to focus that project’s @today tasks. As I’m already seeing a filtered view, when I Go In I expect to see a filtered view for that project I’m focusing, but, the way it is implemented, both Go In and Go Out clear the search and the result is the complete list of subitems from that project.

For me, keeping the search persistent seems to be a better option. If I want to clear the filter “after the move” I can explicitly do it with Clear Search (cmd+esc).

I’m not sure. It would certainly be nice sometimes, but it would also be very confusing I think for new user’s who have accidentally clicked on a tag. See view unexpectedly filtered. And then click on project in sidebar and still see view filtered with no idea how to get out of the search. That’s the reason that I clear it… when you go to a project, I want that view to be consistent each time.

With that said your request seems more focused … just Go In and Go Out… still clear when click on project in sidebar, and when use toolbar Go to Project popup? I could go for that more…

I don’t expect I’ll add any of this right away, in the meantime you could just implement your own Go In/Go Out commands with a script quite easily. Here’s my current implementation that you could adapt (this code is coffeescript, and “this” is “@”. And in this context “this” is equal to the editor instance that’s passed into your script.

edit Your script needs to be in JavaScript, not coffeescript. To convert the code below from CoffeeScript to JavaScript syntax you can paste it into the “Try CoffeeScript” text area on http://coffeescript.org.

  focusIn: ->
    @focusedItem = @selection.startItem

  focusOut: ->
    selection = @selection
    focusedItem = @focusedItem
    startItem = selection.startItem
    scrollDocumentY = @scrollPoint.y
    selectedDocumentY = @getRectForRange(selection.location, 0).y
    selectedWindowY = selectedDocumentY - scrollDocumentY

    if focusedItem
      newFocusItem = focusedItem.parent
    else
      newFocusItem = @hoistedItem

    if newFocusItem.isOutlineRoot
      @hoistedItem = newFocusItem
    else
      @focusedItem = newFocusItem

    startItem = @getDisplayedSelfOrAncestor(startItem)
    @moveSelectionToItems(startItem)
    scrollDocumentY = @scrollPoint.y
    selectedDocumentY = @getRectForRange(@selection.location, 0).y
    newSelectedWindowY = selectedDocumentY - scrollDocumentY
    @scrollBy(0, newSelectedWindowY - selectedWindowY)

To change so that search isn’t cleared you’ll need to save and then restore the value of @itemPathFilter.

1 Like

Yes, I was talking about the Go In and Go Out commands. I had not thought about the Go to Project, but now that you’ve mentioned it, I have to think about the search persistence in this case. I’m not sure, but I think I’d like to keep the active search in this case too.

At first, it seems reasonable to have an option in Preferences to keep the search persistent when changing projects. This option could be disabled at first, preventing the confusion it could cause for new users. But I’m sure other “old users” would like to enable it, like me.

Anyway, thanks for the script. I’ll try it later. It really seems to be a great workaround. And thanks for keep listening us, users of Taskpaper. You’re doing an awesome job! :wink:

1 Like