Visual Studio Code, rebuilt in Rust
Rust
feat(workbench): follow the browser's DOM order for Tab
rokartura4b4b8cc06b1
diff --git a/native/crates/app/src/workbench.rs b/native/crates/app/src/workbench.rsindex 380af56f2fe..bed06668dc8 100644--- a/native/crates/app/src/workbench.rs+++ b/native/crates/app/src/workbench.rs@@ -688,6 +688,7 @@ impl Render for Workbench {.text_color(self.color("foreground")).text_size(px(13.)).capture_key_up(cx.listener(|workbench, _: &gpui::KeyUpEvent, _, cx| workbench.reset_keybinding_hold_mode(cx)))+ .on_key_down(cx.listener(Self::tab_key_down)).child(grid).children(self.debug_toolbar(window, cx)).children(self.breadcrumbs_picker_widget(window, cx))@@ -802,7 +803,7 @@ impl Workbench {document_symbols: Default::default(),references_peek: references_peek::ReferencesPeek::new(cx),outline_pane: outline_pane::OutlinePane::new(cx),- open_editors_focus: cx.focus_handle(),+ open_editors_focus: cx.focus_handle().tab_stop(true),open_editors_focused_row: None,open_editors_scroll: Default::default(),hierarchy_peek: hierarchy_peek::HierarchyPeek::new(cx),@@ -837,12 +838,12 @@ impl Workbench {local_history_selected_for_compare: None,urls: url_handler::Urls::default(),file_system_providers: HashSet::new(),- editor_focus: cx.focus_handle(),+ editor_focus: cx.focus_handle().tab_stop(true),multi_diff_file_list_focus: cx.focus_handle(),- editor_tab_focus: cx.focus_handle(),+ editor_tab_focus: cx.focus_handle().tab_stop(true),unicode_banner_focus: cx.focus_handle(),banner: banner::Banner::new(cx),- status_bar_focus: cx.focus_handle(),+ status_bar_focus: cx.focus_handle().tab_stop(true),content_hover_focus: cx.focus_handle(),debug_hover_focus: cx.focus_handle(),standalone_color_picker_focus: cx.focus_handle(),@@ -932,7 +933,7 @@ impl Workbench {locked_scroll_panes: Vec::new(),session_pins: HashMap::new(),comments: comments::Comments::new(cx),- problems_focus: cx.focus_handle(),+ problems_focus: cx.focus_handle().tab_stop(true),refactor_preview: Default::default(),breakpoint_widget: None,testing: Default::default(),@@ -1330,8 +1331,9 @@ impl Workbench {for bar in toolbars {self.forget_action_bar_items(bar);}- let title_item = |bar: &'static str, key: &str, item: Stateful<Div>, cx: &gpui::App| self.action_bar_item(bar, key, item, cx).into_any_element();- let title_bar_toolbar = |bar: &'static str, toolbar: Div, cx: &mut Context<Self>| self.action_bar(bar, false, self.title_bar_tab_order(bar, toolbars, auxiliary), toolbar, cx);+ // commandCenterControl.ts: the center is a nested toolbar, a tab stop of its own after the navigation buttons'.+ let title_item = |bar: &'static str, key: &str, item: Stateful<Div>, cx: &gpui::App| self.action_bar_item_with_tab_stop(bar, key, key == "center", item, cx).into_any_element();+ let title_bar_toolbar = |bar: &'static str, toolbar: Div, cx: &mut Context<Self>| self.action_bar(bar, false, toolbar, cx);let title = div().id("window-title").flex().items_center().map(|title| match command_center_visible {// commandCenterControl.ts: the navigation buttons and the center are `MenuId.CommandCenter`'s toolbar.true => {@@ -1456,7 +1458,7 @@ impl Workbench {.flex().gap(px(4.)).on_mouse_down(MouseButton::Left, |_, _, cx| cx.stop_propagation())- .when(!compact, |right| right.children(self.update_title_bar_entry(update_bar, self.title_bar_tab_order(update_bar, toolbars, auxiliary), !auxiliary, cx)))+ .when(!compact, |right| right.children(self.update_title_bar_entry(update_bar, !auxiliary, cx))).child(title_bar_toolbar(actions_bar, div().flex().gap(px(4.)).children(actions), cx));// titlebarPart.ts `updateStyles`: an auxiliary title bar keeps `titleBar.border` under the modern UI.let border = self.theme.color("titleBar.border").filter(|_| auxiliary);@@ -1485,14 +1487,6 @@ impl Workbench {}}- /// titlebarPart.ts's toolbars in the DOM order, each one tab stop, before the activity bar in the main window;- /// an editor window's editor part comes after them (`move_tab_focus`).- fn title_bar_tab_order(&self, bar: &'static str, toolbars: [&'static str; 3], auxiliary: bool) -> action_bar::TabOrder {- let at = toolbars.iter().position(|toolbar| *toolbar == bar).expect("a title bar toolbar");- let after = if auxiliary { None } else { Some("activity") };- action_bar::TabOrder { previous: toolbars[..at].iter().rev().copied().collect(), next: toolbars[at + 1..].iter().copied().chain(after).collect() }- }-/// The modern UI shell around the floating parts (floatingPanels.css), opaque as titlebarPart.ts sets it.fn shell_background(&self, active: bool) -> Rgba {let shell = if active { "modernUI.shellBackground" } else { "modernUI.inactiveShellBackground" };@@ -1592,7 +1586,6 @@ impl Workbench {.child(self.action_bar("activity",true,- action_bar::TabOrder { previous: TITLE_BAR_TOOLBARS.iter().rev().copied().collect(), next: vec!["global-activity"] },div().flex().flex_col()@@ -1606,7 +1599,7 @@ impl Workbench {// compositeBar.ts `CompositeBarDndCallbacks.drop`: a view dropped on the bar moves to a new side bar entry..on_drop(cx.listener(|workbench, dragged: &view_panes::DraggedPane, _, cx| workbench.drop_view_on_location(dragged.id, layout::Part::SideBar, cx))).on_mouse_down(MouseButton::Right, cx.listener(|workbench, event: &MouseDownEvent, window, cx| workbench.show_activity_bar_context_menu(event.position, window, cx)))- .child(self.action_bar("global-activity", true, action_bar::TabOrder { previous: vec!["activity"], next: Vec::new() }, div().child(self.action_bar_item("global-activity", "manage",+ .child(self.action_bar("global-activity", true, div().child(self.action_bar_item("global-activity", "manage",self.icon(self.manage_activity_icon(), 36., 24., inactive).id("manage").role(gpui::Role::Button)diff --git a/native/crates/app/src/workbench/action_bar.rs b/native/crates/app/src/workbench/action_bar.rsindex 0f7671d381b..a092a439518 100644--- a/native/crates/app/src/workbench/action_bar.rs+++ b/native/crates/app/src/workbench/action_bar.rs@@ -1,5 +1,6 @@//! actionbar.ts keyboard navigation: each bar's items take the focus one at a time, the arrows of the bar's//! orientation, Home and End move it, Enter and Space press the focused item, and showHover shows its hover.+//! A bar is one tab stop (roving tabindex): the item it last focused, else its first.use std::cell::RefCell;use std::collections::HashMap;@@ -14,51 +15,41 @@ pub(super) struct ActionBars {pub(super) handles: RefCell<HashMap<(&'static str, String), FocusHandle>>,/// Each bar's items in the last frame's order, with their bounds.drawn: Rc<RefCell<HashMap<&'static str, Vec<DrawnItem>>>>,+ /// Each bar's items from the last frame that drew any, for the roving tab stop of a bar cleared before its items.+ previous: RefCell<HashMap<&'static str, Vec<DrawnItem>>>,/// actionbar.ts `focusedItem`: the item the bar gives the focus back to.last: HashMap<&'static str, FocusHandle>,/// The names of an editor window's own bars, by the main window's name and the window's part.part_bars: RefCell<HashMap<(&'static str, u32), &'static str>>,}-/// The bars Tab and Shift+Tab reach from a bar, nearest first: the first with an item drawn takes the focus.-#[derive(Default)]-pub(super) struct TabOrder {- pub previous: Vec<&'static str>,- pub next: Vec<&'static str>,-}-struct DrawnItem {focus: FocusHandle,bounds: Bounds<Pixels>,}impl Workbench {- /// The bar's container with its key handler; rendering it forgets the items the last frame drew. Tab and- /// Shift+Tab go to the bars around it in the DOM order, each bar one tab stop.- pub(super) fn action_bar(&self, bar: &'static str, vertical: bool, tab_order: TabOrder, container: Div, cx: &mut Context<Self>) -> Div {- self.action_bars.drawn.borrow_mut().insert(bar, Vec::new());- container.on_key_down(cx.listener(move |workbench, event: &KeyDownEvent, window, cx| {- let keystroke = &event.keystroke;- let tab_to = match (keystroke.key.as_str(), keystroke.modifiers.shift) {- ("tab", false) => &tab_order.next,- ("tab", true) => &tab_order.previous,- _ => return workbench.action_bar_key(bar, vertical, event, window, cx),- };- if tab_to.iter().any(|tab_to| workbench.focus_action_bar(tab_to, window, cx)) {- cx.stop_propagation();- }- }))+ /// The bar's container with its key handler; rendering it forgets the items the last frame drew.+ pub(super) fn action_bar(&self, bar: &'static str, vertical: bool, container: Div, cx: &mut Context<Self>) -> Div {+ self.forget_action_bar_items(bar);+ container.on_key_down(cx.listener(move |workbench, event: &KeyDownEvent, window, cx| workbench.action_bar_key(bar, vertical, event, window, cx)))}/// One item of the bar: it takes the focus, keeps a mouse press from taking it (actionViewItems.ts stops the- /// mouse down), and draws the focused label's 1px `focusBorder` outline (workbench.css) inside it.+ /// mouse down), and draws the focused label's 1px `focusBorder` outline (workbench.css) inside it. `own_tab_stop`:+ /// the item is a tab stop of its own, as each tab's close actions (one action bar per tab).pub(super) fn action_bar_item(&self, bar: &'static str, key: &str, item: Stateful<Div>, cx: &App) -> Stateful<Div> {+ self.action_bar_item_with_tab_stop(bar, key, false, item, cx)+ }++ pub(super) fn action_bar_item_with_tab_stop(&self, bar: &'static str, key: &str, own_tab_stop: bool, item: Stateful<Div>, cx: &App) -> Stateful<Div> {let focus = self.action_bar_focus(bar, key, cx);+ let tab_stop = own_tab_stop || self.is_roving_tab_stop(bar, &focus);let drawn = self.action_bars.drawn.clone();let border = self.theme.color("focusBorder");let painted = focus.clone();item.relative()- .track_focus(&focus)+ .track_focus(&focus.clone().tab_stop(tab_stop)).on_mouse_down(MouseButton::Left, |_, window, _| window.prevent_default()).child(canvas(move |bounds, _, _| drawn.borrow_mut().entry(bar).or_default().push(DrawnItem { focus, bounds }), move |bounds, _, window, _| {@@ -71,6 +62,16 @@ impl Workbench {)}+ /// actionbar.ts `setFocusable`/`focus`: the item with `tabIndex = 0`, the bar's `focusedItem`, else its first item.+ /// A bar not drawn yet makes every item a stop for its first frame.+ fn is_roving_tab_stop(&self, bar: &'static str, focus: &FocusHandle) -> bool {+ let drawn = self.action_bars.drawn.borrow();+ let previous = self.action_bars.previous.borrow();+ let Some(items) = drawn.get(bar).filter(|items| !items.is_empty()).or_else(|| previous.get(bar)) else { return true };+ let last = self.action_bars.last.get(bar).filter(|last| items.iter().any(|item| &item.focus == *last));+ last.unwrap_or(&items[0].focus) == focus+ }+pub(super) fn action_bar_focus(&self, bar: &'static str, key: &str, cx: &App) -> FocusHandle {self.action_bars.handles.borrow_mut().entry((bar, key.to_owned())).or_insert_with(|| cx.focus_handle()).clone()}@@ -83,10 +84,14 @@ impl Workbench {/// Forgets the items the last frame drew in a bar drawn without `action_bar`'s container.pub(super) fn forget_action_bar_items(&self, bar: &'static str) {- self.action_bars.drawn.borrow_mut().insert(bar, Vec::new());+ let drawn = self.action_bars.drawn.borrow_mut().insert(bar, Vec::new());+ if let Some(drawn) = drawn.filter(|items| !items.is_empty()) {+ self.action_bars.previous.borrow_mut().insert(bar, drawn);+ }}/// The bar's items the last frame drew, in their order.+ #[cfg(test)]pub(super) fn drawn_action_bar_items(&self, bar: &'static str) -> Vec<FocusHandle> {self.action_bars.drawn.borrow().get(bar).map(|items| items.iter().map(|item| item.focus.clone()).collect()).unwrap_or_default()}diff --git a/native/crates/app/src/workbench/auxiliary_windows.rs b/native/crates/app/src/workbench/auxiliary_windows.rsindex c4e8cd97bc1..a7956ad608b 100644--- a/native/crates/app/src/workbench/auxiliary_windows.rs+++ b/native/crates/app/src/workbench/auxiliary_windows.rs@@ -465,6 +465,7 @@ impl Workbench {.text_color(self.color("foreground")).text_size(px(13.)).capture_key_up(cx.listener(|workbench, _: &gpui::KeyUpEvent, _, cx| workbench.reset_keybinding_hold_mode(cx)))+ .on_key_down(cx.listener(Self::tab_key_down)).child(title_bar).child(editor).when(self.is_status_bar_visible() && !compact, |root| root.child(status_bar))diff --git a/native/crates/app/src/workbench/breadcrumbs.rs b/native/crates/app/src/workbench/breadcrumbs.rsindex 1aa388bb845..ad7b0ab384e 100644--- a/native/crates/app/src/workbench/breadcrumbs.rs+++ b/native/crates/app/src/workbench/breadcrumbs.rs@@ -32,7 +32,7 @@ pub(super) struct Breadcrumbs {impl Breadcrumbs {pub fn new(cx: &mut gpui::App) -> Self {- Self { focus: cx.focus_handle(), focused: None, picker: None, item_bounds: Rc::default() }+ Self { focus: cx.focus_handle().tab_stop(true), focused: None, picker: None, item_bounds: Rc::default() }}}diff --git a/native/crates/app/src/workbench/content_hover.rs b/native/crates/app/src/workbench/content_hover.rsindex e8aeae3d9c5..bc6c086435c 100644--- a/native/crates/app/src/workbench/content_hover.rs+++ b/native/crates/app/src/workbench/content_hover.rs@@ -495,11 +495,12 @@ impl Workbench {}/// Tab in the hover, in DOM order: the container, then each rendered part (its `tabIndex = 0`) followed by the- /// focusable elements inside it.- /// shortcut: Tab stops at the hover's ends where the browser moves on to the page's next element; port that once- /// the editor's overflow widgets join the workbench's tab order.- pub(super) fn tab_in_content_hover(&mut self, backwards: bool, window: &mut Window, cx: &mut Context<Self>) {- let count = self.content_hover.shown.as_ref().map_or(0, hover_parts_count);+ /// focusable elements inside it. From outside, Shift+Tab enters at the last element+ /// (a Tab in the editor's text hides the hover, contentHoverController.ts `_onKeyDown`).+ /// False at the hover's ends, where the focus leaves it (`move_tab_focus`).+ pub(super) fn tab_in_content_hover(&mut self, backwards: bool, window: &mut Window, cx: &mut Context<Self>) -> bool {+ let Some(shown) = &self.content_hover.shown else { return false };+ let count = hover_parts_count(shown);let mut order = vec![None];for index in 0..count {order.push(Some((index, None)));@@ -508,12 +509,14 @@ impl Workbench {}}let current = self.focused_hover_part_index(window).map(|index| (index, self.focused_hover_stop(window).map(|(_, stop)| stop)));- let Some(position) = order.iter().position(|element| *element == current) else { return };- let next = match backwards {- true => position.checked_sub(1),- false => Some(position + 1).filter(|&next| next < order.len()),+ let position = order.iter().position(|element| *element == current).filter(|_| self.content_hover_focused(window));+ let next = match (position, backwards) {+ (None, false) => None,+ (None, true) => Some(order.len() - 1),+ (Some(position), true) => position.checked_sub(1),+ (Some(position), false) => Some(position + 1).filter(|&next| next < order.len()),};- let Some(next) = next else { return };+ let Some(next) = next else { return false };match order[next] {Some((index, stop)) => {self.content_hover.focused_stop = stop.map(|stop| (index, stop));@@ -522,6 +525,7 @@ impl Workbench {None => window.focus(&self.content_hover_focus, cx),}cx.notify();+ true}/// The part holding the focus and the element inside it that has it.diff --git a/native/crates/app/src/workbench/content_hover/tests.rs b/native/crates/app/src/workbench/content_hover/tests.rsindex bf84b560657..95cc733dbe7 100644--- a/native/crates/app/src/workbench/content_hover/tests.rs+++ b/native/crates/app/src/workbench/content_hover/tests.rs@@ -459,8 +459,10 @@ fn the_verbosity_actions_use_the_focused_part(cx: &mut TestAppContext) {}use PartStop::{Copy, Verbosity};let part = |index: usize| [Some((index, None)), Some((index, Some(Verbosity(1)))), Some((index, Some(Verbosity(-1)))), Some((index, Some(Copy)))];- let forward: Vec<_> = part(0).into_iter().chain(part(1)).chain([Some((1, Some(Copy)))]).collect();- let backward: Vec<_> = forward[..7].iter().rev().copied().chain([None, None]).collect();+ let parts: Vec<_> = part(0).into_iter().chain(part(1)).collect();+ // Tab past the last element leaves the hover for the stop after the editor; Shift+Tab comes back in at its end.+ let forward: Vec<_> = parts.iter().copied().chain([None]).collect();+ let backward: Vec<_> = parts.iter().rev().copied().chain([None]).collect();assert_eq!(moves, [forward, backward].concat());cx.simulate_keystrokes("tab tab tab tab tab");assert_eq!(focused_part(&workbench, cx), Some(1));diff --git a/native/crates/app/src/workbench/editor_status.rs b/native/crates/app/src/workbench/editor_status.rsindex 3aa507e7a84..5544d472270 100644--- a/native/crates/app/src/workbench/editor_status.rs+++ b/native/crates/app/src/workbench/editor_status.rs@@ -8,7 +8,7 @@ use config::configuration::Overrides;use config::indentation::creation_options;use config::service::Target;use files::encoding::{self, SUPPORTED_ENCODINGS};-use gpui::{App, Context, FocusHandle, PromptLevel, Window};+use gpui::{Context, PromptLevel, Window};use serde_json::{Value, json};use super::Workbench;@@ -568,101 +568,34 @@ impl Workbench {}}- /// The browser's Tab and Shift+Tab where nothing handles them: with tab focus mode on, Tab leaves the editor's- /// text for the status bar, the next focusable part of the workbench, and Shift+Tab comes back.+ /// The browser's Tab and Shift+Tab where nothing handles them: the focus goes to the next or previous tab stop in+ /// the DOM order, the order the workbench paints its focusable elements in, from the last back to the first.+ /// The content hover keeps its own order, between the editor's text and what follows the editor (view.ts appends+ /// the overflowing content widgets after the editor's text); the quick input keeps the focus.pub(super) fn move_tab_focus(&mut self, backwards: bool, window: &mut Window, cx: &mut Context<Self>) -> bool {if self.content_hover_focused(window) {- self.tab_in_content_hover(backwards, window, cx);- return true;- }- if self.editor_focus.is_focused(window) && self.tab_focus_mode() {- match backwards {- true => {- let stops = self.group_title_tab_stops(cx);- self.focus_group_title_stop(stops.len(), backwards, &stops, window, cx);- }- false => {- self.status_entry_focus.remove(&window.window_handle().window_id());- window.focus(&self.status_bar_focus, cx);- }+ if self.tab_in_content_hover(backwards, window, cx) {+ return true;}- return true;- }- let stops = self.group_title_tab_stops(cx);- // An editor window's title bar toolbars come right before its editor part in the DOM order.- let title_bars = self.title_bar_toolbars(window);- if !backwards && self.auxiliary_part_of_window(window).is_some() && self.focused_action_bar(window).is_some_and(|bar| title_bars.contains(&bar)) {- self.focus_group_title_stop_at(0, &stops, window, cx);- return true;- }- let current = match self.focused_action_bar(window) == Some(super::editor_view::EDITOR_ACTIONS) {- true => stops.iter().position(Option::is_none),- false => stops.iter().position(|stop| stop.as_ref().is_some_and(|stop| stop.is_focused(window))),- };- if let Some(current) = current {- self.focus_group_title_stop(current, backwards, &stops, window, cx);- return true;- }- // shortcut: Tab on the status bar stays, where the browser moves on in the DOM order; port with the workbench's Tab order.- if self.status_bar_focus.is_focused(window) {+ window.focus(&self.editor_focus, cx);if backwards {- window.focus(&self.editor_focus, cx);+ return true;}- return true;+ } else if self.quick_inputs.focus.is_focused(window) {+ return false;}- false- }-- /// The active group title's tab stops in the DOM order: the active tab, each tab's close action, then the- /// editor actions toolbar (`None`).- fn group_title_tab_stops(&self, cx: &App) -> Vec<Option<FocusHandle>> {- let closes = self.drawn_action_bar_items(super::editor_view::TAB_ACTIONS);- let tabs_drawn = self.editor_show_tabs() == "multiple" && !self.drawing_compact_part();- let mut stops = Vec::new();- for index in 0..self.editors.editors.len() {- if tabs_drawn && self.editors.active_index() == Some(index) {- stops.push(Some(self.editor_tab_focus.clone()));- }- let close = self.action_bar_focus(super::editor_view::TAB_ACTIONS, &index.to_string(), cx);- if closes.contains(&close) {- stops.push(Some(close));- }- }- if !self.drawn_action_bar_items(super::editor_view::EDITOR_ACTIONS).is_empty() {- stops.push(None);+ match backwards {+ true => window.focus_prev(cx),+ false => window.focus_next(cx),}- stops- }-- /// Moves the focus from the stop at `current` (`stops.len()` is the editor) to the one before or after it.- fn focus_group_title_stop(&mut self, current: usize, backwards: bool, stops: &[Option<FocusHandle>], window: &mut Window, cx: &mut Context<Self>) {- let target = match backwards {- true if current == 0 => return self.focus_editor_window_title_bar(window, cx),- true => current - 1,- false => current + 1,- };- self.focus_group_title_stop_at(target, stops, window, cx);- }-- /// Shift+Tab from an editor window's first group title stop reaches its title bar's last toolbar.- fn focus_editor_window_title_bar(&mut self, window: &mut Window, cx: &mut Context<Self>) {- if self.auxiliary_part_of_window(window).is_none() {- return;- }- for bar in self.title_bar_toolbars(window).into_iter().rev() {- if self.focus_action_bar(bar, window, cx) {- return;- }+ if backwards && self.editor_focus.is_focused(window) && self.tab_in_content_hover(true, window, cx) {+ return true;}- }-- /// The stop at `target`, the editor past the last one.- fn focus_group_title_stop_at(&mut self, target: usize, stops: &[Option<FocusHandle>], window: &mut Window, cx: &mut Context<Self>) {- match stops.get(target) {- Some(Some(stop)) => window.focus(stop, cx),- Some(None) => drop(self.focus_action_bar(super::editor_view::EDITOR_ACTIONS, window, cx)),- None => window.focus(&self.editor_focus, cx),+ if self.status_bar_focus.is_focused(window) {+ self.status_entry_focus.remove(&window.window_handle().window_id());}+ self.timeline_toolbar_tabbed_into(window, cx);+ true}}diff --git a/native/crates/app/src/workbench/editor_view.rs b/native/crates/app/src/workbench/editor_view.rsindex 385cfff7324..67004a53fb6 100644--- a/native/crates/app/src/workbench/editor_view.rs+++ b/native/crates/app/src/workbench/editor_view.rs@@ -224,7 +224,7 @@ impl Workbench {let more = self.title_action(bar, "more", self.editor_title_more_button(icon_color, false, cx), cx);let toolbar = div().flex_none().flex().items_center().children(self.editor_title_primary_actions(bar, icon_color, window, cx)).child(more);Some(match bar {- Some(bar) => self.action_bar(bar, false, Default::default(), toolbar, cx),+ Some(bar) => self.action_bar(bar, false, toolbar, cx),None => toolbar,})}@@ -659,7 +659,7 @@ impl Workbench {}));// Each tab's ActionBar is a tab stop of the active group, its action shown while focused.let action_bar = !self.editor_groups.drawing_inactive;- let close = if action_bar { self.action_bar_item(TAB_ACTIONS, &index.to_string(), close, cx) } else { close };+ let close = if action_bar { self.action_bar_item_with_tab_stop(TAB_ACTIONS, &index.to_string(), true, close, cx) } else { close };let close_focused = action_bar && self.action_bar_focus(TAB_ACTIONS, &index.to_string(), cx).is_focused(window);let tab = div().id(("tab", index))@@ -701,11 +701,11 @@ impl Workbench {})).child(self.tab_hover(index)).when(active && !self.editor_groups.drawing_inactive, |tab| self.focusable_editor_tab(tab, cx))- // connectedEditorTabs.css: an inactive tab's close action is transparent until the tab is hovered.+ // connectedEditorTabs.css: an inactive tab's close action is `opacity: 0` until the tab is hovered, still a tab stop..group(tab_group.clone()).when(!compact, |tab| {let close_top = if upper { 4. } else { 5.5 };- tab.child(div().absolute().top(px(close_top)).right(px(6.5)).when(!(active || dirty || sticky || close_focused), |close| close.invisible().group_hover(tab_group, |close| close.visible())).child(close))+ tab.child(div().absolute().top(px(close_top)).right(px(6.5)).when(!(active || dirty || sticky || close_focused), |close| close.opacity(0.).group_hover(tab_group, |close| close.opacity(1.))).child(close))});if !active {return div().h_full().flex_none().child(tab);diff --git a/native/crates/app/src/workbench/explorer_actions.rs b/native/crates/app/src/workbench/explorer_actions.rsindex 02ac7cc9910..880b2c94122 100644--- a/native/crates/app/src/workbench/explorer_actions.rs+++ b/native/crates/app/src/workbench/explorer_actions.rs@@ -73,7 +73,7 @@ pub struct RootDrop {impl ExplorerState {pub fn new(cx: &mut gpui::App) -> Self {- ExplorerState { focus: cx.focus_handle(), input: InputView::default(), input_focus: cx.focus_handle(), edit: None, drop_target: None, root_drop: None, expand_timer: None, scroll: ScrollHandle::new(), find: ExplorerFind::new(cx), type_navigation: Default::default() }+ ExplorerState { focus: cx.focus_handle().tab_stop(true), input: InputView::default(), input_focus: cx.focus_handle(), edit: None, drop_target: None, root_drop: None, expand_timer: None, scroll: ScrollHandle::new(), find: ExplorerFind::new(cx), type_navigation: Default::default() }}}@@ -221,7 +221,7 @@ impl Workbench {});bar = bar.child(self.action_bar_item(super::view_panes::FILE_VIEW, command, action.child(self.action_hover(title, command, HoverOptions::action_item())), cx));}- self.action_bar(super::view_panes::FILE_VIEW, false, Default::default(), bar, cx)+ self.action_bar(super::view_panes::FILE_VIEW, false, bar, cx)}/// Shown without a hover: the focus is in the pane, its header or its actions, or `workbench.view.alwaysShowHeaderActions` is on.diff --git a/native/crates/app/src/workbench/extensions_view.rs b/native/crates/app/src/workbench/extensions_view.rsindex b33942a755f..96f3685ea3b 100644--- a/native/crates/app/src/workbench/extensions_view.rs+++ b/native/crates/app/src/workbench/extensions_view.rs@@ -247,8 +247,8 @@ impl ExtensionsViewlet {ExtensionsViewlet {search: InputBox::default(),search_view: InputView::default(),- search_focus: cx.focus_handle(),- list_focus: cx.focus_handle(),+ search_focus: cx.focus_handle().tab_stop(true),+ list_focus: cx.focus_handle().tab_stop(true),panes: Vec::new(),builtins: Vec::new(),user: None,diff --git a/native/crates/app/src/workbench/hover/tests.rs b/native/crates/app/src/workbench/hover/tests.rsindex ab0920832ed..f00debeb795 100644--- a/native/crates/app/src/workbench/hover/tests.rs+++ b/native/crates/app/src/workbench/hover/tests.rs@@ -632,7 +632,10 @@ fn a_merged_view_title_is_the_tab_stop_before_its_body(cx: &mut TestAppContext)assert_eq!(bar, Some("workbench.view.search"), "Shift+Tab from the body");cx.simulate_keystrokes("tab");cx.run_until_parked();- assert_eq!(workbench.update_in(cx, |workbench, window, _| workbench.focused_input(window)), Some(InputId::Search(SearchField::Query)), "Tab from the title");+ assert!(workbench.update_in(cx, |workbench, window, _| workbench.search.toggle_replace_focus.is_focused(window)), "Tab from the title");+ cx.simulate_keystrokes("tab");+ cx.run_until_parked();+ assert_eq!(workbench.update_in(cx, |workbench, window, _| workbench.focused_input(window)), Some(InputId::Search(SearchField::Query)), "Tab from the Toggle Replace button");}/// multiEditorTabsControl.ts: the active tab is the group title's tab stop before the editor; the arrows, Home and@@ -743,13 +746,13 @@ fn the_tab_close_actions_and_the_editor_actions_toolbar_are_tab_stops(cx: &mut Tcx.simulate_keystrokes("shift-tab");backwards.push(focused(cx));}- assert_eq!(backwards, ["actions 0", "close 2", "close 1", "tab", "close 0", "close 0"], "Shift+Tab from the editor");+ assert_eq!(backwards, ["actions 0", "close 2", "close 1", "tab", "close 0", "elsewhere"], "Shift+Tab from the editor, only the active tab a stop");let mut forwards = Vec::new();- for _ in 0..5 {+ for _ in 0..6 {cx.simulate_keystrokes("tab");forwards.push(focused(cx));}- assert_eq!(forwards, ["tab", "close 1", "close 2", "actions 0", "editor"], "Tab from the first close action");+ assert_eq!(forwards, ["close 0", "tab", "close 1", "close 2", "actions 0", "editor"], "Tab from before the group");cx.simulate_keystrokes("shift-tab left");assert_eq!(focused(cx), "actions last", "Left from the first action loops to the last");@@ -816,12 +819,19 @@ fn the_title_bar_toolbars_are_tab_stops_in_the_dom_order(cx: &mut TestAppContextcx.simulate_event(gpui::KeyUpEvent { keystroke: gpui::Keystroke::parse("enter").unwrap() });cx.run_until_parked();assert_eq!(side_bar(cx), !visible, "Enter runs the layout control");- cx.simulate_keystrokes("shift-tab");- assert_eq!(bar(cx), Some("title-command-center"), "Shift+Tab goes on to the command center without the update entry");- cx.simulate_keystrokes("shift-tab");- assert_eq!(bar(cx), Some("title-command-center"), "the command center is the first tab stop");- cx.simulate_keystrokes("tab");- assert_eq!(bar(cx), Some("title-actions"));- cx.simulate_keystrokes("tab");- assert_eq!(bar(cx), Some("activity"));+ let item = |cx: &mut gpui::VisualTestContext| {+ cx.run_until_parked();+ workbench.update_in(cx, |workbench, window, _| {+ let handles = workbench.action_bars.handles.borrow();+ handles.iter().find(|(_, focus)| focus.is_focused(window)).map(|((bar, key), _)| format!("{bar}:{key}"))+ })+ };+ let mut stops = Vec::new();+ for keys in ["shift-tab", "shift-tab", "tab", "tab", "tab"] {+ cx.simulate_keystrokes(keys);+ stops.push(item(cx).unwrap_or_default());+ }+ let layout = "title-actions:workbench.action.toggleSidebarVisibility";+ // The command center's center is a nested toolbar: a tab stop after the navigation buttons', without the update entry.+ assert_eq!(stops, ["title-command-center:center", "title-command-center:back", "title-command-center:center", layout, "activity:workbench.view.explorer"]);}diff --git a/native/crates/app/src/workbench/keyboard.rs b/native/crates/app/src/workbench/keyboard.rsindex 175fb1ee835..bd903cb4d6b 100644--- a/native/crates/app/src/workbench/keyboard.rs+++ b/native/crates/app/src/workbench/keyboard.rs@@ -9,7 +9,7 @@ use std::time::{Duration, Instant};use files::watcher::{Change, Watcher};use futures::StreamExt;use futures::channel::mpsc;-use gpui::{Context, Keystroke, Subscription, Task, Window};+use gpui::{Context, KeyDownEvent, Keystroke, Subscription, Task, Window};use serde_json::{Value, json};use super::Workbench;@@ -295,12 +295,6 @@ impl Workbench {self.leave_chord_mode(cx);cx.stop_propagation();}- _ if keystroke.key == "tab" && !(keystroke.modifiers.control || keystroke.modifiers.platform || keystroke.modifiers.alt) && self.move_tab_focus(keystroke.modifiers.shift, window, cx) => {- cx.stop_propagation();- if !self.hovers.is_sticky() {- self.dismiss_hover(cx);- }- }// hoverService.ts `_keyDown` with hideOnKeyDown, which every workbench hover delegate sets; a sticky hover// registers no key listener; QuickInputHoverDelegate turns hideOnKeyDown off._ if self.hovers.stays_on_key_down() => {}@@ -308,6 +302,20 @@ impl Workbench {}}+ /// The browser's default action for Tab, after every element's keydown listener let it through.+ pub(super) fn tab_key_down(&mut self, event: &KeyDownEvent, window: &mut Window, cx: &mut Context<Self>) {+ let keystroke = &event.keystroke;+ if keystroke.key != "tab" || keystroke.modifiers.control || keystroke.modifiers.platform || keystroke.modifiers.alt {+ return;+ }+ if self.move_tab_focus(keystroke.modifiers.shift, window, cx) {+ cx.stop_propagation();+ if !self.hovers.is_sticky() {+ self.dismiss_hover(cx);+ }+ }+ }+/// keybindingService.ts `enableKeybindingHoldMode`: while the key that runs `command` stays down, key downs are/// ignored; its key up or the window losing focus runs `release`. False when no keybinding runs `command`.pub(super) fn enable_keybinding_hold_mode(&mut self, command: &str, release: fn(&mut Workbench), window: &mut Window, cx: &mut Context<Self>) -> bool {diff --git a/native/crates/app/src/workbench/outline_pane.rs b/native/crates/app/src/workbench/outline_pane.rsindex dd1009ae743..368607a601a 100644--- a/native/crates/app/src/workbench/outline_pane.rs+++ b/native/crates/app/src/workbench/outline_pane.rs@@ -55,7 +55,7 @@ pub(super) enum Status {impl OutlinePane {pub(super) fn new(cx: &mut Context<Workbench>) -> Self {- OutlinePane { focus: cx.focus_handle(), key: None, status: Status::NoProvider, toggled: HashSet::new(), selected: Vec::new(), focused: None, find: super::outline_find::OutlineFind::new(cx), view_state: Default::default(), followed: None, scroll: gpui::ScrollHandle::new(), _request: None, _loading: None }+ OutlinePane { focus: cx.focus_handle().tab_stop(true), key: None, status: Status::NoProvider, toggled: HashSet::new(), selected: Vec::new(), focused: None, find: super::outline_find::OutlineFind::new(cx), view_state: Default::default(), followed: None, scroll: gpui::ScrollHandle::new(), _request: None, _loading: None }}}diff --git a/native/crates/app/src/workbench/panel.rs b/native/crates/app/src/workbench/panel.rsindex 5cd93cac468..1a3bd4913eb 100644--- a/native/crates/app/src/workbench/panel.rs+++ b/native/crates/app/src/workbench/panel.rs@@ -7,13 +7,12 @@ use std::cell::{Cell, RefCell};use std::rc::Rc;use gpui::{- AnyElement, AppContext, Bounds, Context, Div, DragMoveEvent, InteractiveElement, IntoElement, KeyDownEvent, MouseButton, MouseDownEvent, ParentElement, Pixels, Render, Rgba, SharedString, Stateful, StatefulInteractiveElement, Styled, TextRun, Window, div,+ AnyElement, AppContext, Bounds, Context, Div, DragMoveEvent, InteractiveElement, IntoElement, MouseButton, MouseDownEvent, ParentElement, Pixels, Render, Rgba, SharedString, Stateful, StatefulInteractiveElement, Styled, TextRun, Window, div,prelude::FluentBuilder, px,};use serde_json::json;use super::Workbench;-use super::action_bar::TabOrder;use super::hover::{HoverContent, HoverOptions, HoverPosition};use super::layout::{Alignment, Part, Position};use super::view_locations::{is_generated_container, location_code};@@ -452,22 +451,8 @@ impl Workbench {})).child(self.pane_composite_title(part, tabs, view_actions, actions, drop_feedback, cx).on_drop(cx.listener(move |workbench, dragged: &super::view_panes::DraggedPane, _, cx| {workbench.drop_view_on_location(dragged.id, part, cx);- })).on_key_down(cx.listener(move |workbench, event: &KeyDownEvent, window, cx| {- // Tab past the global actions reaches the content, the next in the DOM order.- if event.keystroke.key == "tab" && !event.keystroke.modifiers.shift {- cx.stop_propagation();- workbench.focus_pane_composite(part, window, cx);- }})))- .child(div().relative().flex_1().min_h_0().flex().flex_col().child(size_tracker(content_bounds)).child(content).children(progress_bars).on_key_down(cx.listener(- move |workbench, event: &KeyDownEvent, window, cx| {- // Shift+Tab out of the content reaches the title's last action bar.- let [tabs_bar, global_bar] = title_bars(part);- if event.keystroke.key == "tab" && event.keystroke.modifiers.shift && [global_bar, merged_view.unwrap_or(global_bar), tabs_bar].into_iter().any(|bar| workbench.focus_action_bar(bar, window, cx)) {- cx.stop_propagation();- }- },- )))+ .child(div().relative().flex_1().min_h_0().flex().flex_col().child(size_tracker(content_bounds)).child(content).children(progress_bars))}/// The container's content and title actions: a single view merged into it (its body, its actions in the@@ -508,11 +493,9 @@ impl Workbench {}/// `.composite.title`: the tab strip's background with its bottom line, tabs on the left, then the active view's- /// title actions, a separator (actionbar.css `.separator`) and the global actions on the right; Tab walks the three- /// action bars in that order.+ /// title actions, a separator (actionbar.css `.separator`) and the global actions on the right: three tab stops.fn pane_composite_title(&self, part: Part, tabs: Vec<AnyElement>, view_actions: Option<(&'static str, AnyElement)>, actions: Vec<GlobalAction>, drop_feedback: bool, cx: &mut Context<Self>) -> Div {let [tabs_bar, global_bar] = title_bars(part);- let view_bar = view_actions.as_ref().map(|(view, _)| *view);let foreground = self.color("icon.foreground");let bottom_line = div().absolute().bottom_0().left_0().right_0().h(px(1.)).bg(self.color("surface.border"));let bar = self.composite_bar(part);@@ -530,13 +513,12 @@ impl Workbench {.when(!self.compact_density(), |title| title.rounded_t(px(8.))).child(bottom_line).child(size_tracker(bar.title_bounds.clone()))- .child(self.action_bar(tabs_bar, false, TabOrder { previous: Vec::new(), next: view_bar.into_iter().chain([global_bar]).collect() }, div().h_full().flex().children(tabs), cx))+ .child(self.action_bar(tabs_bar, false, div().h_full().flex().children(tabs), cx))// The actions keep their width: the tab layout measures them, so they must not shrink for tabs that overflow..child(div().relative().flex_none().ml_auto().h_full().flex().items_center().gap(px(4.)).child(size_tracker(bar.actions_bounds.clone())).when_some(view_actions, |bar, (view, view_actions)| {- let tab_order = TabOrder { previous: vec![tabs_bar], next: vec![global_bar] };// The bar's 4px gap is the separator's right margin.- bar.child(self.action_bar(view, false, tab_order, div().flex().items_center().child(view_actions), cx)).child(div().w(px(1.)).h(px(16.)).ml(px(4.)).bg(self.color("disabledForeground")))- }).child(self.action_bar(global_bar, false, TabOrder { previous: view_bar.into_iter().chain([tabs_bar]).collect(), next: Vec::new() }, div().flex().items_center().gap(px(4.)).children(actions.into_iter().map(|(icon, title, command, toggled)| {+ bar.child(self.action_bar(view, false, div().flex().items_center().child(view_actions), cx)).child(div().w(px(1.)).h(px(16.)).ml(px(4.)).bg(self.color("disabledForeground")))+ }).child(self.action_bar(global_bar, false, div().flex().items_center().gap(px(4.)).children(actions.into_iter().map(|(icon, title, command, toggled)| {let toggled_background = self.theme.color("actionBar.toggledBackground").unwrap_or(self.color("inputOption.activeBackground"));let action = self.icon(icon, 22., 16., foreground).id(command).rounded(px(4.)).cursor_pointer().when(toggled, |action| action.bg(toggled_background)).child(self.action_hover(title, command, HoverOptions::managed())).on_click(cx.listener(move |workbench, _, window, cx| {diff --git a/native/crates/app/src/workbench/part_navigation/tests.rs b/native/crates/app/src/workbench/part_navigation/tests.rsindex f60c99c5d5c..6499ab5f382 100644--- a/native/crates/app/src/workbench/part_navigation/tests.rs+++ b/native/crates/app/src/workbench/part_navigation/tests.rs@@ -49,3 +49,58 @@ fn f6_walks_the_visible_parts(cx: &mut TestAppContext) {assert_eq!(walk("shift-f6 shift-f6", cx), [Some(SideBar), Some(ActivityBar)]);std::fs::remove_dir_all(dir).unwrap();}++/// The browser's Tab order is the DOM order of the parts (workbench.ts `renderWorkbench`): title bar, activity bar,+/// side bar, editor, panel, status bar; Shift+Tab walks it back. Each part counts once however many stops it has.+#[gpui::test]+fn tab_walks_the_parts_in_the_dom_order(cx: &mut TestAppContext) {+ let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();+ let themes = scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();+ let theme = load_theme(&[themes], "Dark Modern").unwrap();+ let dir = std::env::temp_dir().join(format!("code-gpui-tab-order-{}", std::process::id()));+ std::fs::create_dir_all(&dir).unwrap();+ std::fs::write(dir.join("a.txt"), "one\n").unwrap();+ let workspace = Workspace::open(dir.clone());+ let (workbench, cx) = cx.add_window_view(|_, cx| {+ let mut workbench = Workbench::new(theme, app_root.clone(), Some(workspace), Languages::new(&[]), crate::default_settings(), HostSync::new(std::sync::mpsc::channel().0), cx);+ workbench.load_keybindings(crate::keybindings::default_keybindings(&[]), dir.join("keybindings.json"));+ let storage = Arc::new(Mutex::new(Storage::in_memory()));+ workbench.restore_profile_state(storage.clone(), storage);+ workbench+ });+ workbench.update_in(cx, |workbench, window, cx| {+ workbench.open_file(dir.join("a.txt"), true, window, cx);+ // The terminal keeps Tab for its shell.+ drop(workbench.execute_command("workbench.actions.view.problems", Vec::new(), window, cx));+ drop(workbench.execute_command("editor.action.toggleTabFocusMode", Vec::new(), window, cx));+ });+ cx.run_until_parked();+ workbench.update_in(cx, |workbench, window, cx| workbench.focus_group(workbench.editors.id, window, cx));+ let walk = |key: &str, cx: &mut gpui::VisualTestContext| {+ let mut parts = vec!["editor".to_string()];+ for _ in 0..60 {+ cx.simulate_keystrokes(key);+ cx.run_until_parked();+ let part = workbench.update_in(cx, |workbench, window, cx| match workbench.focused_action_bar(window) {+ Some(bar) if bar.starts_with("title-") => "title bar".to_string(),+ // `focused_part` knows the parts' own bars only: the editor group's and the side bar container's.+ Some("editor-tab-actions" | "editor-actions") => "Some(Editor)".to_string(),+ Some("explorer") => "Some(SideBar)".to_string(),+ _ => format!("{:?}", workbench.focused_part(window, cx)),+ });+ if parts.last() != Some(&part) {+ parts.push(part.clone());+ }+ if parts.len() > 1 && part == "Some(Editor)" && workbench.update_in(cx, |workbench, window, _| workbench.editor_focus.is_focused(window)) {+ break;+ }+ }+ parts[1..].to_vec()+ };+ let order = ["Some(Panel)", "Some(StatusBar)", "title bar", "Some(ActivityBar)", "Some(SideBar)", "Some(Editor)"];+ assert_eq!(walk("tab", cx), order, "Tab from the editor");+ // The editor group's title stops come first: its tab and actions sit before the text.+ let back = ["Some(Editor)", "Some(SideBar)", "Some(ActivityBar)", "title bar", "Some(StatusBar)", "Some(Panel)", "Some(Editor)"];+ assert_eq!(walk("shift-tab", cx), back, "Shift+Tab from the editor");+ std::fs::remove_dir_all(dir).unwrap();+}diff --git a/native/crates/app/src/workbench/scm_repositories_view.rs b/native/crates/app/src/workbench/scm_repositories_view.rsindex 79f616c1b00..fb42bd0e597 100644--- a/native/crates/app/src/workbench/scm_repositories_view.rs+++ b/native/crates/app/src/workbench/scm_repositories_view.rs@@ -44,7 +44,7 @@ pub struct RepositoriesView {impl RepositoriesView {pub fn new(cx: &mut App) -> Self {Self {- focus: cx.focus_handle(),+ focus: cx.focus_handle().tab_stop(true),toggled: HashSet::new(),explorer_toggled: HashSet::new(),restored: HashSet::new(),diff --git a/native/crates/app/src/workbench/scm_view.rs b/native/crates/app/src/workbench/scm_view.rsindex 5bfb352fdb0..f3c0404ba39 100644--- a/native/crates/app/src/workbench/scm_view.rs+++ b/native/crates/app/src/workbench/scm_view.rs@@ -87,8 +87,8 @@ impl ScmView {model: Scm::default(),input: InputBox::default(),input_view: InputView::default(),- input_focus: cx.focus_handle(),- list_focus: cx.focus_handle(),+ input_focus: cx.focus_handle().tab_stop(true),+ list_focus: cx.focus_handle().tab_stop(true),input_models: HashMap::new(),collapsed: HashSet::new(),selected: None,diff --git a/native/crates/app/src/workbench/search_view.rs b/native/crates/app/src/workbench/search_view.rsindex 17acf4b4764..f803cbc2ece 100644--- a/native/crates/app/src/workbench/search_view.rs+++ b/native/crates/app/src/workbench/search_view.rs@@ -145,12 +145,12 @@ pub struct SearchView {impl SearchView {pub fn new(cx: &mut Context<Workbench>) -> Self {- let input = || SearchInput { value: InputBox::default(), history: HistoryNavigator::new(Vec::new(), HISTORY_LIMIT), view: InputView::default(), focus: cx.focus_handle() };+ let input = || SearchInput { value: InputBox::default(), history: HistoryNavigator::new(Vec::new(), HISTORY_LIMIT), view: InputView::default(), focus: cx.focus_handle().tab_stop(true) };let inputs = [input(), input(), input(), input(), input()];SearchView {inputs,- focus: cx.focus_handle(),- toggle_replace_focus: cx.focus_handle(),+ focus: cx.focus_handle().tab_stop(true),+ toggle_replace_focus: cx.focus_handle().tab_stop(true),scroll: UniformListScrollHandle::new(),// searchView.ts: `showReplace` without a stored state is true.replace_active: true,diff --git a/native/crates/app/src/workbench/terminal_view.rs b/native/crates/app/src/workbench/terminal_view.rsindex 8e32779db80..56a846f7b50 100644--- a/native/crates/app/src/workbench/terminal_view.rs+++ b/native/crates/app/src/workbench/terminal_view.rs@@ -195,7 +195,7 @@ pub enum TerminalInput {impl TerminalView {pub fn new(cx: &mut gpui::App) -> Self {TerminalView {- focus: cx.focus_handle(),+ focus: cx.focus_handle().tab_stop(true),instances: Vec::new(),groups: Vec::new(),active_group: 0,diff --git a/native/crates/app/src/workbench/timeline_view.rs b/native/crates/app/src/workbench/timeline_view.rsindex d2203c4f6a8..3720a95ade8 100644--- a/native/crates/app/src/workbench/timeline_view.rs+++ b/native/crates/app/src/workbench/timeline_view.rs@@ -77,10 +77,10 @@ impl TimelineView {selected: Vec::new(),focused: None,anchor: None,- focus: cx.focus_handle(),+ focus: cx.focus_handle().tab_stop(true),scroll: ScrollHandle::new(),typed: None,- toolbar_focus: cx.focus_handle(),+ toolbar_focus: cx.focus_handle().tab_stop(true),toolbar_index: 0,toolbar_bounds: Rc::default(),}@@ -591,10 +591,6 @@ impl Workbench {"home" => 0,"end" => last,// A browser fires `contextmenu` at the focused row on Shift+F10; the menu anchors at the row.- "tab" if modifiers.shift => {- cx.stop_propagation();- return self.focus_timeline_toolbar(window, cx);- }"f10" if modifiers.shift => {let Some(current) = current else { return };cx.stop_propagation();@@ -778,10 +774,12 @@ impl Workbench {self.timeline.focus.is_focused(window) || self.timeline.toolbar_focus.is_focused(window)}- /// Shift+Tab from the tree: the toolbar's tab stop, its first item focused with its hover shown.- pub(super) fn focus_timeline_toolbar(&mut self, window: &mut Window, cx: &mut Context<Self>) {+ /// Tab into the toolbar: its first item focused with its hover shown.+ pub(super) fn timeline_toolbar_tabbed_into(&mut self, window: &mut Window, cx: &mut Context<Self>) {+ if !self.timeline.toolbar_focus.is_focused(window) {+ return;+ }self.timeline.toolbar_index = 0;- window.focus(&self.timeline.toolbar_focus.clone(), cx);self.show_timeline_toolbar_hover(window, cx);}@@ -798,21 +796,10 @@ impl Workbench {if items.is_empty() {return;}- let modifiers = event.keystroke.modifiers;let index = self.timeline.toolbar_index.min(items.len() - 1);match event.keystroke.key.as_str() {"right" => self.timeline.toolbar_index = (index + 1) % items.len(),"left" => self.timeline.toolbar_index = (index + items.len() - 1) % items.len(),- "tab" if modifiers.shift => {- cx.stop_propagation();- self.dismiss_hover(cx);- return self.focus_pane_header(super::view_panes::TIMELINE_VIEW, window, cx);- }- "tab" => {- cx.stop_propagation();- self.dismiss_hover(cx);- return window.focus(&self.timeline.focus.clone(), cx);- }"enter" | "space" => {cx.stop_propagation();self.dismiss_hover(cx);diff --git a/native/crates/app/src/workbench/tree_view.rs b/native/crates/app/src/workbench/tree_view.rsindex 346a8f8dde7..9614be393f8 100644--- a/native/crates/app/src/workbench/tree_view.rs+++ b/native/crates/app/src/workbench/tree_view.rs@@ -435,7 +435,7 @@ impl Workbench {/// activates `onView:<id>` (`TreeView.activate`) and fetches the roots.pub(super) fn sync_tree_views(&mut self, cx: &mut Context<Self>) {for id in self.tree_views.views.iter().map(|view| view.id).collect::<Vec<_>>() {- self.tree_views.focus.entry(id.to_owned()).or_insert_with(|| cx.focus_handle());+ self.tree_views.focus.entry(id.to_owned()).or_insert_with(|| cx.focus_handle().tab_stop(true));}let shown: Vec<&'static str> = self.tree_views.views.iter().map(|view| view.id).filter(|&id| self.tree_view_body_visible(id)).collect();for id in shown.iter().copied().chain(self.tree_views.visible.iter().map(|id| static_id(id)).collect::<Vec<_>>()) {diff --git a/native/crates/app/src/workbench/update_title_bar.rs b/native/crates/app/src/workbench/update_title_bar.rsindex 8be3272a5cc..972fd260cb3 100644--- a/native/crates/app/src/workbench/update_title_bar.rs+++ b/native/crates/app/src/workbench/update_title_bar.rs@@ -101,7 +101,7 @@ impl Workbench {/// `UpdateTitleBarEntry.render` and `onStateChange`: the state's label, its look, and a click that runs the/// state's action or opens the tooltip.- pub(super) fn update_title_bar_entry(&self, bar: &'static str, tab_order: super::action_bar::TabOrder, track_bounds: bool, cx: &mut Context<Self>) -> Option<Div> {+ pub(super) fn update_title_bar_entry(&self, bar: &'static str, track_bounds: bool, cx: &mut Context<Self>) -> Option<Div> {if !self.update_title_bar_entry_visible() {return None;}@@ -163,7 +163,7 @@ impl Workbench {.size_full(),));// titlebarPart.ts: `MenuId.TitleBarUpdate` is a toolbar of its own, one tab stop.- Some(self.action_bar(bar, false, tab_order, div().child(entry), cx))+ Some(self.action_bar(bar, false, div().child(entry), cx))}/// updateTitleBarEntry.ts: `workbench.action.showHover` on the focused entry shows its tooltip focuseddiff --git a/native/crates/app/src/workbench/view_panes.rs b/native/crates/app/src/workbench/view_panes.rsindex ddab530220d..11cf9b53c44 100644--- a/native/crates/app/src/workbench/view_panes.rs+++ b/native/crates/app/src/workbench/view_panes.rs@@ -421,7 +421,7 @@ impl Workbench {pub(super) fn layout_panes(&mut self, container: PaneContainer, height: f32, mut descriptors: Vec<(&'static str, bool)>, horizontal: bool, cx: &mut Context<Self>) {let panes = self.panes_mut(container);for &(id, _) in &descriptors {- panes.focus.entry(id).or_insert_with(|| cx.focus_handle());+ panes.focus.entry(id).or_insert_with(|| cx.focus_handle().tab_stop(true));}let laid_out = panes.view.as_ref().is_some_and(|view| view.horizontal == horizontal && view.ids().len() == descriptors.len() && descriptors.iter().all(|(id, _)| view.ids().contains(id)));if laid_out {@@ -551,40 +551,19 @@ impl Workbench {};let more = (!pane.draws_more && self.has_view_toggle(container.key())).then(|| self.container_title_more(container, id, cx));// paneviewlet.css: a merged view's progress bar sits 2px above its pane, over the title's bottom.- let title = self.side_bar_title_text(title).children(self.scoped_progress_bar(id).map(|bar| bar.bottom_0())).when(id == FILE_VIEW, |title| title.child(self.explorer_title_actions(window, cx))).children(pane.actions.map(|actions| self.action_bar(id, false, Default::default(), div().flex().flex_none().child(actions), cx))).children(more);- // The title's actions are the tab stop before the view's content.- let title = title.on_key_down(cx.listener(move |workbench, event: &KeyDownEvent, window, cx| {- if event.keystroke.key == "tab" && !event.keystroke.modifiers.shift {- cx.stop_propagation();- drop(workbench.execute_command(&format!("{id}.focus"), Vec::new(), window, cx));- }- }));- let body = div().flex_1().min_h_0().flex().flex_col().child(pane.body).on_key_down(cx.listener(move |workbench, event: &KeyDownEvent, window, cx| {- if event.keystroke.key == "tab" && event.keystroke.modifiers.shift && workbench.focus_action_bar(id, window, cx) {- cx.stop_propagation();- }- }));+ let title = self.side_bar_title_text(title).children(self.scoped_progress_bar(id).map(|bar| bar.bottom_0())).when(id == FILE_VIEW, |title| title.child(self.explorer_title_actions(window, cx))).children(pane.actions.map(|actions| self.action_bar(id, false, div().flex().flex_none().child(actions), cx))).children(more);+ let body = div().flex_1().min_h_0().flex().flex_col().child(pane.body);return frame.child(title).child(body);}let bar = container.key();- // The title's "..." is the tab stop before the first pane header.- let title = self.side_bar_title_text(crate::nls::localize_in(container.container_id(), title).into_owned()).child(self.container_title_more(container, bar, cx)).on_key_down(cx.listener(move |workbench, event: &KeyDownEvent, window, cx| {- if event.keystroke.key != "tab" || event.keystroke.modifiers.shift {- return;- }- let first = workbench.panes(container).view.as_ref().and_then(|view| view.ids().first().copied());- if let Some(focus) = first.and_then(|first| workbench.panes(container).focus.get(first).cloned()) {- cx.stop_propagation();- window.focus(&focus, cx);- }- }));+ let title = self.side_bar_title_text(crate::nls::localize_in(container.container_id(), title).into_owned()).child(self.container_title_more(container, bar, cx));frame.child(title).child(self.pane_view_element(container, ordered, window, cx))}/// The container title's "..." as the one item of the title's action bar `bar`.fn container_title_more(&self, container: PaneContainer, bar: &'static str, cx: &mut Context<Self>) -> Div {let more = self.view_container_more_actions(container.key(), cx);- self.action_bar(bar, false, Default::default(), div().flex().flex_none().child(self.action_bar_item(bar, "more", more, cx)), cx)+ self.action_bar(bar, false, div().flex().flex_none().child(self.action_bar_item(bar, "more", more, cx)), cx)}/// The panes in the pane view's order: the given ones, the moved views' (`prepare_moved_view_panes`), else a@@ -656,18 +635,7 @@ impl Workbench {.when(!collapsed_column, |pane| pane.flex_col()).overflow_hidden().child(header)- .when_some(body, |pane, body| {- // Shift+Tab out of the body reaches the header's actions, else the header: the tab stops before it.- pane.child(div().flex_1().min_h_0().flex().flex_col().child(body).on_key_down(cx.listener(move |workbench, event: &KeyDownEvent, window, cx| {- if event.keystroke.key != "tab" || !event.keystroke.modifiers.shift {- return;- }- cx.stop_propagation();- if !workbench.focus_action_bar(id, window, cx) {- window.focus(&workbench.panes(container).focus[id].clone(), cx);- }- })))- })+ .when_some(body, |pane, body| pane.child(div().flex_1().min_h_0().flex().flex_col().child(body))).child(canvas(move |bounds, _, _| _ = tracked.borrow_mut().insert(id, bounds), |_, _, _, _| ()).absolute().inset_0()).on_hover(cx.listener(|_, _: &bool, _, cx| cx.notify())).on_drag_move(cx.listener(move |workbench, event: &DragMoveEvent<DraggedPane>, _, cx| {@@ -717,6 +685,7 @@ impl Workbench {}/// A pane header focused by the keyboard, so it draws its focus outline.+ #[cfg(test)]pub(super) fn focus_pane_header(&mut self, id: &'static str, window: &mut Window, cx: &mut Context<Self>) {self.explorer_panes.pointer_focused = None;window.focus(&self.explorer_panes.focus[id].clone(), cx);@@ -793,7 +762,7 @@ impl Workbench {.when(id == SCM_HISTORY_VIEW, |header| header.children(self.scm_graph_outdated_badge())).children(actions.filter(|_| expanded).map(|actions| {let bar = div().flex_none().ml_auto().mr(px(4.)).invisible().when(show_actions || self.pane_hovered(container, id, window), |actions| actions.visible()).child(actions);- self.action_bar(id, false, Default::default(), bar, cx)+ self.action_bar(id, false, bar, cx)}))// extensionsViews.ts `renderHeader`: the count badge after the actions, at the right end..when(container == PaneContainer::Extensions, |header| header.children(self.extensions_view_badge(id).map(|badge| badge.when(!has_actions, |badge| badge.ml_auto()))))@@ -810,40 +779,14 @@ impl Workbench {if workbench.panes_mut(container).pointer_focused.take().is_some() {cx.notify();}- let shift = event.keystroke.modifiers.shift;- // Keys bubbling up from the header's toolbar: Shift+Tab goes back to the header, Tab on to the view.+ // Keys bubbling up from the header's toolbar.if !workbench.panes(container).focus[id].is_focused(window) {- if event.keystroke.key == "tab" {- cx.stop_propagation();- match shift {- true => window.focus(&workbench.panes(container).focus[id].clone(), cx),- false => drop(workbench.execute_command(&format!("{id}.focus"), Vec::new(), window, cx)),- }- }return;}let neighbour = match event.keystroke.key.as_str() {// Enter and Space reach `on_click`: gpui clicks a focused element on its activation keys."left" => return workbench.set_pane_expanded(container, index, false, cx),"right" => return workbench.set_pane_expanded(container, index, true, cx),- // The header's toolbar is the next tab stop.- "tab" if id == TIMELINE_VIEW && expanded && !shift => {- cx.stop_propagation();- return workbench.focus_timeline_toolbar(window, cx);- }- "tab" if expanded && !shift => {- if workbench.focus_action_bar(id, window, cx) {- cx.stop_propagation();- }- return;- }- // The container title's "..." is the tab stop before the first header.- "tab" if shift && index == 0 => {- if workbench.focus_action_bar(container.key(), window, cx) {- cx.stop_propagation();- }- return;- }"up" if index > 0 => index - 1,"down" if index + 1 < count => index + 1,_ => return,diff --git a/port/ledger.md b/port/ledger.mdindex f05f75b2776..815a0451b7e 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -407,7 +407,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/services/language | workbench service | M7 | verified | | getAssociationByPath with the full glob dialect (languages::tests::file_patterns_take_the_whole_glob_dialect) plus firstLine detection (languages.rs); cargo test -p app languages::tests || workbench/services/languageDetection | workbench service | M13 | verified | | language_detection.rs (languageDetectionWebWorker.ts `detectLanguagesImpl`, `adjustLanguageConfidence`, the 10000 char sample) and workbench/language_detection.rs (`LanguageDetectionWorkerClient`: the file name guess first, then @vscode/vscode-languagedetection 1.0.23 with its model in a Bun worker from the app's node_modules, model ids mapped as `getLanguageId`; `autoDetectLanguage` of textEditorModel.ts for untitled models and extensionless plain text files, 600 ms throttle, skipped after an explicit language and with `workbench.editor.languageDetection` off): cargo test -p app language_detection (the worker test runs the real model). The history biases only feed the regexp model, which 1.147.0 does not ship (`vscode-regexp-languagedetection` is not a dependency), so neither side has it; no telemetry || workbench/services/languageStatus | workbench service | M13 | verified | | `$setLanguageStatus` / `$removeLanguageStatus`, statuses matched by selector, ordered by severity, source, id (workbench/language_status.rs): cargo test -p app language_status |-| workbench/services/layout | workbench service | M11 | ported | [3 L] editor_status.rs:606, content_hover.rs:498: no workbench-wide Tab order (the browser's DOM order): Tab stops at the content hover's ends, and Tab on the status bar in Tab Focus Mode keeps the focus (port/notes.md Toggle Tab Key Moves Focus) <br> [3 L] workbench.rs:591: the Workbench is one GPUI view, so every scroll frame of any list renders and lays out every part again, where upstream's DOM updates only the scrolled list; `scroll_frame_time` median / p95 at 42d10fe2347: Explorer 11.5 / 15.7 ms, Editor 18.0 / 19.2 to 42.0 ms, Settings 12.4 / 16.8 ms over the 8 ms gate (Extensions 2.8 / 3.0 meets it); per frame taffy lays out the whole workbench (6.6 ms of the Explorer frame), each `key_context` caller clones every `config.*` key (keyboard.rs:400), the menubar and the timeline toolbar are rebuilt; the next step is the part-entity split, side bar first (port/notes.md Scroll frame costs, cheap steps). GUI (Studio at load 33 to 57, 60 Hz display, 690 trackpad events in 7 s): main thread in `Window::draw` 86% scrolling the Explorer (800 files), 89% the Extensions @builtin list (port/notes.md Scroll frame costs) | layout.ts as a split-view tree (workbench/layout.rs): panel position (bottom, top, left, right) and alignment, primary side bar left or right, maximized panel with `panelMaximizationSupportedWhen`, hidden parts, persisted sizes and positions; zen mode (zen_mode.rs) with its settings and restore; centered layout (centered_layout.rs) with its sashes and stored margins; View > Appearance entries and the Panel Position and Align Panel submenus (cargo test -p app -- layout part_grid centered_layout zen_mode); layoutActions.ts Customize Layout quick pick (workbench/customize_layout.rs) with live items, Restore Defaults and Close, Toggle Activity Bar Visibility, Align Quick Input Top/Center (cargo test -p app -- customize_layout toggling_the_activity_bar; ui-pair m11/manage-menu.json, port/results/manage-menu.md; missing until then though the title bar showed its button); ui-pair layout-positions.json and layout-zen.json against the reference (port/results/layout.md). The pairs run with `zenMode.fullScreen` off. Maximize Secondary Side Bar (`workbench.action.maximizeAuxiliaryBar`, `restoreAuxiliaryBar`, `toggleMaximizedAuxiliaryBar`, the title's toggle) hides the other parts and restores them (workbench/panel.rs; cargo test -p app -- maximizing_the_secondary_side_bar_hides_the_other_parts_and_restore_brings_them_back). Zen mode enforces `zenMode.showTabs` on the main editor part until it ends (layout.ts `toggleZenMode` `enforcePartOptions`; workbench/zen_mode.rs `editor_show_tabs`; cargo test -p app -- show_tabs_picks_the_title_control_and_zen_mode_enforces_its_own); navigationActions.ts `workbench.action.focusNextPart`/`focusPreviousPart` (F6, Shift+F6) walk editor, panel, auxiliary bar, status bar, activity bar and side bar past the hidden ones with layout.ts `focusPart` (the pane container's first expanded view; workbench/part_navigation.rs; cargo test -p app f6_walks_the_visible_parts); in an editor window F6 goes between its editor and its own status bar, whose entry focus is kept per window (workbench/auxiliary_windows.rs `auxiliary_status_bar`, workbench/status_entries.rs; cargo test -p app f6_in_an_editor_window_reaches_its_own_status_bar) |+| workbench/services/layout | workbench service | M11 | ported | [3 S] terminal_view.rs:1235: with Tab Focus Mode on, Tab in the terminal goes to the shell, where terminalInstance.ts:1204 leaves it to the browser's Tab order (port/notes.md Toggle Tab Key Moves Focus) <br> [3 L] workbench.rs:591: the Workbench is one GPUI view, so every scroll frame of any list renders and lays out every part again, where upstream's DOM updates only the scrolled list; `scroll_frame_time` median / p95 at 42d10fe2347: Explorer 11.5 / 15.7 ms, Editor 18.0 / 19.2 to 42.0 ms, Settings 12.4 / 16.8 ms over the 8 ms gate (Extensions 2.8 / 3.0 meets it); per frame taffy lays out the whole workbench (6.6 ms of the Explorer frame), each `key_context` caller clones every `config.*` key (keyboard.rs:400), the menubar and the timeline toolbar are rebuilt; the next step is the part-entity split, side bar first (port/notes.md Scroll frame costs, cheap steps). GUI (Studio at load 33 to 57, 60 Hz display, 690 trackpad events in 7 s): main thread in `Window::draw` 86% scrolling the Explorer (800 files), 89% the Extensions @builtin list (port/notes.md Scroll frame costs) | layout.ts as a split-view tree (workbench/layout.rs): panel position (bottom, top, left, right) and alignment, primary side bar left or right, maximized panel with `panelMaximizationSupportedWhen`, hidden parts, persisted sizes and positions; zen mode (zen_mode.rs) with its settings and restore; centered layout (centered_layout.rs) with its sashes and stored margins; View > Appearance entries and the Panel Position and Align Panel submenus (cargo test -p app -- layout part_grid centered_layout zen_mode); layoutActions.ts Customize Layout quick pick (workbench/customize_layout.rs) with live items, Restore Defaults and Close, Toggle Activity Bar Visibility, Align Quick Input Top/Center (cargo test -p app -- customize_layout toggling_the_activity_bar; ui-pair m11/manage-menu.json, port/results/manage-menu.md; missing until then though the title bar showed its button); ui-pair layout-positions.json and layout-zen.json against the reference (port/results/layout.md). The pairs run with `zenMode.fullScreen` off. Maximize Secondary Side Bar (`workbench.action.maximizeAuxiliaryBar`, `restoreAuxiliaryBar`, `toggleMaximizedAuxiliaryBar`, the title's toggle) hides the other parts and restores them (workbench/panel.rs; cargo test -p app -- maximizing_the_secondary_side_bar_hides_the_other_parts_and_restore_brings_them_back). Zen mode enforces `zenMode.showTabs` on the main editor part until it ends (layout.ts `toggleZenMode` `enforcePartOptions`; workbench/zen_mode.rs `editor_show_tabs`; cargo test -p app -- show_tabs_picks_the_title_control_and_zen_mode_enforces_its_own); navigationActions.ts `workbench.action.focusNextPart`/`focusPreviousPart` (F6, Shift+F6) walk editor, panel, auxiliary bar, status bar, activity bar and side bar past the hidden ones with layout.ts `focusPart` (the pane container's first expanded view; workbench/part_navigation.rs; cargo test -p app f6_walks_the_visible_parts); in an editor window F6 goes between its editor and its own status bar, whose entry focus is kept per window (workbench/auxiliary_windows.rs `auxiliary_status_bar`, workbench/status_entries.rs; cargo test -p app f6_in_an_editor_window_reaches_its_own_status_bar) || workbench/services/lifecycle | workbench service | M11 | ported | [3 L] unattendedRestart.ts: the participants terminalUnattendedRestart.ts, testingUnattendedRestart.ts, webviewUnattendedRestart.ts, notebookUnattendedRestart.ts and testingContinuousRunService.ts `testing.continuousRun` are not ported (the port's terminal has no `hasChildProcesses`), the editor detail names the scheme where upstream names `typeId`, `workbench.floatingWindowNotRestorable` cannot occur (the port's auxiliary windows are all editor parts), and nothing calls `can_restart_unattended` yet: platform/update's `UnattendedRestartScheduler` (restart to update while the screen is locked, with `update.restartWhenIdle` on), `quitAndInstall` with `unattended` and windowsStateHandler.ts `setNextExactRestore` are not ported | workbench/lifecycle.rs: ShutdownReason, onBeforeShutdown vetoes on quit, close button, closeWindow, reload and load (`window.confirmBeforeClose`, backup tracker auto save, hot exit, showSaveConfirm); cargo test -p app lifecycle; no phases or onWillShutdown joiners; workbench/unattended_restart.rs: `canRestartUnattended` with its blocker aggregation and change log, and the participants `workbench.starting` (2.5 s after restore), dialog, quick input, transient workspace, modal editor, editors not restored or not restorable, `debug.sessionActive`, `tasks.running`, the backup tracker's `workingCopy.*` and `cli.waitingForEditorClose`: cargo test -p app unattended_restart (unattendedRestart.test.ts); verified: cargo test -p app backup_tracker lifecycle (workingCopyBackupTracker.test.ts); ui-pair hot-exit.json `dirty`, `restored` vs the reference (port/results/windows.md, milestone 11 verification) || workbench/services/localTranscription | workbench service | | removed | | no AI or Microsoft services by decision (port/notes.md); API stays inert || workbench/services/localization | workbench service | M18 | verified | | ui-pair port/fixtures/extensions/ui-display-language.json: picking Deutsch installs MS-CEINTL.vscode-language-pack-de with the "Installing Deutsch language support..." progress and asks "Restart VSRustium to switch to Deutsch?"; localeService.ts: argv.json `locale` written and cleared, restart dialog, install of an MS-CEINTL pack: cargo test -p app nls localization; Command Palette titles, categories and descriptions translate by the reference call's module and key (port/tools/ref-commands with ref-nls-clone.ts; cargo test -p app a_palette_title_two_modules), menu bar items, side bar titles and pane headers by the reference's `nlsKeys` per menu, view and container (cargo test -p app menu_bar_items_and_view_titles_resolve_per_scope); other surfaces stay English (port/notes.md) |diff --git a/port/notes.md b/port/notes.mdindex f347b19f6e4..eb7c00e76b2 100644--- a/port/notes.md+++ b/port/notes.md@@ -504,7 +504,7 @@ Done when (first item): api-tests `vscode API - editors` passes as in the refere- Editor font zoom (fontZoom.ts, editorZoom.ts, fontInfo.ts, mouseHandler.ts `_setupMouseWheelZoomListener`): one level for every editor from -5 to 20, not persisted, scaling the font size and line height by 10% per level (no rounding, like upstream), so the glyph margin, gutter, sticky scroll, minimap, overview ruler, message placement and drop marker follow `Viewport.line_height`. The actions have no keybinding upstream, only the Command Palette. With `editor.mouseWheelZoom`, Cmd or Ctrl (no Shift, no Alt) and a mouse notch zoom one level; a trackpad gesture that began with them zooms by a fifth of its accumulated delta; GPUI's line delta stands in for `MouseWheelClassifier.isPhysicalMouseWheel`. ui-pair (`notes.txt`, zoom in twice, out three times): level -1 matches pixel for pixel; levels 1 and 2 place the gutter and text 2 and 1 device pixels right of the reference, Chrome's snapping of the fractional 19.8 and 21.6px margins.- Insert Final New Line (insertFinalNewLine.ts): the action appends the model's EOL to the last line even when that line is already empty, between undo stops, tracking the primary selection with `trackSelection` stickiness. That stickiness (`NeverGrowsWhenTypingAtEdges` for a selection) now also applies to Replace All and the indentation and trim commands, which tracked a selection as always growing. The `files.insertFinalNewline` save participant is in the save participants entry below. ui-pair (`notes.txt`): the new line 11 and the dirty tab match the reference.- Overtype (toggleOvertype.ts, inputMode.ts, replaceCommand.ts `ReplaceOvertypeCommand` and `ReplaceOvertypeCommandOnCompositionEnd`): one input mode for the window, insert at start, flipped by View: Toggle Overtype/Insert Mode. Its Alt+Cmd+O is shadowed by the later `workbench.action.remote.showMenu` rule in both apps, so the key runs nothing in the port (remote is removed). In overtype mode a typed character replaces as many characters after the selection up to the line's end, an IME commit removes as many characters after it, and a paste does the same when `editor.overtypeOnPaste` is on. The status bar shows the prominent `OVR` item (`updateInputModeElement`) and the Column Selection item (`updateColumnSelectionModeElement`) beside Tab Moves Focus. The cursor takes `editor.overtypeCursorStyle` in overtype mode and `editor.cursorStyle` otherwise; of their styles only `block` (one char wide, the char under it in `editorCursor.background` or the caret color's opposite) and `line` are drawn, the underline and outline styles draw a line.-- Toggle Tab Key Moves Focus (toggleTabFocusMode.ts, tabFocus.ts, editorStatus.ts `TabFocusMode`): the mode starts from `editor.tabFocusMode` and follows each change of the setting; the toggle flips it in between. A setting changed and changed back within one toggle resumes the toggled mode, where upstream takes the setting's value. With the mode on, `editorTabMovesFocus` turns the tab and outdent keybindings off and Tab moves the focus from the editor text to the status bar, drawn with its 1px `statusBar.focusBorder` outline and rounded bottom corners; Shift+Tab returns. The rest of the browser's Tab order (the title bar's Go Back button after the status bar, the breadcrumbs before the editor) is not ported, so Tab on the status bar and Shift+Tab in the editor keep the focus where it is. The aria alert ("Pressing Tab will now ...") has no GPUI equivalent. The "Tab Moves Focus" item paints `statusBarItem.prominentBackground` around the label's margins with 4px corners (modernUI statusBar.css). ui-pair (`notes.txt`): the item and the status bar outline match the reference; the word highlight stays in the port's tab1 shot only because cua leaves the port window inactive, where GPUI sends no focus events (the tab_focus test covers the blur).+- Toggle Tab Key Moves Focus (toggleTabFocusMode.ts, tabFocus.ts, editorStatus.ts `TabFocusMode`): the mode starts from `editor.tabFocusMode` and follows each change of the setting; the toggle flips it in between. A setting changed and changed back within one toggle resumes the toggled mode, where upstream takes the setting's value. With the mode on, `editorTabMovesFocus` turns the tab and outdent keybindings off and Tab moves the focus from the editor text to the status bar, drawn with its 1px `statusBar.focusBorder` outline and rounded bottom corners; Shift+Tab returns. Past the status bar Tab follows the browser's DOM order (probed on the reference with `port/tools/ref-dom` `key:Tab`): the editor group's tab, close actions and toolbar, the editor text, the panel, the status bar, the title bar (Go Back and Go Forward, the command center, the layout actions), the activity bar, the side bar's views, back to the editor. The workbench's Tab and Shift+Tab are a bubble-phase default (`keyboard.rs` `tab_key_down`, after every element's own handler, as the browser's default action) that call GPUI's `focus_next` / `focus_prev` over `tab_stop` handles in paint order (`editor_status.rs` `move_tab_focus`). Each action bar is one tab stop, the item it last focused or its first (actionbar.ts `setFocusable`, roving tabindex; `action_bar.rs` `is_roving_tab_stop`); the command center's center item and each editor tab's close action are bars of their own (commandCenterControl.ts, multiEditorTabsControl.ts), and an inactive tab's close action stays focusable at `opacity: 0` (connectedEditorTabs.css). The content hover keeps its own order: Shift+Tab from the editor text enters it at its last element and Tab past its last element leaves it for the stop after the editor; Tab in the text hides it (contentHoverController.ts `_onKeyDown`). Tests: `cargo test -p app -- tab_walks_the_parts_in_the_dom_order the_title_bar_toolbars_are_tab_stops_in_the_dom_order the_tab_close_actions_and_the_editor_actions_toolbar_are_tab_stops the_verbosity_actions_use_the_focused_part`. The aria alert ("Pressing Tab will now ...") has no GPUI equivalent. The "Tab Moves Focus" item paints `statusBarItem.prominentBackground` around the label's margins with 4px corners (modernUI statusBar.css). ui-pair (`notes.txt`): the item and the status bar outline match the reference; the word highlight stays in the port's tab1 shot only because cua leaves the port window inactive, where GPUI sends no focus events (the tab_focus test covers the blur).- Render whitespace (viewParts/whitespace/whitespace.ts, the default `experimentalWhitespaceRendering: svg`): `editor.renderWhitespace` (`none`, `boundary`, `selection` by default, `trailing`, `all`) picks the spaces and tabs (`editor/whitespace.rs`, `cargo test -p app whitespace`) up to `stopRenderingLineAfter`; each space is a circle of radius spaceWidth / 7 at the middle of its cell and each tab the 10-point arrow of `_renderArrow`, in `editorWhitespace.foreground`, painted after the decorations and under the text. In `selection` mode a selection counts on a line only when it covers at least one character there. The port never wraps, so the wrapped-line cases of `boundary` and `trailing` do not apply. View: Toggle Render Whitespace (toggleRenderWhitespace.ts) writes `all` when the setting is `none`, else `none`; the View > Appearance > Render Whitespace submenu and its five Set Render Whitespace actions wait for the Appearance menu.- Column selection mode (toggleColumnSelection.ts): Toggle Column Selection Mode flips `editor.columnSelection` and is checked in the Selection menu (`4_config`). Turned on, the primary selection becomes a column selection from its anchor to its head; turned off, the column selection's corners become one selection (`column_selection_mode_changed`). While it is on, a drag or Shift+click on the text selects a column (`dispatchMouse`) and Shift+arrows run the `cursorColumnSelect*` keys. The Selection menu's other `4_config` item runs Toggle Multi-Cursor Modifier (toggleMultiCursorModifier.ts), titled by the `multiCursorModifier` context key; with `editor.multiCursorModifier` `ctrlCmd` the text click takes Cmd as the multi-cursor modifier and Alt+drag selects a column (`dispatchMouse`).- Save participants (saveParticipants.ts, `editor/save_participants.rs`): every save of a model (Cmd+S, Save All, the host's `$save`, `$saveAll` and `$trySaveDocument`, search replace) first runs, with the settings of the model's language and resource, `files.trimTrailingWhitespace` (no cursor spared, as an explicit save), `files.insertFinalNewline` and `files.trimFinalNewlines`, after an undo stop, so their edits undo as one step; the selections stay as they were. Format on Save and Code Actions on Save wait for the formatting and code action providers (milestone 13); Save without Formatting (`workbench.action.files.saveWithoutFormatting`) skips all of them. The host's participants still run before the workbench's, where upstream registers the workbench's first.diff --git a/port/tools/ref-dom b/port/tools/ref-domindex 56bb850a7d3..c5bf1d424f3 100755--- a/port/tools/ref-dom+++ b/port/tools/ref-dom@@ -35,6 +35,7 @@ const keys: Record<string, { key: string; code: string; windowsVirtualKeyCode: nJ: { key: 'j', code: 'KeyJ', windowsVirtualKeyCode: 74 },Comma: { key: ',', code: 'Comma', windowsVirtualKeyCode: 188 },Space: { key: ' ', code: 'Space', windowsVirtualKeyCode: 32 },+ Tab: { key: 'Tab', code: 'Tab', windowsVirtualKeyCode: 9 },};// CDP `modifiers` bits, for keys written as `shift+alt+F12`.const modifierBits: Record<string, number> = { alt: 1, ctrl: 2, meta: 4, shift: 8 };