id stringlengths 20 30 | source stringclasses 1
value | chunk_index int64 0 520k | token_count int32 154 512 | content stringlengths 185 57.5k |
|---|---|---|---|---|
rust_dataset_chunk_514400 | rust_dataset.txt | 514,400 | 512 | (run_command.into()),
_ => None,
};
let action = Action::NewTiledPane {
direction: None,
command: run_command_action,
pane_name: None,
near_current_pane: false,
no_focus: false,
borderless: None,
border_style: None,
tab_id: Some(tab_positio... |
rust_dataset_chunk_514401 | rust_dataset.txt | 514,401 | 512 | PluginEnv) {
let action = Action::FocusLastPane;
let error_msg = || format!("Failed to focus last pane");
apply_action!(action, error_msg, env);
}
fn move_focus(env: &PluginEnv, direction: Direction) {
let error_msg = || format!("failed to move focus in plugin {}", env.name());
let action = Action:... |
rust_dataset_chunk_514402 | rust_dataset.txt | 514,402 | 512 | ToSession {
name: session_name,
tab_position,
pane_id,
layout,
cwd,
switch_context: switch_context.and_then(|c| {
zellij_utils::session_history::SwitchContext::from_plugin_request(
c.startup_card,
... |
rust_dataset_chunk_514403 | rust_dataset.txt | 514,403 | 512 | _DIR,
&ZELLIJ_SESSION_INFO_CACHE_DIR,
index.as_ref(),
)
.map(|_| ())
.map_err(|e| anyhow!(e))
}
fn edit_scrollback(env: &PluginEnv) {
let action = Action::EditScrollback { ansi: false };
let error_msg = || format!("Failed to edit scrollback");
apply_action!(action, error_msg, en... |
rust_dataset_chunk_514404 | rust_dataset.txt | 514,404 | 512 | = || format!("failed to scroll up in plugin {}", env.name());
let action = Action::ScrollUp;
apply_action!(action, error_msg, env);
}
fn scroll_down(env: &PluginEnv) {
let error_msg = || format!("failed to scroll down in plugin {}", env.name());
let action = Action::ScrollDown;
apply_action!(actio... |
rust_dataset_chunk_514405 | rust_dataset.txt | 514,405 | 512 | channel::bounded(1);
env.senders
.send_to_screen(ScreenInstruction::GetNestedSessionKeybinds {
pane_id,
response_channel: response_sender,
})
.with_context(|| {
format!(
"failed to request nested session keybindings from plugin {}",
... |
rust_dataset_chunk_514406 | rust_dataset.txt | 514,406 | 512 | , error_msg, env);
}
fn toggle_floating_panes(env: &PluginEnv, tab_id: Option<u64>) {
let error_msg = || format!("failed to toggle floating panes in plugin {}", env.name());
let action = match tab_id {
Some(id) => Action::ToggleFloatingPanesByTabId { id },
None => Action::ToggleFloatingPanes,
... |
rust_dataset_chunk_514407 | rust_dataset.txt | 514,407 | 512 | to switch swap layout in plugin {}", env.name());
let action = Action::PreviousSwapLayout;
apply_action!(action, error_msg, env);
}
fn next_swap_layout(env: &PluginEnv) {
let error_msg = || format!("failed to switch swap layout in plugin {}", env.name());
let action = Action::NextSwapLayout;
apply... |
rust_dataset_chunk_514408 | rust_dataset.txt | 514,408 | 512 | _action!(action, error_msg, env);
}
fn start_or_reload_plugin(env: &PluginEnv, url: &str) -> Result<()> {
let error_msg = || format!("failed to start or reload plugin in plugin {}", env.name());
let cwd = std::env::current_dir().unwrap_or_else(|_| PathBuf::from("."));
let run_plugin_or_alias = RunPluginOrA... |
rust_dataset_chunk_514409 | rust_dataset.txt | 514,409 | 512 | ::FocusPluginPaneWithId {
pane_id: plugin_pane_id,
should_float_if_hidden,
should_be_in_place_if_hidden,
};
let error_msg = || format!("Failed to focus plugin pane");
apply_action!(action, error_msg, env);
}
fn rename_terminal_pane(env: &PluginEnv, terminal_pane_id: u32, new_name: &... |
rust_dataset_chunk_514410 | rust_dataset.txt | 514,410 | 512 | _utils::sessions::send_kill_session(&resolved) {
log::error!("Failed to kill session {}: {:?}", session_name, e);
}
}
}
// Wedge timeout: only guards against a peer that neither shuts down nor
// crashes. Normal kill latency is tens of milliseconds (peer's route loop
// reads the message, serve... |
rust_dataset_chunk_514411 | rust_dataset.txt | 514,411 | 512 | ::Ok,
Err(e) => KillSessionsResponse::Err(e),
};
let protobuf_response = ProtobufKillSessionsResponse::from(response);
wasi_write_object(env, &protobuf_response.encode_to_vec())
.with_context(|| "failed to write kill_sessions response".to_string())
.non_fatal();
}
fn delete_dead_ses... |
rust_dataset_chunk_514412 | rust_dataset.txt | 514,412 | 512 | Response::Err(e),
};
let protobuf_response = ProtobufDeleteAllDeadSessionsResponse::from(response);
wasi_write_object(env, &protobuf_response.encode_to_vec())
.with_context(|| "failed to write delete_all_dead_sessions response".to_string())
.non_fatal();
}
fn watch_filesystem(env: &PluginEn... |
rust_dataset_chunk_514413 | rust_dataset.txt | 514,413 | 512 | = match response.layout_result {
Ok(layout_content) => ProtobufDumpSessionLayoutResponse {
result: Some(dump_session_layout_response::Result::LayoutContent(
layout_content,
)),
metadata: protobuf_metadata,
},
Err(error) => ProtobufDumpSessionL... |
rust_dataset_chunk_514414 | rust_dataset.txt | 514,414 | 512 | ::Success(true)),
},
Some(2) => ProtobufShowFloatingPanesResponse {
result: Some(ShowResult::Success(false)),
},
_ => ProtobufShowFloatingPanesResponse {
result: Some(ShowResult::Error("Tab not found".to_string())),
},
}... |
rust_dataset_chunk_514415 | rust_dataset.txt | 514,415 | 512 | let pane_id: PaneId = pane_id.into();
env.senders
.send_to_screen(ScreenInstruction::ClearPluginHighlights {
pane_id,
plugin_id: env.plugin_id,
})
.with_context(err_context)
.non_fatal();
}
fn current_session_last_saved_time(env: &PluginEnv) {
use zellij... |
rust_dataset_chunk_514416 | rust_dataset.txt | 514,416 | 512 | 100)) {
Ok(Some(pane_info)) => {
let mut redacted =
zellij_utils::data::Event::PaneUpdate(zellij_utils::data::PaneManifest {
panes: [(0, vec![pane_info])].into_iter().collect(),
});
crate::plugins::wasm_bridge::redact_event_for_plugin(e... |
rust_dataset_chunk_514417 | rust_dataset.txt | 514,417 | 512 |
let tab_info = match response_receiver.recv_timeout(Duration::from_millis(100)) {
Ok(Some(tab_info)) => {
// Convert TabInfo to ProtobufTabInfo
match tab_info.try_into() {
Ok(protobuf_tab_info) => Some(protobuf_tab_info),
Err(e) => {
... |
rust_dataset_chunk_514418 | rust_dataset.txt | 514,418 | 512 | _ = env
.senders
.send_to_screen(ScreenInstruction::ChangeFloatingPanesCoordinates(
pane_ids_and_coordinates,
false,
None,
));
}
fn toggle_pane_borderless(env: &PluginEnv, pane_id: PaneId) {
let _ = env
.senders
.send_to_screen(ScreenInst... |
rust_dataset_chunk_514419 | rust_dataset.txt | 514,419 | 512 | );
let client_id = acting_client(env);
thread::spawn({
move || {
let mut paths_in_folder = vec![];
for entry in reading_folder {
if let Ok(entry) = entry {
... |
rust_dataset_chunk_514420 | rust_dataset.txt | 514,420 | 512 | non_fatal();
});
}
#[cfg(windows)]
fn enumerate_drives() -> Vec<(PathBuf, Option<zellij_utils::data::FileMetadata>)> {
use windows_sys::Win32::Storage::FileSystem::GetLogicalDriveStringsW;
let mut buf = [0u16; 256];
let len = unsafe { GetLogicalDriveStringsW(buf.len() as u32, buf.as_mut_ptr()) };
i... |
rust_dataset_chunk_514421 | rust_dataset.txt | 514,421 | 512 | metadata(&unc).ok().map(|m| m.into());
let wsl_path = PathBuf::from(format!("//wsl.localhost/{}/", name));
entries.push((wsl_path, metadata));
}
entries
}
fn resize_pane_with_id(env: &PluginEnv, resize: ResizeStrategy, pane_id: PaneId) {
let _ = env
.senders
.send_to_screen(... |
rust_dataset_chunk_514422 | rust_dataset.txt | 514,422 | 512 | pane {:?}",
pane_id
))
},
};
// Convert to protobuf and write back to plugin
ProtobufPaneScrollbackResponse::try_from(response)
.map_err(|e| anyhow!("Failed to serialize pane scrollback response: {}", e))
.and_then(|serialized| {
wasi_write_o... |
rust_dataset_chunk_514423 | rust_dataset.txt | 514,423 | 512 | tyInstruction::SendSigkillToPaneId(pane_id))
.with_context(err_context)
.non_fatal();
}
fn get_pane_pid(env: &PluginEnv, pane_id: PaneId) {
use crossbeam::channel::RecvTimeoutError;
use std::time::Duration;
let err_context = || {
format!(
"failed to get PID for pane {:?... |
rust_dataset_chunk_514424 | rust_dataset.txt | 514,424 | 512 | use crate::background_jobs::{scan_session_list_default_dirs, session_scan_state};
use zellij_utils::data::{GetSessionListResponse, SessionListSnapshot};
let response = match session_scan_state() {
Some(state) => {
let (session_name, available_layouts, plugin_list) = {
le... |
rust_dataset_chunk_514425 | rust_dataset.txt | 514,425 | 512 | ::Timeout) => {
log::error!(
"GetPaneRunningCommand timed out for plugin {} requesting pane {:?}",
env.plugin_id,
pane_id
);
GetPaneRunningCommandResponse::Err(format!(
"Timeout retrieving running command for pane {:?}",... |
rust_dataset_chunk_514426 | rust_dataset.txt | 514,426 | 512 | "GetPaneCwd timed out for plugin {} requesting pane {:?}",
env.plugin_id,
pane_id
);
GetPaneCwdResponse::Err(format!("Timeout retrieving CWD for pane {:?}", pane_id))
},
Err(RecvTimeoutError::Disconnected) => {
log::erro... |
rust_dataset_chunk_514427 | rust_dataset.txt | 514,427 | 512 | .layout_dir
.clone()
.or_else(default_layout_dir)
.ok_or_else(|| "Layout directory not found".to_string())?;
// Step 4: Create file path
let file_path = layout_dir.join(format!("{}.kdl", safe_name));
// Step 5: Check if file exists when overwrite=false
if file_path.exis... |
rust_dataset_chunk_514428 | rust_dataset.txt | 514,428 | 512 | (env, &serialized)
.with_context(err_context)
.non_fatal();
}
fn try_delete_layout(env: &PluginEnv, layout_name: &str) -> Result<(), String> {
// Sanitize the layout name to prevent directory traversal
let safe_name =
sanitize_layout_name(layout_name).map_err(|e| format!("Invalid layout... |
rust_dataset_chunk_514429 | rust_dataset.txt | 514,429 | 512 | rename '{}' to existing layout name.",
safe_new_name, safe_old_name
));
}
// Step 6: Rename the file
std::fs::rename(&old_file_path, &new_file_path)
.map_err(|e| format!("Failed to rename layout file: {}", e))?;
Ok(())
}
fn edit_layout(env: &PluginEnv, layout_name: String... |
rust_dataset_chunk_514430 | rust_dataset.txt | 514,430 | 512 | near_current_pane: true,
no_focus: false,
tab_id: None,
};
// Route the action - this is fallible
route_action(
action,
acting_client(env),
None,
source_pane(env),
env.senders.clone(),
env.default_shell.clone(),
None,
env.defau... |
rust_dataset_chunk_514431 | rust_dataset.txt | 514,431 | 512 | PluginEnv, pane_id: PaneId) {
let _ = env
.senders
.send_to_screen(ScreenInstruction::ClearScreenForPaneId(pane_id));
}
fn scroll_up_in_pane_id(env: &PluginEnv, pane_id: PaneId) {
let _ = env
.senders
.send_to_screen(ScreenInstruction::ScrollUpInPaneId(pane_id));
}
fn scroll_do... |
rust_dataset_chunk_514432 | rust_dataset.txt | 514,432 | 512 | ers
.send_to_screen(ScreenInstruction::CloseTabWithIndex(tab_index));
}
fn break_panes_to_new_tab(
env: &PluginEnv,
pane_ids: Vec<PaneId>,
new_tab_name: Option<String>,
should_change_focus_to_new_tab: bool,
) {
let default_shell = env.default_shell.clone().or_else(|| {
Some(Terminal... |
rust_dataset_chunk_514433 | rust_dataset.txt | 514,433 | 512 | wasi_write_object(env, &response.encode_to_vec()).non_fatal();
}
fn switch_tab_to_id(env: &PluginEnv, tab_id: u64) {
let tab_id = tab_id as usize;
env.senders
.send_to_screen(ScreenInstruction::GoToTabWithId(
tab_id,
Some(acting_client(env)),
None,
))
... |
rust_dataset_chunk_514434 | rust_dataset.txt | 514,434 | 512 | });
let result_tab_id: BreakPanesToTabWithIdResponse = if result.is_ok() {
wait_for_action_completion(rx, "break_panes_to_tab_with_id", false).affected_tab_id
} else {
None
};
let response = ProtobufBreakPanesToTabWithIdResponse::from(result_tab_id);
wasi_write_object(env, ... |
rust_dataset_chunk_514435 | rust_dataset.txt | 514,435 | 512 | ,
));
},
Err(e) => {
log::error!("Failed to load new plugin: {:?}", e);
},
}
}
}
fn start_web_server(env: &PluginEnv) {
let _ = env
.senders
.send_to_server(ServerInstruction::StartWebServer(acting_client(env)));
}
fn ... |
rust_dataset_chunk_514436 | rust_dataset.txt | 514,436 | 512 | Id::Plugin(plugin_pane_id) => {
close_plugin_pane(env, plugin_pane_id);
},
}
}
}
fn float_multiple_panes(env: &PluginEnv, pane_ids: Vec<PaneId>) {
let _ = env
.senders
.send_to_screen(ScreenInstruction::FloatMultiplePanes(
pane_ids,
ac... |
rust_dataset_chunk_514437 | rust_dataset.txt | 514,437 | 512 | : &PluginEnv, _token_label: String) {
log::error!("This version of Zellij was compiled without the web server capabilities!");
let empty_vec: Vec<&str> = vec![];
let _ = wasi_write_object(env, &empty_vec);
}
#[cfg(feature = "web_server_capability")]
fn revoke_all_web_login_tokens(env: &PluginEnv) {
let... |
rust_dataset_chunk_514438 | rust_dataset.txt | 514,438 | 512 | _list.iter().map(|t| t.read_only).collect(),
error: None,
},
Err(e) => ListTokensResponse {
tokens: vec![],
creation_times: vec![],
read_only_flags: vec![],
error: Some(e.to_string()),
},
};
let _ = wasi_write_object(env, &seria... |
rust_dataset_chunk_514439 | rust_dataset.txt | 514,439 | 512 | env
.senders
.send_to_screen(ScreenInstruction::ReplacePaneWithExistingPane(
pane_to_replace,
existing_pane,
suppress_replaced_pane,
Some(NotificationEnd::new(completion_tx)),
));
let _ = wait_for_action_completion(completion_rx, "replace_pane... |
rust_dataset_chunk_514440 | rust_dataset.txt | 514,440 | 512 | &PluginEnv, msg: &str) {
log::error!("PANIC IN PLUGIN!\n\r{}", msg);
if env.shared.is_some() {
let _ = env
.senders
.send_to_plugin(PluginInstruction::UnregisterSettingsEntry(env.plugin_id));
}
for pane_id in crash_pane_ids(env) {
handle_plugin_crash(pane_id, msg... |
rust_dataset_chunk_514441 | rust_dataset.txt | 514,441 | 512 | {
// built-in plugins can do all the things because they're part of the application and
// there's no use to deny them anything
return (PermissionStatus::Granted, None);
}
let permission = match required_permission(command) {
Some(permission) => permission,
None => retur... |
rust_dataset_chunk_514442 | rust_dataset.txt | 514,442 | 512 | Command::OpenCommandPaneNearPlugin(..)
| PluginCommand::OpenCommandPaneFloating(..)
| PluginCommand::OpenCommandPaneFloatingNearPlugin(..)
| PluginCommand::OpenCommandPaneInPlace(..)
| PluginCommand::OpenCommandPaneInPlaceOfPlugin(..)
| PluginCommand::OpenCommandPaneBackground(..... |
rust_dataset_chunk_514443 | rust_dataset.txt | 514,443 | 512 | Command::EditScrollbackForPaneWithId(..)
| PluginCommand::ToggleTab
| PluginCommand::MovePane
| PluginCommand::MovePaneWithDirection(..)
| PluginCommand::MovePaneWithPaneId(..)
| PluginCommand::MovePaneWithPaneIdInDirection(..)
| PluginCommand::ClearScreen
| Plugi... |
rust_dataset_chunk_514444 | rust_dataset.txt | 514,444 | 512 | )
| PluginCommand::RenameTerminalPane(..)
| PluginCommand::RenamePluginPane(..)
| PluginCommand::SwitchSession(..)
| PluginCommand::DeleteDeadSession(..)
| PluginCommand::DeleteAllDeadSessions
| PluginCommand::RenameSession(..)
| PluginCommand::RenameTab(..)
... |
rust_dataset_chunk_514445 | rust_dataset.txt | 514,445 | 512 | ShowFloatingPanes { .. }
| PluginCommand::HideFloatingPanes { .. }
| PluginCommand::SetPaneRegexHighlights(..)
| PluginCommand::ClearPaneHighlights(..)
| PluginCommand::SetSoftKeyboard(..)
| PluginCommand::OpenContextMenu { .. }
| PluginCommand::OpenPluginPopup { .. }
... |
rust_dataset_chunk_514446 | rust_dataset.txt | 514,446 | 512 | SaveKeybindsAsPreset { .. }
| PluginCommand::WriteThemeFile { .. }
| PluginCommand::DeleteThemeFile { .. }
| PluginCommand::SaveConfig
| PluginCommand::OverwriteConfigFile
| PluginCommand::ReloadConfigFile
| PluginCommand::ReplaceConfigBlocks(..)
| PluginCommand::... |
rust_dataset_chunk_514447 | rust_dataset.txt | 514,447 | 512 | caller: instruction_caller,
owner_client_id,
caller_pane_id,
request: instruction_request,
} => {
assert_eq!(instruction_caller, caller());
assert_eq!(owner_client_id, 5);
assert_eq!(caller_pane_id, Some(PaneId:... |
rust_dataset_chunk_514448 | rust_dataset.txt | 514,448 | 512 | )));
assert!(!may_reply_to_prompt(&RunPluginLocation::Zellij(
PluginTag::new("configuration")
)));
assert!(!may_reply_to_prompt(&RunPluginLocation::File(
PathBuf::from("/tmp/prompt.wasm")
)));
}
}
fn set_live_view(env: &PluginEnv, view: Option<zellij_... |
rust_dataset_chunk_514449 | rust_dataset.txt | 514,449 | 512 | TiledLayout,
TabLayoutInfo, TiledPaneLayout,
},
},
pane_size::Size,
session_events::CliEvent,
session_serialization,
};
pub type VteBytes = Vec<u8>;
pub type TabIndex = u32;
const ORIGIN_PANE_ID_ENV_VAR: &str = "ZELLIJ_ORIGIN_PANE_ID";
const PANE_ID_ENV_VAR: &str = "ZELLIJ_PANE_ID"... |
rust_dataset_chunk_514450 | rust_dataset.txt | 514,450 | 512 | signal
), // the String is the tab name
OverrideLayout(
Option<PathBuf>, // CWD
Option<TerminalAction>, // Default Shell
Vec<(TabLayoutInfo, HashMap<RunPluginOrAlias, Vec<u32>>)>, // (layout, plugin_ids) per ta... |
rust_dataset_chunk_514451 | rust_dataset.txt | 514,451 | 512 | Option<NotificationEnd>),
Reconfigure {
client_id: ClientId,
default_editor: Option<PathBuf>,
post_command_discovery_hook: Option<String>,
pane_env: PaneEnv,
},
ListClientsToPlugin(SessionLayoutMetadata, PluginId, ClientId),
ReportPluginCwd(PluginId, PathBuf),
SendSi... |
rust_dataset_chunk_514452 | rust_dataset.txt | 514,452 | 512 | InPane,
PtyInstruction::SpawnInPlaceTerminal(..) => PtyContext::SpawnInPlaceTerminal,
PtyInstruction::DumpLayout(..) => PtyContext::DumpLayout,
PtyInstruction::DumpLayoutToPlugin { .. } => PtyContext::DumpLayoutToPlugin,
PtyInstruction::LogLayoutToHd(..) => PtyContext::Lo... |
rust_dataset_chunk_514453 | rust_dataset.txt | 514,453 | 512 | Buf>,
post_command_discovery_hook: Option<String>,
pane_env: PaneEnv,
plugin_cwds: HashMap<u32, PathBuf>, // plugin_id -> cwd
terminal_cwds: HashMap<u32, PathBuf>, // terminal_id -> cwd
pane_activity_flags: HashMap<u32, std::sync::Arc<std::sync::atomic::AtomicBool>>,
terminal_cmds: HashMap<u32... |
rust_dataset_chunk_514454 | rust_dataset.txt | 514,454 | 512 | File(payload)) => Some(Run::EditFile(
payload.path.clone(),
payload.line_number.clone(),
payload.cwd.clone(),
)),
_ => None,
};
match pty
.spawn_terminal(te... |
rust_dataset_chunk_514455 | rust_dataset.txt | 514,455 | 512 | ),
pane_title,
hold_for_command,
invoked_with,
new_pane_placement,
start_suppressed,
... |
rust_dataset_chunk_514456 | rust_dataset.txt | 514,456 | 512 | pane_title,
invoked_with,
close_replaced_pane,
client_id_tab_index_or_pane_id,
completion_tx,
))
.with_c... |
rust_dataset_chunk_514457 | rust_dataset.txt | 514,457 | 512 | Tab(tab_index, client_id) => {
pty.bus
.senders
.send_to_screen(ScreenInstruction::GoToTab(tab_index, Some(client_id), None))
.with_context(|| {
format!("failed to move client {} to tab {}", client_id, tab_index)
... |
rust_dataset_chunk_514458 | rust_dataset.txt | 514,458 | 512 | to spawn terminals for tab {}: {:?}",
tab_layout_info.tab_index,
e
);
// Continue with other tabs (best-effort approach)
},
}
}
... |
rust_dataset_chunk_514459 | rust_dataset.txt | 514,459 | 512 | to_vec(),
))
.with_context(err_context)?;
pty.bus
.senders
.send_to_screen(ScreenInstruction::HoldPane(
... |
rust_dataset_chunk_514460 | rust_dataset.txt | 514,460 | 512 | session_layout_metadata.into(),
) {
Ok((kdl_layout, _pane_contents)) => {
pty.bus
.senders
.send_to_server(ServerInstruction::Log(
vec![kdl_layout],
... |
rust_dataset_chunk_514461 | rust_dataset.txt | 514,461 | 512 | || format!("Failed to dump layout");
pty.populate_session_layout_metadata(&mut session_layout_metadata);
if session_layout_metadata.is_dirty() {
match session_serialization::serialize_session_layout(
session_layout_metadata.into(),
... |
rust_dataset_chunk_514462 | rust_dataset.txt | 514,462 | 512 | should_be_open_in_place,
close_replaced_pane,
pane_title,
run,
tab_index,
pane_id_to_replace,
client_id,
size,
skip_cache,
... |
rust_dataset_chunk_514463 | rust_dataset.txt | 514,463 | 512 | _id) => {
pty.terminals_with_prompt_markers.insert(terminal_id);
if pty.session_context_pane == Some(PaneId::Terminal(terminal_id)) {
pty.report_session_context(ContextTrigger::PromptReturned);
}
},
PtyInstruction::Exit => break... |
rust_dataset_chunk_514464 | rust_dataset.txt | 514,464 | 512 | hold_on_start: false,
..Default::default()
})
},
}
}
fn cwd_of_pane(&self, pane_id: &PaneId) -> Option<PathBuf> {
match pane_id {
PaneId::Terminal(terminal_id) => self
.id_to_child_pid
.get(terminal_id)
... |
rust_dataset_chunk_514465 | rust_dataset.txt | 514,465 | 512 | *cwd = self
.active_panes
.get(&client_id)
.and_then(|pane| match pane {
PaneId::Plugin(plugin_id) => self.plugin_cwds.get(plugin_id).cloned(),
PaneId::Terminal(id) => {
// Try to get CWD from OS,... |
rust_dataset_chunk_514466 | rust_dataset.txt | 514,466 | 512 | None));
self.fill_cwd(&mut terminal_action, client_id);
terminal_action
},
ClientTabIndexOrPaneId::TabIndex(_) | ClientTabIndexOrPaneId::TabIndexNoFocus(_) => {
terminal_action.unwrap_or_else(|| self.get_default_terminal(None, None))
}... |
rust_dataset_chunk_514467 | rust_dataset.txt | 514,467 | 512 | );
let _ = senders.send_to_plugin(PluginInstruction::Update(vec![(
Some(originating_command_plugin.plugin_id),
Some(originating_command_plugin.client_id),
update_event,
... |
rust_dataset_chunk_514468 | rust_dataset.txt | 514,468 | 512 | async task for terminal {terminal_id}");
let senders = self.bus.senders.clone();
let debug_to_file = self.debug_to_file;
let activity_flag = activity_flag.clone();
async move {
TerminalBytes::new(terminal_id, reader, senders, debug_to_file, activity_flag)... |
rust_dataset_chunk_514469 | rust_dataset.txt | 514,469 | 512 | ane {
if !layout.replace_next_empty_slot_with_run(Run::EditFile(
file_to_open.path.clone(),
file_to_open.line_number,
file_to_open.cwd.clone(),
)) {
log::warn!("More initial_panes prov... |
rust_dataset_chunk_514470 | rust_dataset.txt | 514,470 | 512 | (new_pane_data.0);
new_floating_panes_pids.push(new_pane_data);
}
if let (Some(originating_plugin), Some(terminal_id)) = (originating_plugin, terminal_id)
{
originating_plugins_to_inform.push((terminal_id, originating_plugin));
}
}
... |
rust_dataset_chunk_514471 | rust_dataset.txt | 514,471 | 512 | )?;
let mut terminals_to_start = vec![];
terminals_to_start.append(&mut new_pane_pids);
terminals_to_start.append(&mut new_floating_panes_pids);
for (terminal_id, starts_held, run_command, reader_result) in terminals_to_start {
if starts_held {
// we do not r... |
rust_dataset_chunk_514472 | rust_dataset.txt | 514,472 | 512 | swap_floating_layouts: Option<Vec<SwapFloatingLayout>>,
_retain_existing_terminal_panes: bool,
_retain_existing_plugin_panes: bool,
) -> Result<TabOverrideResult> {
let err_context = || format!("failed to spawn terminals for layout for");
let mut default_shell =
... |
rust_dataset_chunk_514473 | rust_dataset.txt | 514,473 | 512 | _shell.clone())?
{
terminal_id = Some(new_pane_data.0);
new_floating_panes_pids.push(new_pane_data);
}
if let (Some(originating_plugin), Some(terminal_id)) = (originating_plugin, terminal_id)
{
originating_plugins_to_inform.... |
rust_dataset_chunk_514474 | rust_dataset.txt | 514,474 | 512 | async move {
TerminalBytes::new(
terminal_id,
reader,
senders,
debug_to_file,
activity_flag,
)
... |
rust_dataset_chunk_514475 | rust_dataset.txt | 514,475 | 512 | ));
}
});
let originating_plugin = run_instruction.as_ref().and_then(|r| {
if let Run::Command(run_command) = r {
run_command.originating_plugin.clone()
} else {
None
}
});
match run_instruction {
... |
rust_dataset_chunk_514476 | rust_dataset.txt | 514,476 | 512 | .context("no OS I/O interface found")
.with_context(err_context)?
.spawn_terminal(
cmd,
quit_cb,
self.default_editor.clone(),
&pane_env_with_origin(&self.pane_... |
rust_dataset_chunk_514477 | rust_dataset.txt | 514,477 | 512 | .bus
.os_input
.as_mut()
.context("no OS I/O interface found")
.with_context(err_context)?
.spawn_terminal(
TerminalAction::OpenFile(OpenFilePayload::new(
path_to_file... |
rust_dataset_chunk_514478 | rust_dataset.txt | 514,478 | 512 | close for pane {id:?}");
match id {
PaneId::Terminal(id) => {
if let Some(handle) = self.task_handles.remove(&id) {
handle.abort();
}
if let Some(child_pid) = self.id_to_child_pid.remove(&id) {
let err_context =... |
rust_dataset_chunk_514479 | rust_dataset.txt | 514,479 | 512 | };
let folder = self.terminal_cwds.get(&terminal_id).cloned().or_else(|| {
self.id_to_child_pid.get(&terminal_id).and_then(|pid| {
self.bus
.os_input
.as_ref()
.and_then(|os_input| os_input.get_cwd(*pid))
})
... |
rust_dataset_chunk_514480 | rust_dataset.txt | 514,480 | 512 | }
}
});
let pane_env =
pane_env_with_origin(&self.pane_env, self.origin_pane_ids.get(&id).copied());
let (reader, child_pid): (Box<dyn AsyncReader>, Option<u32>) = self
.bus
.os_input
... |
rust_dataset_chunk_514481 | rust_dataset.txt | 514,481 | 512 | terminal_id) {
return Err(format!("Terminal pane terminal_{} not found", terminal_id));
}
match resurrect {
Some(resurrect) => {
self.resurrect_commands.insert(terminal_id, resurrect);
},
None => {
self.resurrect_commands.re... |
rust_dataset_chunk_514482 | rust_dataset.txt | 514,482 | 512 | .resurrect_commands.get(&terminal_id) {
let mut command_line = vec![resurrect.command.to_string_lossy().into_owned()];
command_line.extend(resurrect.args.iter().cloned());
terminal_ids_to_commands.insert(terminal_id, command_line);
if let Some(cwd) = &resu... |
rust_dataset_chunk_514483 | rust_dataset.txt | 514,483 | 512 | and_then(|pane| match pane {
PaneId::Plugin(plugin_id) => Some(*plugin_id),
_ => None,
});
if let RunPluginOrAlias::Alias(alias) = &mut run {
let cwd = get_focused_cwd();
alias.set_caller_cwd_if_not_set(cwd);
}
self.bus.senders... |
rust_dataset_chunk_514484 | rust_dataset.txt | 514,484 | 512 | if let Some(cwd) = cwd {
if self.terminal_cwds.get(terminal_id) != Some(cwd) {
let pane_id = PaneId::Terminal(*terminal_id);
let focused_client_ids: Vec<ClientId> = self
.active_panes
.iter()
... |
rust_dataset_chunk_514485 | rust_dataset.txt | 514,485 | 512 | if foreground_cmd.is_empty()
&& self.session_context_pane == Some(pane_id)
&& !self.terminals_with_prompt_markers.contains(terminal_id)
{
self.report_session_context(ContextTrigger::PromptReturned);
}
let (comma... |
rust_dataset_chunk_514486 | rust_dataset.txt | 514,486 | 512 | }
}
fn notify_event_subscribers_of_cwd(&self, pane_id: PaneId, cwd: &Path) {
let _ = self
.bus
.senders
.send_to_screen(ScreenInstruction::NotifyEventSubscribers(
CliEvent::PaneCwdChanged {
pane_id: pane_id.into(),
... |
rust_dataset_chunk_514487 | rust_dataset.txt | 514,487 | 512 | log::warn!("Terminal pane {} not found or not running", terminal_id);
}
},
PaneId::Plugin(plugin_id) => {
log::warn!("Cannot send SIGINT to plugin pane {}", plugin_id);
},
}
}
pub fn send_sigkill_to_pane(&self, pane_id: PaneId) {
... |
rust_dataset_chunk_514488 | rust_dataset.txt | 514,488 | 512 | );
let cmd_foreground = foreground_cmds.get(&terminal_id);
// If no foreground command, fall back to the shell itself
let (_cwds, cmds) = os_input.get_cwds(vec![child_pid]);
let cmd_sysinfo = cmds.ge... |
rust_dataset_chunk_514489 | rust_dataset.txt | 514,489 | 512 | fn drop(&mut self) {
let child_ids: Vec<u32> = self.id_to_child_pid.keys().copied().collect();
for id in child_ids {
self.close_pane(PaneId::Terminal(id))
.with_context(|| format!("failed to close pane for pid {id}"))
.fatal();
}
}
}
fn send_comm... |
rust_dataset_chunk_514490 | rust_dataset.txt | 514,490 | 512 | lude::*, ContextType, PtyWriteContext};
use crate::route::NotificationEnd;
use crate::thread_bus::Bus;
// we separate these instruction to a different thread because some programs get deadlocked if
// you write into their STDIN while reading from their STDOUT (I'm looking at you, vim)
// while the same has not been o... |
rust_dataset_chunk_514491 | rust_dataset.txt | 514,491 | 512 | can keep
// draining. Otherwise, block until a new instruction arrives.
let has_pending = pending.values().any(|q| !q.is_empty());
let event = if has_pending {
match bus.recv_timeout(PENDING_DRAIN_TIMEOUT) {
Ok(pair) => Some(pair),
Err(channels::RecvT... |
rust_dataset_chunk_514492 | rust_dataset.txt | 514,492 | 512 | // then causes glitches and missing redraws
// so we do this to play nice and always only send the last resize instruction to
// each pane
// the logic for this happens in the main Screen event loop
os_input.cache_resize... |
rust_dataset_chunk_514493 | rust_dataset.txt | 514,493 | 512 | Popup(PopupScroll),
ClosePopup,
Underneath,
Ignore,
}
#[derive(Debug, Clone, PartialEq)]
pub(crate) enum PopupKeyAction {
Route(Action),
KeyToPopup {
key: KeyWithModifier,
raw_bytes: Vec<u8>,
is_kitty_keyboard_protocol: bool,
},
ScrollPopup(PopupScroll),
ClosePop... |
rust_dataset_chunk_514494 | rust_dataset.txt | 514,494 | 512 | }
| Action::ToggleFocusFullscreen
| Action::ToggleFocusNoUiFullscreen
| Action::TogglePaneEmbedOrFloating
| Action::TogglePanePinned
| Action::ToggleMirrorResize
| Action::Resize { .. }
| Action::MovePane { .. }
| Action::MovePaneBackwards
| Actio... |
rust_dataset_chunk_514495 | rust_dataset.txt | 514,495 | 512 | ) => Some(PopupKeyAction::ScrollPopup(scroll)),
PopupActionRule::ClosePopup => Some(PopupKeyAction::ClosePopup),
PopupActionRule::Ignore => None,
})
.collect()
}
pub(crate) fn actions_for_key(
keybinds: &Keybinds,
current_mode: &InputMode,
default_mode: InputMode,
... |
rust_dataset_chunk_514496 | rust_dataset.txt | 514,496 | 512 | : InputMode) -> Action {
Action::SwitchToMode { input_mode }
}
fn keybinds() -> Keybinds {
let mut normal = HashMap::new();
normal.insert(ctrl('g'), vec![switch_to(InputMode::Locked)]);
normal.insert(ctrl('p'), vec![switch_to(InputMode::Pane)]);
normal.insert(ctrl('d'), ... |
rust_dataset_chunk_514497 | rust_dataset.txt | 514,497 | 512 | areKey::Enter).with_alt_modifier();
let mut keybinds = keybinds();
let normal = keybinds.0.get_mut(&InputMode::Normal).unwrap();
normal.insert(esc.clone(), vec![switch_to(InputMode::Locked)]);
normal.insert(enter.clone(), vec![switch_to(InputMode::Locked)]);
normal.insert(alt_ent... |
rust_dataset_chunk_514498 | rust_dataset.txt | 514,498 | 512 | vec![PopupKeyAction::Route(switch_to(InputMode::Pane))]
);
}
#[test]
fn bound_esc_and_enter_run_their_action_without_a_popup() {
let keybinds = keybinds_with_esc_and_enter_bound();
let esc = KeyWithModifier::new(BareKey::Esc);
let enter = KeyWithModifier::new(BareKey::Enter... |
rust_dataset_chunk_514499 | rust_dataset.txt | 514,499 | 512 | locked_mode_sends_every_key_but_the_unlock_key_to_the_popup() {
assert_eq!(
dispatch(InputMode::Locked, ctrl('p')),
vec![to_popup(ctrl('p'))]
);
assert_eq!(
dispatch(InputMode::Locked, key('x')),
vec![to_popup(key('x'))]
);
assert_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.