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

Buffer list not reliably sorted by MRU #250

Closed
wprater opened this issue Aug 4, 2016 · 6 comments
Closed

Buffer list not reliably sorted by MRU #250

wprater opened this issue Aug 4, 2016 · 6 comments

Comments

@wprater
Copy link

wprater commented Aug 4, 2016

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 atom/tabs#314

@Ben3eeE
Copy link

Ben3eeE commented Oct 10, 2016

Can you still reproduce this in Atom 1.11 or later?

@wprater
Copy link
Author

wprater commented Nov 29, 2016

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
Copy link

Ben3eeE commented Nov 29, 2016

/cc: @iolsen MRU UX

@iolsen
Copy link

iolsen commented Nov 29, 2016

The similar report in atom/tabs#314 is fixed in atom/atom-keymap#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 iolsen changed the title MRU switching is random Buffer list not reliably sorted by MRU Nov 29, 2016
@iolsen
Copy link

iolsen commented Nov 29, 2016

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.

@iolsen iolsen closed this as completed Nov 29, 2016
@m3talstorm
Copy link

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.

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

No branches or pull requests

4 participants