# workspace: Fix tab reordering regression \(\#46872\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/b8c5f672cdf8ed3c1f4c8016f2b8d6d84b7a7a9c)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: b8c5f672cdf8ed3c1f4c8016f2b8d6d84b7a7a9c

Requested commit: b8c5f672cdf8ed3c1f4c8016f2b8d6d84b7a7a9c

Commit: b8c5f672cdf8ed3c1f4c8016f2b8d6d84b7a7a9c

Tree: 088e562a0d2d62b1ce9ed9b79d506ac8f9c59b64

Author: Yaroslav Yenkala

Committer: GitHub

## Message

```
workspace: Fix tab reordering regression (#46872)

Closes [#46864](https://github.com/zed-industries/zed/issues/46864)
Initial PR: https://github.com/zed-industries/zed/pull/46573

## Summary

Fix a regression where dragging a tab onto another tab would place it at
the end of the tab bar instead of at the target position.

The issue was in the `on_drop` handler: it used `this.items.len()`
(evaluated at drop time) instead of the captured `ix` index (the
position of the tab being dropped onto).

Release Notes:

- Fixed tab reordering not working correctly when dragging tabs

## Video after fix:

- when 'show_pinned_tabs_in_separate_row' is false:


https://github.com/user-attachments/assets/1ede0ce5-1161-4209-83f4-33a07572782a

- when 'show_pinned_tabs_in_separate_row' is true:


https://github.com/user-attachments/assets/d56c0e59-8372-41d4-973b-32a4895ca729

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
```

## Parents

- [83ca31055cf3e56aa8a704ac49e1686434f4e640](https://git.cafe/gitcafe/zed/commit/83ca31055cf3e56aa8a704ac49e1686434f4e640?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/b8c5f672cdf8ed3c1f4c8016f2b8d6d84b7a7a9c?format=markdown)
