CTabFolder: support circular page traversal in MRU mode without chevron#3448
Open
fedejeanne wants to merge 1 commit into
Open
CTabFolder: support circular page traversal in MRU mode without chevron#3448fedejeanne wants to merge 1 commit into
fedejeanne wants to merge 1 commit into
Conversation
When setMRUVisible(true) and all tabs fit without a chevron, navigating past the last tab with Ctrl+PageDown (TRAVERSE_PAGE_NEXT) or before the first tab with Ctrl+PageUp (TRAVERSE_PAGE_PREVIOUS) had no effect. Now navigation wraps around to the first/last visible tab respectively, matching the existing behavior of the non-MRU traversal path. Adds Snippet395 demonstrating the before/after behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
fedejeanne
added a commit
to fedejeanne/eclipse.platform.ui
that referenced
this pull request
Jul 17, 2026
Restores the standard focus-traversal behavior in TraversePageHandler by removing the special-casing that was added for CTabFolder (loop-to-first/ last-item logic, hidden-item detection, and the top-level CTabFolder lookup helpers introduced by eclipse-platform#2864 and the earlier fix for eclipse-platform#4135). This special-casing was a workaround for CTabFolder not looping over its own tabs when using Ctrl+PageUp/PageDown. That is now fixed directly in SWT's CTabFolder.onPageTraversal (see eclipse-platform/eclipse.platform.swt#3448), which makes this handler's workaround unnecessary and, in some cases, incorrect (e.g. it bypassed the chevron/drop-down list when tabs did not fit). Requires eclipse-platform/eclipse.platform.swt#3448 to be merged/available for the circular navigation behavior to still work correctly. Fixes eclipse-platform#4135 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes eclipse-platform/eclipse.platform.ui#4135
CTabFolder.onPageTraversalnow supports circular keyboard page traversal whensetMRUVisible(true)is enabled and all tabs fit without a chevron:SWT.TRAVERSE_PAGE_NEXT) on the last tab now wraps around to the first tab.SWT.TRAVERSE_PAGE_PREVIOUS) on the first tab now wraps around to the last tab.Previously, in MRU mode with no chevron shown, traversing past the last/first tab had no effect at all (selection stayed put).
This only affects the MRU branch of
onPageTraversal. The non-MRU path already wrapped correctly via modulo arithmetic, so its behavior is unchanged. The chevron behavior is intentionally preserved: if there are more tabs than fit and the chevron is shown, traversing past the last/first visible tab still opens the chevron drop-down list exactly as before.How to test
Snippet395(added inexamples/org.eclipse.swt.snippets), which creates aCTabFolderwithsetMRUVisible(true)and 4 tabs that all fit without a chevron.CTabFolderfocus (click a tab) and select the last tab, then press Ctrl+PageDown: it should now wrap to the first tab.Files changed
bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.javaexamples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet395.java(new)