eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
19.55k stars 2.46k forks source link

Focused tab is not the expected one when closing the last in the tabbar #13886

Open rschnekenbu opened 1 week ago

rschnekenbu commented 1 week ago

When closing editors or view in Theia, the last focused tab is selected in the bar. When there is no 'previous' widget found, the selected tab is the next tab to the right, except when the widget is the last one. In this case, the first widget is selected, rather than the one to the left of the closed tab.

Example:

https://github.com/eclipse-theia/theia/assets/3964263/122d8c58-ff53-493c-8f69-0f1d59785310

rschnekenbu commented 1 week ago

https://github.com/eclipse-theia/theia/blob/6dfbe6f3c8d1ab9c88931cf7b1e1fd87d4a8f382/packages/core/src/browser/shell/application-shell.ts#L1888

The case index === current.titles.length - 1 should probably return index-1. Currently, it is not part of the existing tests, so it returns 0.