Skip to content

Fix Tab navigation in split editors (revert CTabFolder workaround, requires SWT fix)#4190

Open
fedejeanne wants to merge 1 commit into
eclipse-platform:masterfrom
fedejeanne:fix_tab_navigation_split_editors
Open

Fix Tab navigation in split editors (revert CTabFolder workaround, requires SWT fix)#4190
fedejeanne wants to merge 1 commit into
eclipse-platform:masterfrom
fedejeanne:fix_tab_navigation_split_editors

Conversation

@fedejeanne

Copy link
Copy Markdown
Member

What

Fixes #4135.

This PR reverts TraversePageHandler back to its standard, original traversal behavior, removing the CTabFolder-specific special-casing that had been added as a workaround (loop-to-first/last-item logic, hidden-item detection, and the top-level CTabFolder parent-hierarchy lookup helper introduced by #2864 and the earlier attempt at fixing #4135).

That special-casing was only needed because CTabFolder itself did not loop over its own tabs when navigating with Ctrl+PageUp/PageDown, and it caused regressions such as bypassing the chevron drop-down list when tabs did not fit on screen (which is presumably the root cause of #4135, since the workaround interfered with focus traversal in split editors).

Dependency

This PR requires eclipse-platform/eclipse.platform.swt#3448 to be merged/available. That SWT PR fixes CTabFolder.onPageTraversal directly, so CTabFolder now correctly wraps around from the last tab to the first (and vice versa) on its own — without needing any workaround at the TraversePageHandler level, and without breaking the chevron behavior when not all tabs fit.

How to test

  1. Make sure you have a build of SWT that includes CTabFolder: support circular page traversal in MRU mode without chevron eclipse.platform.swt#3448.
  2. Open two editors side-by-side (split editors) so that Ctrl+PageUp/PageDown needs to traverse between the editor area's CTabFolders correctly.
  3. Confirm that tab navigation with Ctrl+PageUp/PageDown behaves as expected and no longer misbehaves in the split-editor scenario described in 'Tab' navigatin Bug. Ctrl+PageUp -> Next Tab, Ctrl+PageDown -> Previous Tab. #4135.
  4. Resize the editor area so that not all tabs fit and the chevron (drop-down list) appears; confirm that traversing past the last/first visible tab still opens the chevron drop-down as expected (this is the behavior that the old workaround used to bypass).

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>
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

   855 files  ±0     855 suites  ±0   54m 41s ⏱️ + 1m 14s
 8 116 tests ±0   7 873 ✅ ±0  243 💤 ±0  0 ❌ ±0 
20 250 runs  ±0  19 596 ✅ ±0  654 💤 ±0  0 ❌ ±0 

Results for commit 5f1f875. ± Comparison against base commit 3f3daf7.

@fedejeanne fedejeanne left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested on Windows and it works as expected:

  • Circular navigation (forward and backwards) is fine
  • Navigation does not happen inside composed CTabFolders (e.g. in the Manifest Editor) but in the outermost level (it moves between classes, manifest editor and other views)
  • If the chevron is visible, it opens it instead of navigating circularly
  • There is no skipping an editor/view (as reported in #4135 (comment)).

Here's the video:

Video (Windows) Image

I couldn't test under Linux/Mac yet.

@HeikoKlare HeikoKlare left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this together with eclipse-platform/eclipse.platform.swt#3448 on MacOS and there it works fine for me (with ordinary editor stacks, MRU stacks, with all tabs being shown as well as some in the chevron menu).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'Tab' navigatin Bug. Ctrl+PageUp -> Next Tab, Ctrl+PageDown -> Previous Tab.

2 participants