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_516000
rust_dataset.txt
516,000
512
link_start(URL), LINK_END, link_start(OTHER_URL), LINK_END ) ); } #[test] fn a_link_level_is_not_a_style() { let text = parsed(&linked("ab", URL, 0..2)); assert!(!text.is_styled_at(0)); assert_eq!(text.into_disable...
rust_dataset_chunk_516001
rust_dataset.txt
516,001
512
inner_width > TOGGLE_WIDTH - 2 { format!(" {} ", fit(if on { "on" } else { "off" }, inner_width - 2)) } else { fit(if on { "on" } else { "off" }, inner_width) }; let mut output = move_to(coordinates, 0, 0); output.push_str(&render_label(&label, label_width, focused, disabled, style)); ...
rust_dataset_chunk_516002
rust_dataset.txt
516,002
512
::from_utf8_lossy(&bytes).to_string() } pub fn text_width(text: &str) -> usize { graphemes::display_width(text) } pub fn text_clusters(text: &str) -> Vec<(&str, usize, usize)> { if text.is_ascii() { return (0..text.len()) .map(move |index| { let cluster = &text[index..index...
rust_dataset_chunk_516003
rust_dataset.txt
516,003
512
CharacterStyles { styles.dim(Some(AnsiCode::On)) } pub fn disabled_look(styles: CharacterStyles) -> CharacterStyles { styles.italic(Some(AnsiCode::On)).dim(Some(AnsiCode::On)) } pub fn reversed(styles: CharacterStyles) -> CharacterStyles { styles.reverse(Some(AnsiCode::On)) } pub fn paint(styles: Charac...
rust_dataset_chunk_516004
rust_dataset.txt
516,004
512
0; for (cluster, cluster_width, index) in text_clusters(&text.text) { if used + cluster_width > room { break; } used += cluster_width; let mut character_styles = base; if colorable && text.is_styled_at(index) { if let Some(color) = text.style_of_index...
rust_dataset_chunk_516005
rust_dataset.txt
516,005
512
if disabled { disabled_look(plain_styles(style)) } else if error { let styles = colored(style.colors.exit_code_error.base, None); if focused { bold(styles) } else { styles } } else if focused { bold(colored(style.colors.frame_selected.base...
rust_dataset_chunk_516006
rust_dataset.txt
516,006
512
0 { return vec![]; } if total <= height { return vec![true; height]; } let thumb = ((height * height) / total).max(1).min(height); let max_offset = total - height; let max_thumb_start = height - thumb; let thumb_start = (offset.min(max_offset) * max_thumb_start + max_offset /...
rust_dataset_chunk_516007
rust_dataset.txt
516,007
512
=> { let pressed = bold(colored( colors.ribbon_unselected.base, Some(colors.text_unselected.base), )); (pressed, pressed) }, ButtonLook::Disabled => ( disabled_look(plain_styles(style)), disabled_look(plain_styl...
rust_dataset_chunk_516008
rust_dataset.txt
516,008
512
]"); let centered = button_cells_styled(&go, 10, ButtonLook::Normal, false, false, &style); assert_eq!(strip_styles(&centered), "[ Go ]"); } fn strip_styles(text: &str) -> String { let mut plain = String::new(); let mut in_escape = false; for character in text.c...
rust_dataset_chunk_516009
rust_dataset.txt
516,009
512
assert!(cells.contains(&paint(emphasis, "on"))); } const FAMILY: &str = "\u{1F468}\u{200D}\u{1F469}\u{200D}\u{1F467}"; const DECOMPOSED_E: &str = "e\u{301}"; const FLAG: &str = "\u{1F1E9}\u{1F1EA}"; #[test] fn text_width_measures_clusters() { assert_eq!(text_width(FAMILY), 2); ...
rust_dataset_chunk_516010
rust_dataset.txt
516,010
512
你好世界", 4), "你…"); } #[test] fn fit_pads_to_the_exact_width_with_clusters() { let text = format!("ab{}cd", FAMILY); assert_eq!(fit(&text, 4), "ab… "); assert_eq!(text_width(&fit(&text, 4)), 4); assert_eq!(fit(&text, 8), format!("ab{}cd ", FAMILY)); assert_eq!(fit(DEC...
rust_dataset_chunk_516011
rust_dataset.txt
516,011
512
", FAMILY)); assert_eq!( strip_styles(&paint_text(&text, base, 3, true, &style)), "a… " ); let text = Text::plain(format!("{}{}{}", DECOMPOSED_E, DECOMPOSED_E, FLAG)); assert_eq!( strip_styles(&paint_text(&text, base, 3, true, &style)), for...
rust_dataset_chunk_516012
rust_dataset.txt
516,012
512
text: text.to_string(), level: HintLevel::Plain, } } fn emphasis(text: &str) -> Self { HintSegment { text: text.to_string(), level: HintLevel::Emphasis, } } fn emphasis_2(text: &str) -> Self { HintSegment { text:...
rust_dataset_chunk_516013
rust_dataset.txt
516,013
512
emphasis("ENTER"), HintSegment::plain(">"), HintSegment::plain(if is_first_run { " run, " } else { " re-run, " }), HintSegment::plain("<"), HintSegment::emphasis("ESC"), HintSegment::plain(">"), HintSegment::plain(" drop to shell, "), H...
rust_dataset_chunk_516014
rust_dataset.txt
516,014
512
::plain(" "), HintSegment::emphasis("Alt"), HintSegment::plain(" <"), HintSegment::emphasis("Right-Click"), HintSegment::plain(">"), HintSegment::plain(" - ungroup all "), ], HintTier::Medium => vec![ HintSegment::emphasis("Alt"), ...
rust_dataset_chunk_516015
rust_dataset.txt
516,015
512
HintSegment::plain("> "), ], }; } match tier { HintTier::Full => { if is_floating { vec![ HintSegment::plain(" "), HintSegment::emphasis_2("Ctrl"), HintSegment::plain(" <"), ...
rust_dataset_chunk_516016
rust_dataset.txt
516,016
512
_variants( is_first_run: bool, exit_status: Option<HintExitStatus>, ) -> BTreeMap<usize, StyledText> { let mut variants = BTreeMap::new(); for tier in ALL_TIERS { let mut segments = vec![]; if let Some(exit_status) = exit_status { segments.extend(exit_code_segments(exit_statu...
rust_dataset_chunk_516017
rust_dataset.txt
516,017
512
: 0, started_at, ..Default::default() } } pub fn set_name(&mut self, plugin_name: String) { self.plugin_name = plugin_name; } pub fn with_colors(mut self, terminal_emulator_colors: Styling) -> Self { self.terminal_emulator_colors = Some(terminal_emulator_c...
rust_dataset_chunk_516018
rust_dataset.txt
516,018
512
}; let red = match self.terminal_emulator_colors { Some(terminal_emulator_colors) => { style!(terminal_emulator_colors.exit_code_error.base).bold() }, None => ansi_term::Style::new(), }; let plugin_name = &self.plugin_name; let ...
rust_dataset_chunk_516019
rust_dataset.txt
516,019
512
Tier, }; use crate::ClientId; use zellij_utils::data::{client_slot_to_colors, BorderStyle, LineStyle, PaletteColor, Style}; use zellij_utils::errors::prelude::*; use zellij_utils::pane_size::{Offset, PaneGeom, Viewport}; use zellij_utils::position::Position; use unicode_width::UnicodeWidthStr; use zellij_utils::graphe...
rust_dataset_chunk_516020
rust_dataset.txt
516,020
512
_selected: bool, pub is_emphasized: bool, pub stack_is_focused: bool, pub is_in_row: bool, } impl StackListEntry { const SELECTION_MARKER: &'static str = "> "; const CORNER_PADDING: usize = 1; pub const OVERHEAD: usize = Self::SELECTION_MARKER.len() + 2 * (1 + Self::CORNER_PADDING); pub con...
rust_dataset_chunk_516021
rust_dataset.txt
516,021
512
pub scroll_position: (usize, usize), // (position, length) pub style: Style, pub border_style: BorderStyle, pub color: Option<PaletteColor>, pub focused_client: Option<ClientId>, pub is_main_client: bool, pub other_cursors_exist_in_session: bool, pub other_focused_clients: Vec<ClientId>,...
rust_dataset_chunk_516022
rust_dataset.txt
516,022
512
_params.should_draw_pane_frames, is_pinned: false, is_floating: frame_params.pane_is_floating, content_offset: frame_params.content_offset, mouse_is_hovering_over_pane: frame_params.mouse_is_hovering_over_pane, is_selectable: frame_params.pane_is_selectable, ...
rust_dataset_chunk_516023
rust_dataset.txt
516,023
512
.right) } fn title_separator_left(&self) -> &'static str { border_glyphs::title_separator_left(self.border_style.top) } fn title_separator_right(&self) -> &'static str { border_glyphs::title_separator_right(self.border_style.top) } fn horizontal_style_of_corner(&self, corner: Cor...
rust_dataset_chunk_516024
rust_dataset.txt
516,024
512
for plugins let pin_indication = if self.is_floating && self.is_selectable { self.render_pinned_indication(max_length) } else { None }; // no pin indication for tiled panes let space_for_scroll_indication = pin_indication ....
rust_dataset_chunk_516025
rust_dataset.txt
516,025
512
self.color), short_indication_len, )) } else { None } } fn render_pinned_indication( &self, max_length: usize, ) -> Option<(Vec<TerminalCharacter>, usize)> { let is_checked = if self.is_pinned { '+' } else { ' ' }; let ...
rust_dataset_chunk_516026
rust_dataset.txt
516,026
512
_color(self.title_separator_left(), self.color); let mut right_separator = foreground_color(self.title_separator_right(), self.color); let full_indication_text = "MY FOCUS AND:"; let short_indication_text = "+"; let mut full_indication = foreground_color(full_indication_text, self.color)...
rust_dataset_chunk_516027
rust_dataset.txt
516,027
512
, self.color); let mut full_indication_len = full_indication_text.width(); let mut middle_indication = foreground_color(middle_indication_text, self.color); let mut middle_indication_len = middle_indication_text.width(); let mut short_indication = vec![]; let mut short_indication...
rust_dataset_chunk_516028
rust_dataset.txt
516,028
512
= self.pane_is_stacked_under || self.pane_is_stacked_over || !self.should_draw_pane_frames; if renders_exit_status_in_title && self.exit_status.is_some() { let (first_part, first_part_len) = self.first_exited_held_title_part_full(); return if first_part_len <= ma...
rust_dataset_chunk_516029
rust_dataset.txt
516,029
512
{ None } else if graphemes::display_width(&full_text) <= max_length { Some(( foreground_color(&full_text, self.color), graphemes::display_width(&full_text), )) } else { let length_of_each_half = (max_length - middle_truncat...
rust_dataset_chunk_516030
rust_dataset.txt
516,030
512
1 { title_line.append(&mut foreground_color( self.get_corner(boundary_type::TOP_RIGHT), self.color, )); } else if col == left_side_start_position { title_line.append(&mut left_side); col += left_side_len;...
rust_dataset_chunk_516031
rust_dataset.txt
516,031
512
middle_only_title_line( &self, mut middle: Vec<TerminalCharacter>, middle_len: &usize, ) -> Vec<TerminalCharacter> { let total_title_length = self.geom.cols.saturating_sub(2); // 2 for the left and right corners let mut title_line = vec![]; let middle_start_position ...
rust_dataset_chunk_516032
rust_dataset.txt
516,032
512
Vec<TerminalCharacter>, left_side_len: &usize, ) -> Vec<TerminalCharacter> { let mut left_boundary = foreground_color(self.get_corner(boundary_type::TOP_LEFT), self.color); let mut right_boundary = foreground_color(self.get_corner(boundary_type::TOP_RIGHT), self.colo...
rust_dataset_chunk_516033
rust_dataset.txt
516,033
512
middle_len, right_side, &right_side_len, ), (Some((left_side, left_side_len)), None) => { self.left_and_middle_title_line(left_side, &left_side_len, middle, middle_len) }, _ => self.middle_only_title_line(middle...
rust_dataset_chunk_516034
rust_dataset.txt
516,034
512
frame.base); let (color, bold) = if entry.is_selected || entry.is_emphasized { (self.color, true) } else { (unfocused_color, entry.stack_is_focused) }; let mut label = styled_characters(&content, |styles| { if bold { styles.bold = Some...
rust_dataset_chunk_516035
rust_dataset.txt
516,035
512
let full_width_entry_length = marker_width + corner_overhead + inner_width; let entry_start = usable_cols.saturating_sub(full_width_entry_length) / 2; let left_budget = entry_start; let (mut focus_part, focus_length) = self .bracketed_focus_indicator(left_budget) .unwrap...
rust_dataset_chunk_516036
rust_dataset.txt
516,036
512
_columns < usable_cols.saturating_sub(scroll_length) { line.push(EMPTY_TERMINAL_CHARACTER); occupied_columns += 1; } line.append(&mut scroll_part); line } fn render_one_line_title(&self) -> Result<Vec<TerminalCharacter>> { if self.should_draw_pane_frames {...
rust_dataset_chunk_516037
rust_dataset.txt
516,037
512
usize) -> Option<(Vec<TerminalCharacter>, usize)> { let title_padding = 2; if self.title.is_empty() || max_length <= title_padding { return None; } let exit_part = self .exit_status .is_some() .then(|| self.first_exited_held_title_part_ful...
rust_dataset_chunk_516038
rust_dataset.txt
516,038
512
if full_length <= max_length { return Some((full_part, full_length)); } let short_indication = format!("{}/{}", self.scroll_position.0, self.scroll_position.1); let (short_part, short_length) = self.bracketed_title_part(&short_indication); if short_length <= max_lengt...
rust_dataset_chunk_516039
rust_dataset.txt
516,039
512
[]; let mut content_length = 0; for display_slot in &self.other_focused_client_slots { if content_length > 0 { content.push(EMPTY_TERMINAL_CHARACTER); content_length += 1; } content.append(&mut self.client_cursor(*display_slot)); ...
rust_dataset_chunk_516040
rust_dataset.txt
516,040
512
}; let middle_end = if middle.is_some() { middle_start + middle_length } else { left_length }; let right_start = width.saturating_sub(right_length).max(middle_end); let fill_character = if self.pane_is_stacked { foreground_color(self.bo...
rust_dataset_chunk_516041
rust_dataset.txt
516,041
512
.bottom_horizontal()); } let mut ret = vec![]; ret.append(&mut left_boundary); ret.append(&mut text_characters); ret.append(&mut foreground_color(&padding, self.color)); ret.append(&mut right_boundary); Ok(ret) } fn render_help_text_undertitle(&self) -> R...
rust_dataset_chunk_516042
rust_dataset.txt
516,042
512
} fn help_text_version( &self, max_length: usize, tier: HintTier, ) -> Option<(Vec<TerminalCharacter>, usize)> { let segments = resize_segments(self.is_floating, self.mouse_scroll_resize, tier); let (characters, length) = self.render_hint_segments(&segments); ...
rust_dataset_chunk_516043
rust_dataset.txt
516,043
512
_part_len; let mut padding = String::new(); for _ in full_text_len..max_undertitle_length { padding.push_str(self.bottom_horizontal()); } let mut ret = vec![]; ret.append(&mut left_boundary); ret.append(&...
rust_dataset_chunk_516044
rust_dataset.txt
516,044
512
_start && position.column() <= checkbox_position_end) { return true; } } false } pub fn render(&self) -> Result<(Vec<CharacterChunk>, Option<String>)> { let err_context = || "failed to render pane frame"; let mut charact...
rust_dataset_chunk_516045
rust_dataset.txt
516,045
512
if row == self.geom.rows - 1 { // bottom row if self.highlight_tooltip.is_some() && self.is_main_client { let x = self.geom.x; let y = self.geom.y + row; character_chunks.push(CharacterChunk::new( ...
rust_dataset_chunk_516046
rust_dataset.txt
516,046
512
; character_chunks.push(CharacterChunk::new(boundary_character_left, x, y)); let x = (self.geom.x + self.geom.cols).saturating_sub(1); let y = self.geom.y + row; character_chunks.push(CharacterChunk::new(boundary_character_right, x, y)); ...
rust_dataset_chunk_516047
rust_dataset.txt
516,047
512
vec![]; let mut padding = String::new(); for _ in 0..max_undertitle_length { padding.push_str(self.bottom_horizontal()); } ret.append(&mut left_boundary); ret.append(&mut foreground_color(&padding, self.color)); ret.append(&mut right_boundary); ret ...
rust_dataset_chunk_516048
rust_dataset.txt
516,048
512
fn title_frame(title: &str, cols: usize, framed: bool) -> PaneFrame { let mut frame = pane_frame_with(false, false, cols); frame.title = title.to_string(); frame.geom.rows = 3; frame.mouse_hover_tips = false; frame.show_help_text = false; frame.should_draw_pane_frames = ...
rust_dataset_chunk_516049
rust_dataset.txt
516,049
512
cols, false); let cells = first_row(&frame); let width: usize = cells.iter().map(|c| c.width()).sum(); assert!( width <= cols, "cols={} row={:?}", cols, characters_to_string(&cells) ); assert_cel...
rust_dataset_chunk_516050
rust_dataset.txt
516,050
512
terminal", "界", CLUSTER_TITLE] { let label_width = graphemes::display_width(label); let natural_width = label_width + StackListEntry::ROW_OVERHEAD; for selected in [false, true] { for cols in 0..=natural_width { let frame = title_frame(label, cols,...
rust_dataset_chunk_516051
rust_dataset.txt
516,051
512
:?}", cols, characters_to_string(&cells) ); assert_cells_are_whole_clusters(&cells, CLUSTER_TITLE); } } fn frame_rows(border_style: BorderStyle) -> Vec<String> { let mut frame = pane_frame_with(false, false, 10); frame.border_style...
rust_dataset_chunk_516052
rust_dataset.txt
516,052
512
_with('╗'), "{}", rows[0]); assert_eq!(rows[1], "║║"); assert_eq!(rows[2], "╚════════╝"); } #[test] fn heavy_and_double_corner_falls_back_to_the_horizontal_arm() { let rows = frame_rows(BorderStyle { top: LineStyle::Double, right: LineStyle::Heavy, ...
rust_dataset_chunk_516053
rust_dataset.txt
516,053
512
= pane_frame_with(true, true, 80); let (chars, _) = frame.help_text_version_full(80).unwrap(); let text = characters_to_string(&chars); assert!(text.contains("Ctrl <MouseScroll>")); assert!(text.contains("Ctrl <drag borders>")); } #[test] fn help_text_full_omits_ctrl_scroll...
rust_dataset_chunk_516054
rust_dataset.txt
516,054
512
(AnsiCode::On); }); } } } pub struct PaneContentsAndUi<'a> { pane: &'a mut Box<dyn Pane>, output: &'a mut Output, style: Style, focused_clients: Vec<ClientId>, client_display_slots: HashMap<ClientId, usize>, multiple_users_exist_in_session: bool, z_index: Option<usiz...
rust_dataset_chunk_516055
rust_dataset.txt
516,055
512
let mouse_is_hovering_over_pane_for_clients = mouse_hover_pane_id .iter() .filter_map(|(client_id, pane_id)| { if pane_id == &pane.pid() { Some(*client_id) } else { None } }) ....
rust_dataset_chunk_516056
rust_dataset.txt
516,056
512
format!("failed to render the live view for client {client_id}") })?; } Ok(()) } fn display_slot_of(&self, client_id: ClientId) -> usize { self.client_display_slots .get(&client_id) .copied() .unwrap_or(0) } fn frame_is_dimmed_...
rust_dataset_chunk_516057
rust_dataset.txt
516,057
512
_image_chunks, clients.iter().copied(), self.z_index, ); if let Some(raw_vte_output) = raw_vte_output { if !raw_vte_output.is_empty() { self.output.add_post_vte_instruction_to_multiple_clients( clients.it...
rust_dataset_chunk_516058
rust_dataset.txt
516,058
512
Result<()> { let err_context = || format!("failed to render guest modal for client {client_id}"); let selection = self.pane.guest_modal_selection(client_id).unwrap_or(0); let hovered = self.pane.guest_modal_hover(client_id); let session_name = self .pane .guest_s...
rust_dataset_chunk_516059
rust_dataset.txt
516,059
512
); if cursor_is_visible { if let Some(fake_cursor) = self.pane.render_fake_cursor(colors.0, colors.1) { self.output.add_character_chunks_to_client( client_id, vec![fake_cursor], ...
rust_dataset_chunk_516060
rust_dataset.txt
516,060
512
p| p.contains(&self.pane.pid())) .unwrap_or(false); let stack_list_entry = self.stack_list_entry_width.map(|width| StackListEntry { width, label: self.pane.stack_list_entry_label(), is_selected: self.stack_list_entry_is_selected, stack_is_focused: self...
rust_dataset_chunk_516061
rust_dataset.txt
516,061
512
_of(*c_id)) .collect(), other_focused_clients, style: self.style, border_style, color: frame_color.map(|c| c.0), other_cursors_exist_in_session: self.multiple_users_exist_in_session, pane_is_stacked_over:...
rust_dataset_chunk_516062
rust_dataset.txt
516,062
512
{ let color = self.frame_color(client_id, client_mode, session_is_mirrored); let pane_is_floating = false; boundaries.add_rect( self.pane.as_ref(), color, self.border_style(pane_is_floating), pane_is_on_top_of_stack, pane_is_on_bottom_...
rust_dataset_chunk_516063
rust_dataset.txt
516,063
512
} else { self.style .colors .frame_unselected .map(|frame| (frame.base, 0)) } } } --- FILE: zellij/zellij-server/src/unit/golden.rs --- use std::path::PathBuf; pub(crate) struct Digest(u64); impl Digest { pub(crate) fn new() -> Self { ...
rust_dataset_chunk_516064
rust_dataset.txt
516,064
512
(expected_lines.len().min(actual_lines.len())); panic!( "{} differs from {} at line {} ({} lines expected, {} produced)\n expected: {}\n actual: {}\nif the change is intended, regenerate with ZELLIJ_UPDATE_GOLDENS=1 and review the diff", name, path.display(), first + 1, exp...
rust_dataset_chunk_516065
rust_dataset.txt
516,065
512
NotificationProtocol::Osc9 ); } #[test] fn an_explicitly_configured_protocol_overrides_detection() { let kitty = env(&[("TERM", "xterm-kitty")]); assert_eq!( NotificationProtocol::resolve(HostNotificationProtocol::Osc9, &kitty), NotificationProtocol::Osc9 ); assert_eq!( ...
rust_dataset_chunk_516066
rust_dataset.txt
516,066
512
.render("", "\u{1b}[2Jbody"), Some("\u{1b}]99;;[2Jbody\u{7}".to_owned()) ); } --- FILE: zellij/zellij-server/src/unit/os_input_output_tests.rs --- use super::*; use zellij_utils::input::command::RunCommand; fn make_server() -> ServerOsInputOutput { get_server_os_input().expect("failed to create serve...
rust_dataset_chunk_516067
rust_dataset.txt
516,067
512
from PID {}", pid ); } // --- Signal delivery tests --- #[cfg(not(windows))] #[test] fn kill_sends_sighup_to_process() { let child = long_running_cmd() .spawn() .expect("failed to spawn long-running process"); let pid = child.id(); let server = make_server(); server.kill...
rust_dataset_chunk_516068
rust_dataset.txt
516,068
512
spawn_terminal(action, quit_cb, None, &Default::default()) .expect("spawn_terminal should succeed"); // Read output from the spawned terminal let mut output = Vec::new(); let deadline = std::time::Instant::now() + std::time::Duration::from_secs(5); let rt = tokio::runtime::Builder::new_current...
rust_dataset_chunk_516069
rust_dataset.txt
516,069
512
move |_pane_id, _exit_status, _run_command| exited.store(true, Ordering::SeqCst) }); let cmd = RunCommand { command: PathBuf::from("cmd"), ..Default::default() }; let (_terminal_id, _reader, child_pid) = server .spawn_terminal( TerminalAction::RunCommand(cmd),...
rust_dataset_chunk_516070
rust_dataset.txt
516,070
512
Fn(PaneId, Option<i32>, RunCommand) + Send> = Box::new(|_, _, _| {}); let (terminal_id, _reader, child_pid) = server .spawn_terminal( TerminalAction::RunCommand(cmd), quit_cb, None, &Default::default(), ) .expect("spawn_terminal should succeed...
rust_dataset_chunk_516071
rust_dataset.txt
516,071
512
buffer.try_send(msg()), Err(TrySendError::Full(_)))); } #[test] fn client_buffer_reports_disconnect_when_receiver_is_gone() { let (buffer, receiver) = client_buffer(CLIENT_BUFFER_LIMIT); drop(receiver); let result = buffer.try_send(ServerToClientMsg::Exit { exit_reason: ExitReason::Normal, }); ...
rust_dataset_chunk_516072
rust_dataset.txt
516,072
512
6), ) .await { Ok(Ok(bytes)) if bytes.is_empty() => break, Ok(Ok(bytes)) => output.extend_from_slice(&bytes), Ok(Err(_)) => break, Err(_) => {}, } } String::from_utf8_lossy(&output).to_string(...
rust_dataset_chunk_516073
rust_dataset.txt
516,073
512
_utils::ipc::{ClientToServerMsg, IpcReceiverWithContext, ServerToClientMsg}; #[derive(Clone)] struct MockOsApi { cwds: Arc<Mutex<HashMap<u32, PathBuf>>>, cmds: Arc<Mutex<HashMap<u32, Vec<String>>>>, cmds_by_ppid: Arc<Mutex<HashMap<String, Vec<String>>>>, } impl MockOsApi { fn new() -> Self { M...
rust_dataset_chunk_516074
rust_dataset.txt
516,074
512
::Result<()> { Ok(()) } fn force_kill(&self, _: u32) -> anyhow::Result<()> { Ok(()) } fn send_sigint(&self, _: u32) -> anyhow::Result<()> { Ok(()) } fn box_clone(&self) -> Box<dyn ServerOsApi> { Box::new((*self).clone()) } fn send_to_client(&self, _: Clien...
rust_dataset_chunk_516075
rust_dataset.txt
516,075
512
iter() .filter_map(|(terminal_id, shell_pid)| { cmds_by_ppid .get(&shell_pid.to_string()) .map(|cmd| (*terminal_id, cmd.clone())) }) .collect() } fn write_to_file(&mut self, _: String, _: Option<String>) -> anyhow::Resul...
rust_dataset_chunk_516076
rust_dataset.txt
516,076
512
::Receiver<(PluginInstruction, ErrorContext)>, ) -> Vec<(PaneId, Vec<String>, bool)> { let mut events = Vec::new(); while let Ok((instruction, _)) = rx.try_recv() { if let PluginInstruction::Update(updates) = instruction { for (_, _, event) in updates { if let Event::CommandC...
rust_dataset_chunk_516077
rust_dataset.txt
516,077
512
!["cargo".into(), "build".into()]); let (mut pty, rx) = make_pty_with_plugin_receiver(mock.clone()); set_active_terminal(&mut pty, 1, child_pid); pty.update_and_report_cwds(); let events = collect_command_changed_events(&rx); assert_eq!(events.len(), 1); assert!(events[0].2, "first event should...
rust_dataset_chunk_516078
rust_dataset.txt
516,078
512
events = collect_command_changed_events(&rx); assert!( events.is_empty(), "inactive terminal should produce no events" ); } #[test] fn foreground_change_between_two_commands() { let mock = MockOsApi::new(); let child_pid = 100; mock.set_foreground_cmd(child_pid, vec!["vim".into()])...
rust_dataset_chunk_516079
rust_dataset.txt
516,079
512
ty, 1, pid_active); set_active_terminal(&mut pty, 2, pid_inactive); pty.pane_activity_flags .get(&2) .unwrap() .store(false, Ordering::Relaxed); pty.update_and_report_cwds(); let events = collect_cwd_changed_events(&rx); assert_eq!(events.len(), 1); assert_eq!(events[0]...
rust_dataset_chunk_516080
rust_dataset.txt
516,080
512
_eq!(events.len(), 1); assert_eq!(events[0].0, PaneId::Terminal(1)); assert_eq!(events[0].1, PathBuf::from("/tmp/new")); assert_eq!( pty.terminal_cwds.get(&1), Some(&PathBuf::from("/tmp/new")), "cache should be updated" ); } #[test] fn osc7_no_event_when_unchanged() { let mo...
rust_dataset_chunk_516081
rust_dataset.txt
516,081
512
(&rx); assert!( cwd_events.is_empty() && cmd_events.is_empty(), "poll after osc7 should skip terminal since flag was cleared" ); } fn session_with_terminal_pane(terminal_id: u32) -> SessionLayoutMetadata { let mut meta = SessionLayoutMetadata::default(); let pane = crate::session_layout...
rust_dataset_chunk_516082
rust_dataset.txt
516,082
512
(); let child_pid = 100; mock.set_foreground_cmd(child_pid, vec!["htop".into()]); mock.set_cwd(child_pid, PathBuf::from("/tmp/detected")); let (mut pty, _rx) = make_pty_with_plugin_receiver(mock); set_active_terminal(&mut pty, 1, child_pid); pty.set_resurrect_command( 1, Some(re...
rust_dataset_chunk_516083
rust_dataset.txt
516,083
512
_run_and_cwd(&mut pty, 1); assert_eq!(run, run_command("htop", vec![])); } #[test] fn resurrect_command_persists_after_foreground_command_changes() { let mock = MockOsApi::new(); let child_pid = 100; mock.set_foreground_cmd(child_pid, vec!["htop".into()]); let (mut pty, _rx) = make_pty_with_plugin_...
rust_dataset_chunk_516084
rust_dataset.txt
516,084
512
Palette; use zellij_utils::input::command::RunCommand; use zellij_utils::ipc::{ClientToServerMsg, IpcReceiverWithContext, ServerToClientMsg}; use crate::ClientId; /// Per-terminal write behavior for the mock. #[derive(Clone)] enum WriteBehavior { /// Accept all bytes (like a healthy terminal). AcceptAll, ...
rust_dataset_chunk_516085
rust_dataset.txt
516,085
512
_input_output::PaneEnv, ) -> Result<(u32, Box<dyn AsyncReader>, Option<u32>)> { unimplemented!() } fn write_to_tty_stdin(&self, terminal_id: u32, buf: &[u8]) -> Result<usize> { let behavior = self .write_behavior .lock() .unwrap() .get(&termina...
rust_dataset_chunk_516086
rust_dataset.txt
516,086
512
load_palette(&self) -> Palette { Palette::default() } fn get_cwd(&self, _pid: u32) -> Option<PathBuf> { None } fn write_to_file(&mut self, _buf: String, _file: Option<String>) -> Result<()> { Ok(()) } fn re_run_command_in_terminal( &self, _terminal_id: u3...
rust_dataset_chunk_516087
rust_dataset.txt
516,087
512
); assert_eq!(written, b"hello world"); } #[test] fn partial_write_is_buffered_and_drained() { let mock = MockServerOsApi::new(); // Accept only 3 bytes at a time mock.set_behavior(1, WriteBehavior::AcceptAtMost(3)); let mock_clone = mock.clone(); let (bus, sender) = make_test_bus(mock); r...
rust_dataset_chunk_516088
rust_dataset.txt
516,088
512
PtyWriteInstruction::Write(b"CCCC".to_vec(), 1, None), ], ); let written = mock_clone.get_written_bytes(1); assert_eq!( written, b"AAAABBBBCCCC", "writes must be delivered in order" ); } #[test] fn memory_cap_drops_buffer_when_exceeded() { let mock = MockServerO...
rust_dataset_chunk_516089
rust_dataset.txt
516,089
512
"errored terminal should have no written bytes" ); // Terminal 2 should be unaffected let written_2 = mock_clone.get_written_bytes(2); assert_eq!(written_2, b"should work"); } --- FILE: zellij/zellij-server/src/unit/screen_tests.rs --- use super::{ screen_thread_main, CopyOptions, Screen, Screen...
rust_dataset_chunk_516090
rust_dataset.txt
516,090
512
_utils::ipc::PixelDimensions; use interprocess::local_socket::Stream as LocalSocketStream; use zellij_utils::{ channels::{self, ChannelWithContext, Receiver}, data::{Direction, FloatingPaneCoordinates, InputMode, ModeInfo, NewPanePlacement, Palette}, ipc::{ClientAttributes, ClientToServerMsg, ServerToClien...
rust_dataset_chunk_516091
rust_dataset.txt
516,091
512
())), Style::default(), debug, arrow_fonts, styled_underlines, osc8_hyperlinks, explicitly_disable_kitty_keyboard_protocol, ); let snapshots: Vec<(Option<(usize, usize)>, String)> = all_events .filter_map(|server_instruction| { match server_ins...
rust_dataset_chunk_516092
rust_dataset.txt
516,092
512
tty_stdin_bytes: Arc<Mutex<BTreeMap<u32, Vec<u8>>>>, } impl ServerOsApi for FakeInputOutput { fn set_terminal_size_using_terminal_id( &self, _terminal_id: u32, _cols: u16, _rows: u16, _width_in_pixels: Option<u16>, _height_in_pixels: Option<u16>, ) -> Result<()>...
rust_dataset_chunk_516093
rust_dataset.txt
516,093
512
remove_client(&mut self, _client_id: ClientId) -> Result<()> { unimplemented!() } fn load_palette(&self) -> Palette { unimplemented!() } fn get_cwd(&self, _pid: u32) -> Option<PathBuf> { unimplemented!() } fn write_to_file(&mut self, contents: String, filename: Option<St...
rust_dataset_chunk_516094
rust_dataset.txt
516,094
512
Bus::empty(); let fake_os_input = FakeInputOutput::default(); let tty_stdin_bytes = fake_os_input.tty_stdin_bytes.clone(); bus.os_input = Some(Box::new(fake_os_input)); let (to_server, server_receiver): ChannelWithContext<ServerInstruction> = channels::unbounded(); bus.senders.to_server = Some(Send...
rust_dataset_chunk_516095
rust_dataset.txt
516,095
512
mouse_hover_effects, true, visual_bell, false, // focus_follows_mouse false, // mouse_click_through web_server_ip, web_server_port, NestedSessionHandling::default(), "test-session-id".to_string(), ); ( seed_first_client_size(screen,...
rust_dataset_chunk_516096
rust_dataset.txt
516,096
512
Some(&self.to_screen.clone()), Some(&self.to_pty.clone()), Some(&self.to_plugin.clone()), Some(&self.to_server.clone()), Some(&self.to_pty_writer.clone()), Some(&self.to_background_jobs.clone()), Some(Box::new(self.os_input.clone())), ) ...
rust_dataset_chunk_516097
rust_dataset.txt
516,097
512
(vec![]), Some(vec![])), // swap layouts (None would fall back to Screen::default_layout) None, // initial_panes false, should_change_focus_to_new_tab, (self.main_client_id, false), None, )); let _ = self.to_screen.send(...
rust_dataset_chunk_516098
rust_dataset.txt
516,098
512
self.config.clone(); let client_attributes = self.client_attributes.clone(); let screen_bus = Bus::new( vec![self.screen_receiver.take().unwrap()], Some(&self.to_screen.clone()), Some(&self.to_pty.clone()), Some(&self.to_plugin.clone()), Some(...
rust_dataset_chunk_516099
rust_dataset.txt
516,099
512
l + 1).unwrap_or(0); let should_change_focus_to_new_tab = true; let _ = self.to_screen.send(ScreenInstruction::NewTab( None, default_shell, Some(pane_layout.clone()), initial_floating_panes_layout.clone(), tab_name, (Some(vec![]), ...