Commit f8bf3fd
committed
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`.1 parent 8a68481 commit f8bf3fd
File tree
9 files changed
+294
-149
lines changed- src/MacVim
- MMTabline
9 files changed
+294
-149
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
764 | 764 | | |
765 | 765 | | |
766 | 766 | | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
767 | 773 | | |
768 | 774 | | |
| 775 | + | |
769 | 776 | | |
770 | 777 | | |
771 | 778 | | |
772 | 779 | | |
| 780 | + | |
| 781 | + | |
773 | 782 | | |
774 | | - | |
775 | | - | |
776 | | - | |
777 | | - | |
778 | | - | |
779 | | - | |
780 | | - | |
781 | | - | |
782 | | - | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
783 | 791 | | |
784 | 792 | | |
785 | | - | |
786 | | - | |
787 | | - | |
788 | | - | |
789 | | - | |
790 | | - | |
| 793 | + | |
| 794 | + | |
791 | 795 | | |
792 | | - | |
| 796 | + | |
793 | 797 | | |
794 | 798 | | |
795 | 799 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
27 | 29 | | |
| 30 | + | |
28 | 31 | | |
| 32 | + | |
29 | 33 | | |
| 34 | + | |
30 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
31 | 53 | | |
32 | 54 | | |
33 | 55 | | |
| |||
0 commit comments