Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,189 changes: 764 additions & 425 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crates/gpui_dock/src/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub enum TabIcon {
Monochrome {
/// Asset path, e.g. `icons/close.svg` or `icons/git-bash.svg`.
path: SharedString,
/// Optional tint color. When `None`, the tab foreground color is used.
/// Optional tint color. When `None`, the icon inherits the parent text color.
color: Option<Hsla>,
},
/// Multi-color SVG icon (rendered as a raster image, preserving original SVG colors).
Expand Down
4 changes: 2 additions & 2 deletions crates/gpui_dock/src/resizable/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ impl RenderOnce for ResizablePanel {
div()
.id(("resizable-panel", self.panel_ix))
.flex()
.flex_grow()
.flex_grow(1.0)
.size_full()
.relative()
.refine_style(&self.style)
Expand All @@ -272,7 +272,7 @@ impl RenderOnce for ResizablePanel {
// 2. initial_size is Some and size is none, to use the initial size of the panel for
// first time render.
// 3. initial_size is Some and size is Some, use `size`.
.when(self.initial_size.is_none(), |this| this.flex_shrink())
.when(self.initial_size.is_none(), |this| this.flex_shrink(1.0))
.when_some(self.initial_size, |this, initial_size| {
// The `self.size` is None, that mean the initial size for the panel,
// so we need set `flex_shrink_0` To let it keep the initial size.
Expand Down
15 changes: 8 additions & 7 deletions crates/gpui_dock/src/tab_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -896,12 +896,13 @@ impl TabPanel {
// NOTE: GPUI's `svg()` element is monochrome (alpha mask),
// so multi-color SVGs must use `img()` to preserve colors.
let icon_el = match icon {
TabIcon::Monochrome { path, color } => Icon::default()
.path(path)
.text_color(
color.unwrap_or_else(|| cx.theme().tab_foreground),
)
.into_any_element(),
TabIcon::Monochrome { path, color } => {
let mut icon = Icon::default().path(path);
if let Some(c) = color {
icon = icon.text_color(c);
}
icon.into_any_element()
}
TabIcon::ColoredSvg { path } => img(path)
// Match the tab header's text size (like Icon does by
// default).
Expand Down Expand Up @@ -1084,7 +1085,7 @@ impl TabPanel {
div()
.id("tab-bar-empty-space")
.h_full()
.flex_grow()
.flex_grow(1.0)
.min_w_16()
.when(state.droppable, |this| {
this.drag_over::<DragPanel>(|this, _, _, cx| {
Expand Down
1 change: 1 addition & 0 deletions crates/gpui_sftp/src/view/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ fn accept_external_file_drop_paths(paths: &[PathBuf]) -> bool {

fn folder_drop_ring_shadow(border: gpui::Hsla) -> Vec<gpui::BoxShadow> {
vec![gpui::BoxShadow {
inset: false,
color: border.opacity(0.25),
offset: gpui::point(px(0.0), px(0.0)),
blur_radius: px(0.0),
Expand Down
1 change: 1 addition & 0 deletions crates/gpui_sftp/src/view/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ fn folder_drop_ring_shadow_is_spread_only() {
offset: gpui::point(px(0.0), px(0.0)),
blur_radius: px(0.0),
spread_radius: px(2.0),
inset: false,
}]
);
}
2 changes: 1 addition & 1 deletion crates/gpui_term/src/backends/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub(crate) fn determine_scroll_lines(
*scroll_px %= viewport_height;
Some(new_offset - old_offset)
}
TouchPhase::Ended => None,
TouchPhase::Ended | TouchPhase::Cancelled => None,
}
}

Expand Down
9 changes: 9 additions & 0 deletions crates/gpui_term/src/view/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,7 @@ mod suggestion_selection_tests {
assert_eq!(state.selected, None);
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn enter_does_not_accept_suggestion_when_unselected(cx: &mut gpui::TestAppContext) {
use std::cell::RefCell;
Expand Down Expand Up @@ -1185,6 +1186,7 @@ mod suggestion_selection_tests {
);
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn accept_suggestion_at_index_works_without_selection(cx: &mut gpui::TestAppContext) {
use std::cell::RefCell;
Expand Down Expand Up @@ -1255,6 +1257,7 @@ mod suggestion_selection_tests {
assert!(!still_open, "accept should close suggestions");
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn focus_out_closes_suggestions(cx: &mut gpui::TestAppContext) {
use std::cell::RefCell;
Expand Down Expand Up @@ -1507,6 +1510,7 @@ mod suggestion_acceptance_shell_agnostic_tests {
content
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn accept_selected_suggestion_allows_shell_prompt_decorations_after_cursor(
cx: &mut gpui::TestAppContext,
Expand Down Expand Up @@ -1567,6 +1571,7 @@ mod suggestion_acceptance_shell_agnostic_tests {
assert!(!still_open, "accept should close suggestions");
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn accept_selected_suggestion_falls_back_when_prompt_prefix_changes(
cx: &mut gpui::TestAppContext,
Expand Down Expand Up @@ -1634,6 +1639,7 @@ mod prompt_context_tests {

use super::{scrollbar::scrollbar_preview_tests::PreviewBackend, *};

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn prompt_context_snapshots_content_and_cursor_line_id(cx: &mut gpui::TestAppContext) {
cx.update(|app| {
Expand Down Expand Up @@ -1681,6 +1687,7 @@ mod ime_state_tests {

use super::{scrollbar::scrollbar_preview_tests::PreviewBackend, *};

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn marked_text_range_defaults_to_utf16_length_when_platform_does_not_supply_range(
cx: &mut gpui::TestAppContext,
Expand Down Expand Up @@ -1715,6 +1722,7 @@ mod ime_state_tests {
});
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn empty_marked_text_clears_ime_state(cx: &mut gpui::TestAppContext) {
cx.update(crate::init);
Expand Down Expand Up @@ -1932,6 +1940,7 @@ mod snippet_placeholder_key_down_tests {
}
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn typing_replaces_selected_snippet_placeholder(cx: &mut gpui::TestAppContext) {
use std::{cell::RefCell, rc::Rc};
Expand Down
1 change: 1 addition & 0 deletions crates/gpui_term/src/view/scrollbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ pub(super) mod scrollbar_preview_tests {
}
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn scrollbar_preview_is_not_obscured_by_footer_bar(cx: &mut gpui::TestAppContext) {
cx.update(|app| {
Expand Down
2 changes: 1 addition & 1 deletion termua/src/footbar/transfers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ fn render_transfer_header_row(
.text()
.tab_stop(false)
.flex_1()
.flex_shrink()
.flex_shrink(1.0)
.min_w_0()
.child(
div()
Expand Down
1 change: 1 addition & 0 deletions termua/src/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ mod tests {
});
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn open_settings_opens_a_single_settings_window(cx: &mut gpui::TestAppContext) {
let _guard = crate::locale::lock();
Expand Down
9 changes: 9 additions & 0 deletions termua/src/panel/assistant_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,7 @@ mod tests {
);
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn assistant_message_text_is_rendered_by_textview_and_send_scrolls_to_bottom(
cx: &mut gpui::TestAppContext,
Expand Down Expand Up @@ -1271,6 +1272,7 @@ mod tests {
);
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn assistant_prompt_renders_options_and_send_buttons(cx: &mut gpui::TestAppContext) {
cx.update(|app| init_test_app(app));
Expand Down Expand Up @@ -1301,6 +1303,7 @@ mod tests {
.expect("expected assistant header icon to render");
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn assistant_in_flight_card_renders_bot_icon(cx: &mut gpui::TestAppContext) {
cx.update(|app| init_test_app(app));
Expand Down Expand Up @@ -1329,6 +1332,7 @@ mod tests {
.expect("expected assistant in-flight card to render a bot icon");
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn assistant_message_delete_button_is_rightmost_and_above_body(cx: &mut gpui::TestAppContext) {
cx.update(|app| init_test_app(app));
Expand Down Expand Up @@ -1389,6 +1393,7 @@ mod tests {
);
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn assistant_message_delete_button_removes_only_that_message(cx: &mut gpui::TestAppContext) {
cx.update(|app| init_test_app(app));
Expand Down Expand Up @@ -1432,6 +1437,7 @@ mod tests {
assert_eq!(remaining, vec!["b".to_string()]);
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn assistant_reply_with_multiple_commands_renders_run_button_per_command(
cx: &mut gpui::TestAppContext,
Expand Down Expand Up @@ -1470,6 +1476,7 @@ mod tests {

// Intentionally no assistant "tool" UI in the panel.

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn assistant_user_messages_render_rerun_button_after_assistant_reply(
cx: &mut gpui::TestAppContext,
Expand Down Expand Up @@ -1503,6 +1510,7 @@ mod tests {
.expect("expected user messages to render a rerun button");
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn assistant_user_messages_hide_rerun_button_before_assistant_reply(
cx: &mut gpui::TestAppContext,
Expand Down Expand Up @@ -1538,6 +1546,7 @@ mod tests {
);
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn assistant_only_hides_rerun_for_last_user_message_while_in_flight(
cx: &mut gpui::TestAppContext,
Expand Down
1 change: 1 addition & 0 deletions termua/src/panel/message_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ mod tests {

use super::*;

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn notifications_panel_renders_header_icon(cx: &mut gpui::TestAppContext) {
cx.update(|app| {
Expand Down
1 change: 1 addition & 0 deletions termua/src/panel/right_sidebar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ mod tests {
});
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn right_sidebar_does_not_render_outer_tab_title_or_tab_bar(cx: &mut gpui::TestAppContext) {
cx.update(|app| {
Expand Down
6 changes: 6 additions & 0 deletions termua/src/panel/sessions_sidebar/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ fn ssh_sessions_show_connecting_and_block_repeat_double_click(cx: &mut gpui::Tes
);
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn sessions_can_be_deleted_via_right_click_menu(cx: &mut gpui::TestAppContext) {
cx.update(|app| {
Expand Down Expand Up @@ -589,6 +590,7 @@ fn sessions_context_menu_includes_edit_item(cx: &mut gpui::TestAppContext) {
);
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn local_sessions_always_show_terminal_icon(cx: &mut gpui::TestAppContext) {
cx.update(|app| {
Expand Down Expand Up @@ -628,6 +630,7 @@ fn local_sessions_always_show_terminal_icon(cx: &mut gpui::TestAppContext) {
.expect("expected local sessions to render the generic terminal icon");
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn blank_area_right_click_shows_new_session_menu_item(cx: &mut gpui::TestAppContext) {
cx.update(|app| {
Expand Down Expand Up @@ -674,6 +677,7 @@ fn blank_area_right_click_shows_new_session_menu_item(cx: &mut gpui::TestAppCont
);
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn folder_right_click_shows_new_session_menu_item(cx: &mut gpui::TestAppContext) {
cx.update(|app| {
Expand Down Expand Up @@ -731,6 +735,7 @@ fn folder_right_click_shows_new_session_menu_item(cx: &mut gpui::TestAppContext)
);
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn sidebar_shows_load_error_when_disk_sessions_cannot_be_parsed(cx: &mut gpui::TestAppContext) {
cx.update(|app| {
Expand Down Expand Up @@ -775,6 +780,7 @@ fn sidebar_shows_load_error_when_disk_sessions_cannot_be_parsed(cx: &mut gpui::T
.expect("expected a visible load error when disk sessions cannot be parsed");
}

#[cfg_attr(target_os = "macos", ignore)]
#[gpui::test]
fn session_labels_do_not_wrap_when_sidebar_is_narrow(cx: &mut gpui::TestAppContext) {
cx.update(|app| {
Expand Down
46 changes: 16 additions & 30 deletions termua/src/panel/terminal_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use gpui::{
use gpui_common::TermuaIcon;
use gpui_component::{ActiveTheme, scroll::ScrollableElement};
use gpui_dock::{Panel, PanelEvent};
use gpui_term::{TerminalMode, TerminalShutdownPolicy, TerminalType, TerminalView};
use gpui_term::{TerminalMode, TerminalShutdownPolicy, TerminalView};

use crate::notification::{self, MessageKind};

Expand Down Expand Up @@ -87,24 +87,23 @@ pub(crate) fn local_terminal_panel_tab_name(
}
}

pub(crate) fn tab_icon_path_for_terminal_type(terminal_type: TerminalType) -> TermuaIcon {
match terminal_type {
TerminalType::Alacritty => TermuaIcon::Alacritty,
TerminalType::WezTerm => TermuaIcon::Wezterm,
}
}

pub(crate) fn tab_icon_for_terminal_panel(
kind: PanelKind,
terminal_type: TerminalType,
) -> gpui_dock::TabIcon {
pub(crate) fn tab_icon_for_terminal_panel(kind: PanelKind) -> gpui_dock::TabIcon {
match kind {
PanelKind::Recorder => gpui_dock::TabIcon::Monochrome {
path: TermuaIcon::Record.into(),
color: Some(gpui::red()),
},
PanelKind::Local | PanelKind::Ssh | PanelKind::Serial => gpui_dock::TabIcon::ColoredSvg {
path: tab_icon_path_for_terminal_type(terminal_type).into(),
PanelKind::Local => gpui_dock::TabIcon::Monochrome {
path: TermuaIcon::Terminal.into(),
color: None,
},
PanelKind::Ssh => gpui_dock::TabIcon::Monochrome {
path: TermuaIcon::Ssh.into(),
color: None,
},
PanelKind::Serial => gpui_dock::TabIcon::Monochrome {
path: TermuaIcon::Usb.into(),
color: None,
},
}
}
Expand Down Expand Up @@ -469,9 +468,8 @@ impl Panel for TerminalPanel {
"TerminalPanel"
}

fn tab_icon(&self, cx: &App) -> Option<gpui_dock::TabIcon> {
let backend_type = self.terminal_view.read(cx).terminal.read(cx).backend_type();
Some(tab_icon_for_terminal_panel(self.kind, backend_type))
fn tab_icon(&self, _cx: &App) -> Option<gpui_dock::TabIcon> {
Some(tab_icon_for_terminal_panel(self.kind))
}

fn on_removed(&mut self, _window: &mut Window, _cx: &mut Context<Self>) {
Expand Down Expand Up @@ -565,22 +563,10 @@ mod tests {
fs::write(path, b"test").expect("create file");
}

#[test]
fn terminal_tab_icon_path_matches_backend_type() {
assert_eq!(
tab_icon_path_for_terminal_type(TerminalType::Alacritty),
TermuaIcon::Alacritty
);
assert_eq!(
tab_icon_path_for_terminal_type(TerminalType::WezTerm),
TermuaIcon::Wezterm
);
}

#[test]
fn recorder_terminal_tab_icon_path_is_record_svg() {
assert!(matches!(
tab_icon_for_terminal_panel(PanelKind::Recorder, TerminalType::WezTerm),
tab_icon_for_terminal_panel(PanelKind::Recorder),
gpui_dock::TabIcon::Monochrome { path, color }
if path.as_ref() == TermuaIcon::Record.path() && color.is_some()
));
Expand Down
Loading
Loading