Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MMTabline: Add right-to-left (RTL) locale support #1538

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

ychin
Copy link
Member

@ychin ychin commented Jan 30, 2025

In RTL locales (e.g. Arabic, Hebrew), macOS lays everything out in the flipped direction, including most UI elements and native tabs. This change makes sure MacVim tabs will obey the same convention and behave intuitively in such locales. The buttons and UI elements in MMTab/MMTabline already automatically get flipped. However, the logic of handling the tabs placements, scrolling, and drag-and-drop use manual calculations and need to be fixed up.

In order to keep scrolling stable, and for tabs animation to look correct and the same as the left-to-right, we simply flip the frames we use for tabs layout, by starting from 0 in X coordinate, and grow towards the negative range. This helps keep most of the logic the same while only needing to apply the X-flip adjustment in a couple places.

Also, as a minor adjustment, make the default widths of the tab just a bit wider.

@ychin ychin added the UI Issues related to UI elements, tabs, scrollbars, window resizing, etc. label Jan 30, 2025
@ychin ychin added this to the Release 181 milestone Jan 30, 2025
@ychin
Copy link
Member Author

ychin commented Jan 30, 2025

See #1120 for original MMTabline implementation.

@ychin
Copy link
Member Author

ychin commented Jan 30, 2025

In case people are curious what it looks like:

Norma (left-to-right):

image

Right-to-left (launch MacVim with -AppleTextDirection YES -NSForceRightToLeftWritingDirection YES flags):

image

@ychin ychin force-pushed the mmtabs-rtl branch 3 times, most recently from c7a7fc0 to 85c437c Compare January 30, 2025 01:07
In RTL locales (e.g. Arabic, Hebrew), macOS lays everything out in the
flipped direction, including most UI elements and native tabs. This
change makes sure MacVim tabs will obey the same convention and behave
intuitively in such locales. The buttons and UI elements in
MMTab/MMTabline already automatically get flipped. However, the logic of
handling the tabs placements, scrolling, and drag-and-drop use manual
calculations and need to be fixed up.

In order to keep scrolling stable, and for tabs animation to look
correct and the same as the left-to-right, we simply flip the frames we
use for tabs layout, by starting from 0 in X coordinate, and grow
towards the negative range. This helps keep most of the logic the same
while only needing to apply the X-flip adjustment in a couple places.

Also, as a minor adjustment, make the default widths of the tab just a
bit wider.
@ychin ychin merged commit a7db694 into macvim-dev:master Jan 30, 2025
4 checks passed
@ychin ychin deleted the mmtabs-rtl branch January 30, 2025 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
UI Issues related to UI elements, tabs, scrollbars, window resizing, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant