-
-
Notifications
You must be signed in to change notification settings - Fork 681
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make GUI tabs track Vim tabs in updates and animate correctly
MMTabline was introduced in #1120, which replaced the ancient PSMTabBarControl for representing Vim tabs. It uses animation to handle tab layouts, but it only worked in some situations, due to the Vim IPC API only sending a tabline update with all the tab labels with no way to track individual tabs. Update the API so that Vim now sends individual unique IDs in the update message as well to allow the GUI to track tabs over time and animate them. Vim does not interally have a concept of unique tab IDs, but we can use the pointer to the structure as such because they are allocated as a linked list and will never change. Extend MMTabline to have a new `updateTabsByTags` API to batch update all tabs in one go, which will diff the new tags with existing tabs and create/remove/move tabs as necessary. The scrolling logic has also been moved inside it and it now only scrolls to selected tab when it has changed or moved. When deleting tabs we won't scroll as usually the user doesn't expect it. Dragging tabs also now work correctly when it is removed during a drag, or another tab has been selected. This does mean the add/close tab APIs are currently unused, as the only entrypoint for modifying tabs from MacVim is currently only via `updateTabsByTags`. After this, different Vim operations will now animate correctly, including `:tabmove`, `:bdelete` (which could remove multiple tabs at once), `:tabnew`, `:tabclose`.
- Loading branch information
Showing
9 changed files
with
294 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.