first pass of merging in warp (doesn't build)
This commit is contained in:
+326
-188
@@ -4,6 +4,7 @@
|
||||
|
||||
mod agent_mode;
|
||||
mod ai_assistant;
|
||||
mod ai_document;
|
||||
mod block_filtering;
|
||||
mod bootstrapping;
|
||||
mod code_review;
|
||||
@@ -18,6 +19,8 @@ mod notebooks;
|
||||
mod pane_restoration;
|
||||
#[cfg(target_os = "macos")]
|
||||
mod preview_config_migration;
|
||||
mod remote_server;
|
||||
mod rich_input_ctrl_enter;
|
||||
mod rules;
|
||||
mod secrets;
|
||||
mod session_restoration;
|
||||
@@ -34,8 +37,16 @@ mod websockets;
|
||||
mod workflows;
|
||||
mod workspace;
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
use std::time::Duration;
|
||||
|
||||
pub use agent_mode::*;
|
||||
pub use ai_assistant::*;
|
||||
pub use ai_document::*;
|
||||
use anyhow::{anyhow, Result};
|
||||
pub use block_filtering::*;
|
||||
pub use bootstrapping::*;
|
||||
pub use code_review::*;
|
||||
@@ -49,201 +60,143 @@ pub use keyboard_protocol::*;
|
||||
pub use launch_configs::*;
|
||||
pub use notebooks::*;
|
||||
pub use pane_restoration::*;
|
||||
use parking_lot::Mutex;
|
||||
use pathfinder_geometry::rect::RectF;
|
||||
use pathfinder_geometry::vector::Vector2F;
|
||||
#[cfg(target_os = "macos")]
|
||||
pub use preview_config_migration::*;
|
||||
pub use remote_server::*;
|
||||
pub use rich_input_ctrl_enter::*;
|
||||
pub use rules::*;
|
||||
use rust_embed::RustEmbed;
|
||||
pub use secrets::*;
|
||||
pub use session_restoration::*;
|
||||
use settings::Setting as _;
|
||||
pub use settings_file_errors::*;
|
||||
pub use settings_file_hot_reload::*;
|
||||
pub use settings_file_migration::*;
|
||||
pub use settings_private::*;
|
||||
use shell::ShellType;
|
||||
pub use ssh::*;
|
||||
pub use subshell::*;
|
||||
use sum_tree::SeekBias;
|
||||
pub use sync_inputs::*;
|
||||
use sysinfo::{Pid, ProcessesToUpdate, System};
|
||||
pub use typeahead::*;
|
||||
use version_compare::Cmp;
|
||||
pub use video_recording::*;
|
||||
use warp::appearance::Appearance;
|
||||
use warp::features::FeatureFlag;
|
||||
use warp::integration_testing::assertions::{
|
||||
assert_binding_display_string, go_offline, go_online, join_a_workspace,
|
||||
};
|
||||
use warp::integration_testing::block::{
|
||||
assert_block_visible, assert_bottom_of_block_approx_at, assert_num_blocks_in_model,
|
||||
BlockPosition, LinePosition,
|
||||
};
|
||||
use warp::integration_testing::clipboard::assert_clipboard_contains_string;
|
||||
use warp::integration_testing::command_palette::{
|
||||
close_command_palette, open_command_palette, open_command_palette_and_run_action, TestStepsExt,
|
||||
};
|
||||
use warp::integration_testing::context_chips::assert_working_dir_is_present;
|
||||
use warp::integration_testing::find::{Find, FindWithinBlockState};
|
||||
use warp::integration_testing::input::{
|
||||
input_contains_string, input_is_empty, open_input_context_menu,
|
||||
};
|
||||
use warp::integration_testing::navigation_palette::{
|
||||
check_recency, navigate_to_other_session_step, open_navigation_palette_step, RecentSession,
|
||||
};
|
||||
use warp::integration_testing::pane_group::assert_focused_pane_index;
|
||||
use warp::integration_testing::settings::{
|
||||
assert_theme_chooser_contains, set_window_custom_size, toggle_setting,
|
||||
};
|
||||
use warp::integration_testing::step::{
|
||||
assert_no_pending_model_events, new_step_with_default_assertions,
|
||||
new_step_with_default_assertions_for_pane,
|
||||
};
|
||||
use warp::integration_testing::tab::{assert_pane_title, assert_tab_title, tab_title_step};
|
||||
use warp::integration_testing::terminal::util::{
|
||||
current_shell_starter_and_version, ExactLine, ExpectedExitStatus,
|
||||
};
|
||||
use warp::integration_testing::terminal::{
|
||||
assert_active_block_output, assert_active_block_output_for_single_terminal_in_tab,
|
||||
assert_active_block_received_precmd, assert_alt_grid_active, assert_alt_screen_output,
|
||||
assert_command_executed_for_single_terminal_in_tab, assert_context_menu_is_open,
|
||||
assert_focused_editor_in_tab, assert_gap_exists, assert_input_at_bottom_of_terminal,
|
||||
assert_input_at_top_of_terminal, assert_input_mode,
|
||||
assert_input_not_at_either_edge_of_terminal, assert_long_running_block_executing,
|
||||
assert_long_running_block_executing_for_single_terminal_in_tab, assert_model_term_mode,
|
||||
assert_pane_group_has_state, assert_scroll_position,
|
||||
assert_selected_block_index_is_first_renderable,
|
||||
assert_selected_block_index_is_last_renderable, assert_single_terminal_in_tab_bootstrapped,
|
||||
assert_snackbar_is_not_visible, assert_snackbar_is_visible, assert_terminal_bootstrapped,
|
||||
assert_terminal_bootstrapping, assert_view_has_text_selection,
|
||||
assert_waterfall_gap_empty_background_rendered, clear_blocklist_to_remove_bootstrapped_blocks,
|
||||
execute_command_for_single_terminal_in_tab, execute_echo, execute_long_running_command,
|
||||
execute_long_running_command_for_pane, execute_python_interpreter_in_tab,
|
||||
open_context_menu_for_selected_block, performance_test, run_alt_grid_program, run_completer,
|
||||
validate_git_branch, wait_until_bootstrapped_pane, wait_until_bootstrapped_single_pane_for_tab,
|
||||
};
|
||||
use warp::integration_testing::view_getters::{
|
||||
pane_group_view, single_input_suggestions_view_for_tab, single_input_view_for_tab,
|
||||
single_terminal_pane_view_for_tab, single_terminal_view, single_terminal_view_for_tab,
|
||||
workspace_view,
|
||||
};
|
||||
use warp::integration_testing::warp_drive::{
|
||||
assert_is_left_panel_open, assert_warp_drive_is_closed, assert_warp_drive_is_open,
|
||||
};
|
||||
use warp::integration_testing::window::{
|
||||
add_and_save_window, add_window, add_window_and_check_bounds, close_window,
|
||||
save_active_window_id,
|
||||
};
|
||||
use warp::integration_testing::workspace::assert_tab_count;
|
||||
use warp::integration_testing::{self, view_of_type};
|
||||
use warp::pane_group::AGENT_MODE_PANE_DEFAULT_MINIMUM_WIDTH;
|
||||
use warp::settings::{
|
||||
CompletionsOpenWhileTyping, CtrlTabBehavior, MonospaceFontSize, TabBehavior, INPUT_MODE,
|
||||
};
|
||||
use warp::settings_view::keybindings::KeybindingsView;
|
||||
use warp::settings_view::{FeaturesPageAction, SettingsAction, SettingsSection, SettingsView};
|
||||
use warp::terminal::alt_screen_reporting::MouseReportingEnabled;
|
||||
use warp::terminal::available_shells::AvailableShells;
|
||||
use warp::terminal::block_list_viewport::{InputMode, ScrollLines, ScrollPosition};
|
||||
use warp::terminal::find::TerminalFindModel;
|
||||
use warp::terminal::input::{Input, InputSuggestionsMode};
|
||||
use warp::terminal::keys_settings::KeysSettings;
|
||||
use warp::terminal::local_tty::TerminalManager as LocalTtyTerminalManager;
|
||||
use warp::terminal::model::ansi::{Handler, InitShellValue};
|
||||
use warp::terminal::model::blocks::{BlockHeightItem, BlockHeightSummary, TotalIndex};
|
||||
use warp::terminal::model::grid::grid_handler::TermMode;
|
||||
use warp::terminal::model::grid::Dimensions;
|
||||
use warp::terminal::model::terminal_model::BlockIndex;
|
||||
use warp::terminal::session_settings::{HonorPS1, SessionSettings, StartupShellOverride};
|
||||
use warp::terminal::view::{
|
||||
BlockVisibilityMode, TerminalAction, TerminalViewState, ALIAS_EXPANSION_BANNER_SEEN_KEY,
|
||||
};
|
||||
use warp::terminal::{shell, TerminalView};
|
||||
use warp::util::bindings::CustomAction;
|
||||
use warp::workflows::categories::CategoriesView;
|
||||
use warp::workspace::{
|
||||
Workspace, WorkspaceAction, NEW_SESSION_MENU_BUTTON_POSITION_ID, NEW_TAB_BUTTON_POSITION_ID,
|
||||
};
|
||||
use warp::{cmd_or_ctrl_shift, AgentModeEntrypoint};
|
||||
use galaxyui_core::event::KeyState;
|
||||
use galaxyui_core::integration::{AssertionOutcome, StepData, TestStep};
|
||||
use galaxyui_core::keymap::{Keystroke, PerPlatformKeystroke, Trigger};
|
||||
use galaxyui_core::platform::keyboard::KeyCode;
|
||||
use galaxyui_core::platform::{OperatingSystem, TerminationMode};
|
||||
use galaxyui_core::units::Lines;
|
||||
use galaxyui_core::windowing::WindowManager;
|
||||
use galaxyui_core::{
|
||||
async_assert, async_assert_eq, AssetProvider, Event, SingletonEntity, UpdateView, ViewHandle,
|
||||
};
|
||||
pub use websockets::*;
|
||||
pub use workflows::*;
|
||||
pub use workspace::*;
|
||||
|
||||
use std::{borrow::Cow, collections::HashMap, path::PathBuf, rc::Rc, time::Duration};
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use galaxyui::{
|
||||
async_assert, async_assert_eq,
|
||||
integration::{AssertionOutcome, StepData, TestStep},
|
||||
keymap::{Keystroke, Trigger},
|
||||
platform::{OperatingSystem, TerminationMode},
|
||||
windowing::WindowManager,
|
||||
AssetProvider, Event, SingletonEntity, UpdateView, ViewHandle,
|
||||
};
|
||||
use parking_lot::Mutex;
|
||||
use pathfinder_geometry::{rect::RectF, vector::Vector2F};
|
||||
use rust_embed::RustEmbed;
|
||||
use settings::Setting as _;
|
||||
use shell::ShellType;
|
||||
|
||||
use galaxy::{
|
||||
terminal::find::TerminalFindModel, util::bindings::CustomAction, AgentModeEntrypoint,
|
||||
};
|
||||
|
||||
use galaxyui::units::Lines;
|
||||
use sysinfo::{Pid, ProcessesToUpdate, System};
|
||||
use version_compare::Cmp;
|
||||
|
||||
use crate::util::{skip_if_powershell_core_2303, ShellRcType};
|
||||
|
||||
use crate::builder::cargo_target_tmpdir;
|
||||
use crate::user_defaults;
|
||||
use crate::Builder;
|
||||
use galaxy::integration_testing::terminal::assert_focused_editor_in_tab;
|
||||
use galaxy::integration_testing::{
|
||||
settings::assert_theme_chooser_contains,
|
||||
tab::{assert_pane_title, assert_tab_title},
|
||||
};
|
||||
use galaxy::settings::CtrlTabBehavior;
|
||||
use galaxy::terminal::keys_settings::KeysSettings;
|
||||
use galaxy::terminal::{
|
||||
model::{blocks::BlockHeightSummary, terminal_model::BlockIndex},
|
||||
view::TerminalViewState,
|
||||
};
|
||||
use galaxy::workflows::categories::CategoriesView;
|
||||
use galaxy::{
|
||||
appearance::Appearance,
|
||||
cmd_or_ctrl_shift,
|
||||
integration_testing::{
|
||||
assertions::{assert_binding_display_string, go_offline, go_online},
|
||||
block::{
|
||||
assert_block_visible, assert_bottom_of_block_approx_at, assert_num_blocks_in_model,
|
||||
BlockPosition, LinePosition,
|
||||
},
|
||||
clipboard::assert_clipboard_contains_string,
|
||||
context_chips::assert_working_dir_is_present,
|
||||
input::open_input_context_menu,
|
||||
navigation_palette::{
|
||||
check_recency, navigate_to_other_session_step, open_navigation_palette_step,
|
||||
RecentSession,
|
||||
},
|
||||
settings::toggle_setting,
|
||||
step::{
|
||||
assert_no_pending_model_events, new_step_with_default_assertions,
|
||||
new_step_with_default_assertions_for_pane,
|
||||
},
|
||||
tab::tab_title_step,
|
||||
terminal::{
|
||||
assert_active_block_output_for_single_terminal_in_tab,
|
||||
assert_active_block_received_precmd,
|
||||
assert_command_executed_for_single_terminal_in_tab, assert_context_menu_is_open,
|
||||
assert_gap_exists, assert_input_at_bottom_of_terminal, assert_input_at_top_of_terminal,
|
||||
assert_input_mode, assert_input_not_at_either_edge_of_terminal,
|
||||
assert_long_running_block_executing_for_single_terminal_in_tab, assert_model_term_mode,
|
||||
assert_pane_group_has_state, assert_scroll_position,
|
||||
assert_selected_block_index_is_first_renderable,
|
||||
assert_selected_block_index_is_last_renderable,
|
||||
assert_single_terminal_in_tab_bootstrapped, assert_snackbar_is_not_visible,
|
||||
assert_snackbar_is_visible, assert_view_has_text_selection,
|
||||
assert_waterfall_gap_empty_background_rendered,
|
||||
execute_command_for_single_terminal_in_tab, execute_echo, execute_long_running_command,
|
||||
execute_python_interpreter_in_tab, performance_test, run_alt_grid_program,
|
||||
run_completer, util::current_shell_starter_and_version, util::ExpectedExitStatus,
|
||||
validate_git_branch, wait_until_bootstrapped_pane,
|
||||
wait_until_bootstrapped_single_pane_for_tab,
|
||||
},
|
||||
view_getters::{
|
||||
single_input_suggestions_view_for_tab, single_input_view_for_tab,
|
||||
single_terminal_view_for_tab,
|
||||
},
|
||||
view_of_type,
|
||||
window::{add_window, add_window_and_check_bounds, close_window, save_active_window_id},
|
||||
},
|
||||
settings::{TabBehavior, INPUT_MODE},
|
||||
settings_view::FeaturesPageAction,
|
||||
terminal::{
|
||||
alt_screen_reporting::MouseReportingEnabled,
|
||||
block_list_viewport::{InputMode, ScrollPosition},
|
||||
model::grid::grid_handler::TermMode,
|
||||
session_settings::SessionSettings,
|
||||
session_settings::{HonorPS1, StartupShellOverride},
|
||||
view::BlockVisibilityMode,
|
||||
},
|
||||
};
|
||||
use sum_tree::SeekBias;
|
||||
|
||||
use galaxy::terminal::view::ALIAS_EXPANSION_BANNER_SEEN_KEY;
|
||||
use galaxy::{
|
||||
features::FeatureFlag,
|
||||
integration_testing::{
|
||||
find::{Find, FindWithinBlockState},
|
||||
pane_group::assert_focused_pane_index,
|
||||
settings::set_window_custom_size,
|
||||
terminal::assert_terminal_bootstrapping,
|
||||
view_getters::pane_group_view,
|
||||
window::add_and_save_window,
|
||||
},
|
||||
};
|
||||
use galaxy::{
|
||||
integration_testing::warp_drive::{
|
||||
assert_is_left_panel_open, assert_warp_drive_is_closed, assert_warp_drive_is_open,
|
||||
},
|
||||
settings::CompletionsOpenWhileTyping,
|
||||
};
|
||||
use galaxy::{
|
||||
integration_testing::{
|
||||
self,
|
||||
input::{input_contains_string, input_is_empty},
|
||||
terminal::{
|
||||
clear_blocklist_to_remove_bootstrapped_blocks, open_context_menu_for_selected_block,
|
||||
},
|
||||
},
|
||||
settings::MonospaceFontSize,
|
||||
};
|
||||
use galaxy::{
|
||||
integration_testing::{assertions::join_a_workspace, view_getters::single_terminal_view},
|
||||
terminal::view::TerminalAction,
|
||||
};
|
||||
use galaxy::{
|
||||
integration_testing::{
|
||||
command_palette::{
|
||||
close_command_palette, open_command_palette, open_command_palette_and_run_action,
|
||||
TestStepsExt,
|
||||
},
|
||||
view_getters::single_terminal_pane_view_for_tab,
|
||||
},
|
||||
pane_group::AGENT_MODE_PANE_DEFAULT_MINIMUM_WIDTH,
|
||||
};
|
||||
use galaxy::{
|
||||
integration_testing::{terminal::util::ExactLine, workspace::assert_tab_count},
|
||||
terminal::available_shells::AvailableShells,
|
||||
};
|
||||
use galaxy::{
|
||||
integration_testing::{
|
||||
terminal::{
|
||||
assert_active_block_output, assert_alt_grid_active, assert_alt_screen_output,
|
||||
assert_long_running_block_executing, assert_terminal_bootstrapped,
|
||||
execute_long_running_command_for_pane,
|
||||
},
|
||||
view_getters::workspace_view,
|
||||
},
|
||||
workspace::WorkspaceAction,
|
||||
};
|
||||
use galaxy::{settings_view::SettingsAction, terminal::block_list_viewport::ScrollLines};
|
||||
use galaxy::{
|
||||
settings_view::{keybindings::KeybindingsView, SettingsSection, SettingsView},
|
||||
terminal::{
|
||||
input::{Input, InputSuggestionsMode},
|
||||
model::{
|
||||
ansi::{Handler, InitShellValue},
|
||||
blocks::{BlockHeightItem, TotalIndex},
|
||||
grid::Dimensions,
|
||||
},
|
||||
shell, TerminalView,
|
||||
},
|
||||
workspace::{Workspace, NEW_SESSION_MENU_BUTTON_POSITION_ID, NEW_TAB_BUTTON_POSITION_ID},
|
||||
};
|
||||
use galaxyui::event::KeyState;
|
||||
use galaxyui::keymap::PerPlatformKeystroke;
|
||||
use galaxyui::platform::keyboard::KeyCode;
|
||||
use crate::util::{skip_if_powershell_core_2303, ShellRcType};
|
||||
use crate::{user_defaults, Builder};
|
||||
|
||||
const ADD_NEXT_OCCURRENCE_KEYBINDING: &str = "ctrl-g";
|
||||
|
||||
@@ -1931,8 +1884,8 @@ pub fn test_change_font_size() -> Builder {
|
||||
new_builder()
|
||||
.with_step(wait_until_bootstrapped_single_pane_for_tab(0))
|
||||
.with_step(
|
||||
new_step_with_default_assertions("Press ctrl-shift-> and verify font size increases")
|
||||
.with_keystrokes(&["ctrl-shift->"])
|
||||
new_step_with_default_assertions("Press alt-shift-> and verify font size increases")
|
||||
.with_keystrokes(&["alt-shift->"])
|
||||
.add_assertion(|app, window_id| {
|
||||
let input_view = single_input_view_for_tab(app, window_id, 0);
|
||||
input_view.read(app, |view, _ctx| {
|
||||
@@ -1953,8 +1906,8 @@ pub fn test_change_font_size() -> Builder {
|
||||
}),
|
||||
)
|
||||
.with_step(
|
||||
new_step_with_default_assertions("Press ctrl-shift-< and verify font size decreases")
|
||||
.with_keystrokes(&["ctrl-shift-<"])
|
||||
new_step_with_default_assertions("Press alt-shift-< and verify font size decreases")
|
||||
.with_keystrokes(&["alt-shift-<"])
|
||||
.add_assertion(|app, window_id| {
|
||||
let input_view = single_input_view_for_tab(app, window_id, 0);
|
||||
input_view.read(app, |view, _ctx| {
|
||||
@@ -2055,7 +2008,7 @@ pub fn test_add_and_close_session() -> Builder {
|
||||
.expect("pane at index 0 is a terminal pane")
|
||||
.as_ref(ctx)
|
||||
.as_any()
|
||||
.downcast_ref::<galaxy::terminal::local_tty::TerminalManager>()
|
||||
.downcast_ref::<LocalTtyTerminalManager<TerminalView>>()
|
||||
.expect("terminal pane at index 0 contains a local session")
|
||||
.pid()
|
||||
.expect("shell should be spawned")
|
||||
@@ -2173,10 +2126,10 @@ pub fn test_ctrl_tab_session_switching() -> Builder {
|
||||
let mut builder = new_builder();
|
||||
|
||||
// If linux return early. For reasons unknown and not worth the time to debug currently
|
||||
// this test fails on linux at the step where the command pallete is expected to show.
|
||||
// this test fails on linux at the step where the command palette is expected to show.
|
||||
// The feature does work on linux though - there's some underlying issue with our integration
|
||||
// test here.
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||
{
|
||||
return builder;
|
||||
}
|
||||
@@ -2875,7 +2828,7 @@ pub fn test_execute_multiple_cursor_command() -> Builder {
|
||||
new_builder()
|
||||
.with_step(wait_until_bootstrapped_single_pane_for_tab(0))
|
||||
.with_step(
|
||||
new_step_with_default_assertions("Set up multiple cursor commamd")
|
||||
new_step_with_default_assertions("Set up multiple cursor command")
|
||||
.with_typed_characters(&["a", " ", "a"])
|
||||
.with_keystrokes(&[
|
||||
ADD_NEXT_OCCURRENCE_KEYBINDING,
|
||||
@@ -3172,7 +3125,9 @@ pub fn test_block_based_snackbar_small_window() -> Builder {
|
||||
integration_testing::create_file_from_assets(
|
||||
TEST_ONLY_ASSETS,
|
||||
"small_window.sqlite",
|
||||
&integration_testing::persistence::database_file_path(),
|
||||
&integration_testing::persistence::database_file_path_for_scope(
|
||||
&integration_testing::persistence::PersistenceScope::App,
|
||||
),
|
||||
);
|
||||
})
|
||||
.with_step(wait_until_bootstrapped_single_pane_for_tab(0))
|
||||
@@ -3383,7 +3338,7 @@ pub fn test_custom_ps1_expansion_bash() -> Builder {
|
||||
)
|
||||
}
|
||||
|
||||
/// Default auto title. We test that Warp's auto title is used and verify that that
|
||||
/// Default auto title. We test that Warp's auto title is used and verify that
|
||||
/// DISABLE_AUTO_TITLE is set correctly.
|
||||
pub fn test_auto_title() -> Builder {
|
||||
new_builder()
|
||||
@@ -3509,6 +3464,72 @@ precmd_functions+=(set_title)
|
||||
))
|
||||
}
|
||||
|
||||
/// Checks that an OSC 7 escape sequence (`\e]7;file://host/path\a`) emitted by
|
||||
/// the running command updates the block's current working directory mid-command
|
||||
/// without waiting for the next prompt. This lets external tools that change
|
||||
/// directory (for example `wt switch` from worktrunk) keep Warp's per-block CWD
|
||||
/// in sync with the shell. See issue #9125.
|
||||
pub fn test_osc7_updates_current_working_directory() -> Builder {
|
||||
new_builder()
|
||||
.set_should_run_test(|| {
|
||||
let (starter, _) = current_shell_starter_and_version();
|
||||
matches!(
|
||||
starter.shell_type(),
|
||||
shell::ShellType::Bash | shell::ShellType::Zsh
|
||||
)
|
||||
})
|
||||
.with_step(wait_until_bootstrapped_single_pane_for_tab(0))
|
||||
.with_step(clear_blocklist_to_remove_bootstrapped_blocks())
|
||||
.with_step(execute_command_for_single_terminal_in_tab(
|
||||
0, /*tab_idx*/
|
||||
// OSC 7 is only honored when the host portion matches the local
|
||||
// hostname; substitute it dynamically so the test works on any
|
||||
// machine.
|
||||
r#"mkdir -p /tmp/osc7-test && cd /tmp/osc7-test && printf "\033]7;file://$(hostname)/tmp/osc7-test\a""#.to_string(),
|
||||
ExpectedExitStatus::Success,
|
||||
(),
|
||||
))
|
||||
.with_step(
|
||||
new_step_with_default_assertions("Assert OSC 7 updated the previous block's pwd")
|
||||
.add_assertion(|app, window_id| {
|
||||
let terminal_view = single_terminal_view_for_tab(app, window_id, 0);
|
||||
terminal_view.read(app, |view, _ctx| {
|
||||
let model = view.model.lock();
|
||||
let last_finished_pwd = model
|
||||
.block_list()
|
||||
.blocks()
|
||||
.iter()
|
||||
.rev()
|
||||
.find(|block| block.finished() && !block.is_background())
|
||||
.and_then(|block| block.pwd().cloned());
|
||||
async_assert_eq!(
|
||||
Some("/tmp/osc7-test".to_string()),
|
||||
last_finished_pwd,
|
||||
"expected OSC 7 to set the printf block's pwd to /tmp/osc7-test"
|
||||
)
|
||||
})
|
||||
})
|
||||
// Locks in the fix for the user-visible regression Zach saw:
|
||||
// the `WorkingDirectory` prompt chip text (read by
|
||||
// `display_working_directory`, which feeds the vertical-tab
|
||||
// subtitle) must be refreshed after OSC 7. Without
|
||||
// `refresh_warp_prompt` in the `BlockWorkingDirectoryUpdated`
|
||||
// path, the block's `pwd` updates but the chip text stays on
|
||||
// the old CWD until the next `BlockCompleted`.
|
||||
.add_assertion(|app, window_id| {
|
||||
let terminal_view = single_terminal_view_for_tab(app, window_id, 0);
|
||||
terminal_view.read(app, |view, ctx| {
|
||||
let displayed = view.display_working_directory(ctx);
|
||||
async_assert_eq!(
|
||||
Some("/tmp/osc7-test".to_string()),
|
||||
displayed,
|
||||
"expected the WorkingDirectory chip / tab subtitle to reflect the OSC 7 CWD"
|
||||
)
|
||||
})
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
/// Checks that we focus the prompt after executing a command, regardless
|
||||
/// of if the find bar is open or not.
|
||||
pub fn test_input_focused_after_executing_command() -> Builder {
|
||||
@@ -3888,7 +3909,7 @@ pub fn test_command_xray_hover() -> Builder {
|
||||
)
|
||||
.with_step(
|
||||
new_step_with_default_assertions("Hover past buffer text")
|
||||
// Add post step pause so that the the async assert in the next
|
||||
// Add post step pause so that the async assert in the next
|
||||
// step doesn't succeed right away just because we didn't give enough
|
||||
// time for the xray to trigger.
|
||||
.set_post_step_pause(Duration::from_secs(1))
|
||||
@@ -3950,7 +3971,7 @@ pub fn test_command_xray_for_partial_command() -> Builder {
|
||||
)
|
||||
.with_step(
|
||||
new_step_with_default_assertions("Hover over st")
|
||||
// Add post step pause so that the the async assert in the next
|
||||
// Add post step pause so that the async assert in the next
|
||||
// step doesn't succeed right away just because we didn't give enough
|
||||
// time for the xray to trigger.
|
||||
.set_post_step_pause(Duration::from_secs(1))
|
||||
@@ -5827,6 +5848,101 @@ function prompt {{
|
||||
)
|
||||
}
|
||||
|
||||
pub fn test_copy_block_command_and_output_honor_ps1_disabled() -> Builder {
|
||||
let command = "echo WARP_COPY_E2E_OUTPUT";
|
||||
new_builder()
|
||||
.use_tmp_filesystem_for_test_root_directory()
|
||||
.with_step(wait_until_bootstrapped_single_pane_for_tab(0))
|
||||
.with_step(execute_command_for_single_terminal_in_tab(
|
||||
0,
|
||||
command.into(),
|
||||
ExpectedExitStatus::Success,
|
||||
(),
|
||||
))
|
||||
.with_step(
|
||||
new_step_with_default_assertions("Select last block")
|
||||
.with_keystrokes(&["cmdorctrl-up"])
|
||||
.add_assertion(assert_selected_block_index_is_last_renderable()),
|
||||
)
|
||||
.with_steps(open_context_menu_for_selected_block())
|
||||
.with_step(
|
||||
new_step_with_default_assertions("Copy block copies command and output")
|
||||
.with_click_on_saved_position("Copy")
|
||||
.add_assertion(assert_clipboard_contains_string(format!(
|
||||
"{command}\nWARP_COPY_E2E_OUTPUT"
|
||||
))),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn test_copy_block_command_and_output_honor_ps1_enabled() -> Builder {
|
||||
let prompt_text = "this is my custom prompt";
|
||||
let command = "echo WARP_PS1_COPY_E2E_OUTPUT";
|
||||
new_builder()
|
||||
// TODO(CORE-2732): Flakey on linux
|
||||
.set_should_run_test(skip_if_powershell_core_2303)
|
||||
.with_user_defaults(HashMap::from([(
|
||||
HonorPS1::storage_key().to_owned(),
|
||||
true.to_string(),
|
||||
)]))
|
||||
.with_setup(move |utils| {
|
||||
let dir = utils.test_dir();
|
||||
write_rc_files_for_test(
|
||||
&dir,
|
||||
format!(r#"export PS1="{prompt_text}""#),
|
||||
[ShellRcType::Bash, ShellRcType::Zsh],
|
||||
);
|
||||
write_rc_files_for_test(
|
||||
&dir,
|
||||
format!(
|
||||
r#"
|
||||
function fish_prompt
|
||||
echo -n "{prompt_text}"
|
||||
end
|
||||
"#
|
||||
),
|
||||
[ShellRcType::Fish],
|
||||
);
|
||||
write_rc_files_for_test(
|
||||
&dir,
|
||||
format!(
|
||||
r#"
|
||||
function prompt {{
|
||||
"{prompt_text}"
|
||||
}}
|
||||
"#
|
||||
),
|
||||
[ShellRcType::PowerShell],
|
||||
)
|
||||
})
|
||||
.with_step(
|
||||
wait_until_bootstrapped_single_pane_for_tab(0).add_assertion(move |app, window_id| {
|
||||
let input = single_input_view_for_tab(app, window_id, 0);
|
||||
let input_text = input.read(app, |input, ctx| input.prompt_and_rprompt_text(ctx).0);
|
||||
|
||||
async_assert_eq!(input_text, prompt_text)
|
||||
}),
|
||||
)
|
||||
.with_step(execute_command_for_single_terminal_in_tab(
|
||||
0,
|
||||
command.into(),
|
||||
ExpectedExitStatus::Success,
|
||||
(),
|
||||
))
|
||||
.with_step(
|
||||
new_step_with_default_assertions("Select last block")
|
||||
.with_keystrokes(&["cmdorctrl-up"])
|
||||
.add_assertion(assert_selected_block_index_is_last_renderable()),
|
||||
)
|
||||
.with_steps(open_context_menu_for_selected_block())
|
||||
.with_step(
|
||||
new_step_with_default_assertions("Copy block includes PS1 prompt, command, and output")
|
||||
.with_click_on_saved_position("Copy")
|
||||
.add_assertion(assert_clipboard_contains_string(format!(
|
||||
"{prompt_text}{command}\nWARP_PS1_COPY_E2E_OUTPUT"
|
||||
))),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn test_copy_prompt_from_input_honor_ps1_disabled() -> Builder {
|
||||
new_builder()
|
||||
.use_tmp_filesystem_for_test_root_directory()
|
||||
@@ -5848,6 +5964,28 @@ pub fn test_copy_prompt_from_input_honor_ps1_disabled() -> Builder {
|
||||
.add_assertion(assert_clipboard_contains_string("~".into())),
|
||||
)
|
||||
}
|
||||
pub fn test_warp_prompt_unsets_zsh_rprompt() -> Builder {
|
||||
new_builder()
|
||||
.set_should_run_test(|| {
|
||||
let (starter, _) = current_shell_starter_and_version();
|
||||
starter.shell_type() == shell::ShellType::Zsh
|
||||
})
|
||||
.with_user_defaults(HashMap::from([(
|
||||
HonorPS1::storage_key().to_owned(),
|
||||
false.to_string(),
|
||||
)]))
|
||||
.with_setup(|utils| {
|
||||
let dir = utils.test_dir();
|
||||
write_rc_files_for_test(&dir, r#"export RPROMPT="right prompt""#, [ShellRcType::Zsh]);
|
||||
})
|
||||
.with_step(wait_until_bootstrapped_single_pane_for_tab(0))
|
||||
.with_step(execute_command_for_single_terminal_in_tab(
|
||||
0,
|
||||
"print -r -- ${+RPROMPT}".into(),
|
||||
ExpectedExitStatus::Success,
|
||||
ExactLine::from("0"),
|
||||
))
|
||||
}
|
||||
|
||||
pub fn test_copy_prompt_from_input_honor_ps1_enabled() -> Builder {
|
||||
let prompt_text = "this is my custom prompt";
|
||||
|
||||
Reference in New Issue
Block a user