atom / fuzzy-finder

Find and open files quickly
MIT License
275 stars 138 forks source link

Buffer list not reliably sorted by MRU #250

Closed wprater closed 7 years ago

wprater commented 8 years ago

I use the the hot key to swap back/forth from MRU tabs, but they seem to loose context. I recall the file I used after editing my current two, so I should be able to pull up fuzzy finder and hit down twice, but this rarely seems to work.

maybe its related to https://github.com/atom/tabs/issues/314

Ben3eeE commented 7 years ago

Can you still reproduce this in Atom 1.11 or later?

wprater commented 7 years ago

Im not using Atom any longer, so it will be harder for me to test. Feel free to close this and we can re-open if it's still occurring?

Ben3eeE commented 7 years ago

/cc: @iolsen MRU UX

iolsen commented 7 years ago

The similar report in https://github.com/atom/tabs/issues/314 is fixed in https://github.com/atom/atom-keymap/pull/156 which will ship in 1.14.

But I see that fuzzy-finder maintains its own notion of MRU, separate from the list in the core pane class, that should be providing the behavior described but doesn't:

https://github.com/atom/fuzzy-finder/blob/master/lib/main.coffee#L21:

    atom.workspace.observePanes (pane) ->
      pane.observeActiveItem (item) -> item?.lastOpened = Date.now()

https://github.com/atom/fuzzy-finder/blob/master/lib/buffer-view.coffee#L19:

  populate: ->
    editors = atom.workspace.getTextEditors().filter (editor) -> editor.getPath()?
    activeEditor = atom.workspace.getActiveTextEditor()
    editors = _.sortBy editors, (editor) ->
      if editor is activeEditor
        0
      else
        -(editor.lastOpened or 1)

    @paths = editors.map (editor) -> editor.getPath()
    @setItems(_.uniq(@paths))

So this appers to be a legit, distinct, bug report we should (at least) leave open. We should figure out why this order by open date isn't working or use the core pane class's MRU list instead. Updating labels accordingly.

iolsen commented 7 years ago

After a closer reading and a bit more testing, I actually think this works as intended. The critical fact is that the CURRENT buffer is sorted to the bottom, so it's not a precise MRU order but that's sensible and clearly intentional here. And the other buffers in the list do appear to be sorting correctly in 1.12 and 1.13.

Closing this until/unless there's a repro in recent versions.

m3talstorm commented 7 years ago

I think this follows on from this issue, if you have a file open (in a tab) called "blah_edit.html", but your project contains say 20 other "_edit.html" files and you ctrl+p and search for "edit" your open file will not be at the top, it will be somewhere else in the list.