romgrk / barbar.nvim

The neovim tabline plugin.
2.23k stars 83 forks source link

Improve BufferClose behaviour #368

Closed otavioschwanck closed 1 year ago

otavioschwanck commented 1 year ago

Sometimes, when i open a new buffer, and close it, instead of going back to the previous buffer, it just go to the buffer after the closed one. This behaviour is unatural.

Example:

I am on B on Buffers: A B C D

I open a new buffer called X, the list is: A B X C D

I Close the buffer X

The focused buffer will be C instead of B.

Iron-E commented 1 year ago

This was implemented due to https://github.com/romgrk/barbar.nvim/issues/234. I can double check to ensure the behavior is actually what browsers do— the goal is to make it like what a browser does

otavioschwanck commented 1 year ago

This was implemented due to #234. I can double check to ensure the behavior is actually what browsers do— the goal is to make it like what a browser does

any other editor behaviour is like the way i described (vscode, atom, etc). It should be at least an option (an the default to be like the other editors)

romgrk commented 1 year ago

I think the behavior described in the bug report is not what we expect. I'd also expect B to be focused, which is what browsers do.

And it is in fact the behavior I have on my machine, though I'm still quite a few commits behind due to other bugs: image image image

otavioschwanck commented 1 year ago

Here (it goes to C): tab position

Vscode (It goes to B): tab position 2

otavioschwanck commented 1 year ago

I think the behavior described in the bug report is not what we expect. I'd also expect B to be focused, which is what browsers do.

And it is in fact the behavior I have on my machine, though I'm still quite a few commits behind due to other bugs: image image image

Are you using BufferClose ?

Iron-E commented 1 year ago

I think the behavior described in the bug report is not what we expect

According to #234's request that's the right behavior:

  • if one exists, choose the tab to the right of the closed tab
  • otherwise choose the last tab

Choosing the tab to the left/the previous tab doesn't match their feature request's description.

We can always make it an option, since that was discussed prior https://github.com/romgrk/barbar.nvim/pull/270#issuecomment-1313186044

otavioschwanck commented 1 year ago

I think the behavior described in the bug report is not what we expect

According to #234's request that's the right behavior:

  • if one exists, choose the tab to the right of the closed tab
  • otherwise choose the last tab

Choosing the tab to the left/the previous tab doesn't match their feature request's description.

We can always make it an option, since that was discussed prior #270 (comment)

I think BufferDelete should go to the left (or BufferClose go to the left as a option)

otavioschwanck commented 1 year ago

The strangest part is that the @romgrk is going to the left already after close

Iron-E commented 1 year ago

The strangest part is that the @romgrk is going to the left already after close

Might be using a different command, also could be that he hasn't been able to update to the latest version yet because of #323 and #321. See https://github.com/romgrk/barbar.nvim/pull/270#issuecomment-1324046340 as well.

To be clear, I haven't tested this myself yet, so it might be that my machine also does what his does. I'm going to look at this further after tackling the netrw issue

romgrk commented 1 year ago

Well yeah I can't figure out left and right, it's indeed the behavior described in the other issue & in my PR. Anyway, I think the behavior requested by @otavioschwanck is the correct one, we should implement that.

Iron-E commented 1 year ago

I can confirm the behavior of :BufferDelete and :BufferClose differs. Close goes to the right, Delete goes to the left. I will try to make Close fall in line with Delete.