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_513900 | rust_dataset.txt | 513,900 | 512 | for (chunk, simple) in [(4096, false), (7, false), (bytes.len(), true), (7, true)] {
let actual = screen_after(bytes, grapheme_mode, size, chunk, simple);
if actual != reference {
failures.push(format!(
"{} chunk={} without shortcut... |
rust_dataset_chunk_513901 | rust_dataset.txt | 513,901 | 512 | values()
.map(|link| link.uri.clone())
.collect();
uris.sort();
uris
}
#[test]
fn a_url_typed_at_a_shell_prompt_is_linked_whole_once_the_cursor_leaves_it() {
let url = "http://www.example.com";
let mut grid = create_grid_with_size_and_raw(10, 60, b"> ");
let mut parser = vt_parser::... |
rust_dataset_chunk_513902 | rust_dataset.txt | 513,902 | 512 | ::new(RefCell::new(KittyImageStore::default())),
Style::default(),
false,
true,
true,
true,
false,
)
}
#[test]
fn ui_components_are_ignored_in_terminal_panes() {
let mut vte_parser = vt_parser::Parser::new();
let mut grid = hostile_output_grid(Rc::new(RefCell... |
rust_dataset_chunk_513903 | rust_dataset.txt | 513,903 | 512 | ixel_image_store.clone());
vte_parser.feed(&mut grid, b"\x1bPq\"1;1;1;99999#0~\x1b\\");
assert_eq!(sixel_image_store.borrow().image_count(), 0);
}
#[test]
fn oversized_sixel_repeats_are_dropped() {
let mut vte_parser = vt_parser::Parser::new();
let sixel_image_store = Rc::new(RefCell::new(SixelImageSto... |
rust_dataset_chunk_513904 | rust_dataset.txt | 513,904 | 512 | = hostile_output_grid(Rc::new(RefCell::new(SixelImageStore::default())));
let mut sequence = b"\x1bP+q".to_vec();
sequence.extend(std::iter::repeat(b';').take(10_000));
sequence.extend_from_slice(b"\x1b\\");
vte_parser.feed(&mut grid, &sequence);
assert!(grid.pending_messages_to_pty.is_empty());
}
... |
rust_dataset_chunk_513905 | rust_dataset.txt | 513,905 | 512 | -session"));
assert!(rendered.contains("What would you like to do?"));
assert!(rendered.contains("Zoom in and control this session"));
assert!(rendered.contains("Control this session on focus"));
assert!(rendered.contains("<↓↑> select"));
assert!(rendered.contains("<Enter> confirm"));
assert!(re... |
rust_dataset_chunk_513906 | rust_dataset.txt | 513,906 | 512 | &str, number: &str) -> usize {
line.find(number).expect("option number present")
}
#[test]
fn options_are_left_justified_within_the_centered_block() {
let style = Style::default();
let shortcuts = sample_shortcuts();
let chunks = guest_modal_chunks(80, 30, 0, 0, &style, "s", 0, None, &shortcuts);
... |
rust_dataset_chunk_513907 | rust_dataset.txt | 513,907 | 512 | let chunks = guest_modal_chunks(3, 2, 0, 0, &style, "session", 0, None, &shortcuts);
assert_eq!(chunks.len(), 2);
let empty = guest_modal_chunks(0, 0, 0, 0, &style, "session", 0, None, &shortcuts);
assert!(empty.is_empty());
}
#[test]
fn every_rendered_row_spans_the_full_width() {
let style = Style::d... |
rust_dataset_chunk_513908 | rust_dataset.txt | 513,908 | 512 | assert_eq!(hit_at(4, 10, 2, 5, 0), None);
assert_eq!(hit_at(40, 80, 0, 40, 0), None);
}
#[test]
fn hit_test_ignores_columns_outside_the_block() {
let rows = 40;
let columns = 80;
let styles = guest_modal_styles(&Style::default());
let layout = guest_modal_layout(
columns,
rows,
... |
rust_dataset_chunk_513909 | rust_dataset.txt | 513,909 | 512 | ();
let shortcuts = sample_shortcuts();
let columns = 80;
let rows = 40;
let styles = guest_modal_styles(&style);
let layout = guest_modal_layout(columns, rows, &styles, "session", 0, None, &shortcuts);
let title_is_italic = |hovered: Option<usize>, option: usize| {
let chunks = guest_mo... |
rust_dataset_chunk_513910 | rust_dataset.txt | 513,910 | 512 | );
let block_start = layout.left_pad;
let block_end = layout.left_pad + layout.block_width;
let mut block_cells = 0;
for (column, character) in selected_chunk.terminal_characters.iter().enumerate() {
if column >= block_start && column < block_end {
assert_eq!(
ch... |
rust_dataset_chunk_513911 | rust_dataset.txt | 513,911 | 512 | _eq!(words[2].1, styles.keycode);
}
#[test]
fn keycode_words_render_unbound_when_empty() {
let style = Style::default();
let styles = guest_modal_styles(&style);
let words = guest_modal_keycode_words(&[], styles.fill.clone(), styles.keycode.clone());
assert_eq!(words.len(), 1);
assert_eq!(words[0].... |
rust_dataset_chunk_513912 | rust_dataset.txt | 513,912 | 512 | ("tests");
path_to_file.push("fixtures");
path_to_file.push("grid_copy");
std::fs::read(path_to_file)
.unwrap_or_else(|_| panic!("could not read fixture ../src/tests/fixtures/grid_copy"))
}
fn create_pane() -> TerminalPane {
let mut fake_win_size = PaneGeom::default();
fake_win_size.cols.se... |
rust_dataset_chunk_513913 | rust_dataset.txt | 513,913 | 512 | {
let mut terminal_pane = create_pane();
terminal_pane.update_search_term("tortor");
terminal_pane.search_up();
// snapshot-size optimization: We use a named one here to de-duplicate
assert_snapshot!(
"grid_copy_search_cursor_at_bottom",
format!("{:?}", terminal_pane.grid)
);
... |
rust_dataset_chunk_513914 | rust_dataset.txt | 513,914 | 512 | ensitive() {
let mut terminal_pane = create_pane();
terminal_pane.update_search_term("quam");
assert_snapshot!(
"grid_copy_quam_highlighted",
format!("{:?}", terminal_pane.grid)
);
// sensitivity off
terminal_pane.toggle_search_case_sensitivity();
assert_snapshot!(
... |
rust_dataset_chunk_513915 | rust_dataset.txt | 513,915 | 512 | _bottom",
format!("{:?}", terminal_pane.grid)
);
assert_eq!(
terminal_pane.grid.search_results.active.as_ref(),
terminal_pane.grid.search_results.selections.last()
);
// Scrolling up until a new search result appears
terminal_pane.scroll_up(4, fake_client_id);
// Scrolli... |
rust_dataset_chunk_513916 | rust_dataset.txt | 513,916 | 512 | _multiline_highlighted_narrow",
format!("{:?}", terminal_pane.grid)
);
terminal_pane.search_up();
assert_snapshot!(
"grid_copy_multiline_selected_narrow",
format!("{:?}", terminal_pane.grid)
);
// Wrap on
terminal_pane.toggle_search_wrap();
terminal_pane.search_down... |
rust_dataset_chunk_513917 | rust_dataset.txt | 513,917 | 512 | () {
let mut terminal_pane = create_pane();
terminal_pane.update_search_term("quam");
assert_snapshot!(
"grid_copy_quam_highlighted",
format!("{:?}", terminal_pane.grid)
);
terminal_pane.toggle_search_whole_words();
assert_snapshot!(
"grid_copy_quam_whole_word_only",
... |
rust_dataset_chunk_513918 | rust_dataset.txt | 513,918 | 512 | {1F468}\u{200D}\u{1F469}\u{200D}\u{1F467}";
#[test]
pub fn searching_for_a_decomposed_accent_matches_the_whole_cluster() {
let mut terminal_pane = create_pane_with_content("cafe\u{0301} au lait", 40);
terminal_pane.update_search_term("e\u{0301}");
assert_eq!(found_ranges(&terminal_pane), vec![((0, 3), (0, ... |
rust_dataset_chunk_513919 | rust_dataset.txt | 513,919 | 512 | , 0), (0, 5)), ((0, 10), (0, 15))]
);
}
#[test]
pub fn a_match_after_wide_characters_highlights_screen_columns() {
let mut terminal_pane = create_pane_with_content("你好 world", 40);
terminal_pane.update_search_term("world");
assert_eq!(found_ranges(&terminal_pane), vec![((0, 5), (0, 10))]);
assert_s... |
rust_dataset_chunk_513920 | rust_dataset.txt | 513,920 | 512 | )), ((0, 17), (0, 20))]
);
}
--- FILE: zellij/zellij-server/src/panes/unit/selection_tests.rs ---
use super::*;
#[test]
fn selection_start() {
let mut selection = Selection::default();
selection.start(Position::new(10, 10));
assert!(selection.active);
assert_eq!(selection.start, Position::new(10... |
rust_dataset_chunk_513921 | rust_dataset.txt | 513,921 | 512 | _case in test_cases {
let result = test_case.selection.contains(
test_case.position.line.0 as usize,
test_case.position.column.0,
);
assert_eq!(result, test_case.result)
}
}
#[test]
fn sorted() {
let selection = Selection {
start: Position::new(1, 1),
... |
rust_dataset_chunk_513922 | rust_dataset.txt | 513,922 | 512 | _position: None,
last_added_line_index: None,
};
inactive_selection.move_up(2);
assert_eq!(inactive_selection.start, Position::new(8, 1));
assert_eq!(inactive_selection.end, end);
}
#[test]
fn move_down_inactive() {
let start = Position::new(10, 1);
let end = Position::new(20, 2);
... |
rust_dataset_chunk_513923 | rust_dataset.txt | 513,923 | 512 | selection_start = Position::new(10, 10);
let selection_end = Position::new(20, 20);
let last_word_start = Position::new(20, 15);
let last_word_end = Position::new(20, 20);
let mut selection = Selection {
start: selection_start,
end: selection_end,
active: true,
last_adde... |
rust_dataset_chunk_513924 | rust_dataset.txt | 513,924 | 512 | _eq!(selection.start, selection_start);
assert_eq!(selection.end, word_end);
}
#[test]
fn add_word_to_position_extend_right() {
let selection_start = Position::new(10, 10);
let selection_end = Position::new(20, 20);
let last_word_start = Position::new(20, 10);
let last_word_end = Position::new(20, ... |
rust_dataset_chunk_513925 | rust_dataset.txt | 513,925 | 512 | , 20);
let word_end = Position::new(10, 30);
selection.add_word_to_position(word_start, word_end);
assert_eq!(selection.start, word_start);
assert_eq!(selection.end, selection_end);
}
#[test]
fn add_word_to_position_reduce_from_right() {
let selection_start = Position::new(10, 10);
let selecti... |
rust_dataset_chunk_513926 | rust_dataset.txt | 513,926 | 512 | 21;
selection.add_line_to_position(line_index_to_add, last_index_in_line);
assert_eq!(selection.start, selection_start);
assert_eq!(
selection.end,
Position::new(line_index_to_add as i32, last_index_in_line as u16)
);
}
#[test]
fn add_line_to_position_reduce_from_below() {
let sel... |
rust_dataset_chunk_513927 | rust_dataset.txt | 513,927 | 512 | start, end)),
last_added_line_index: None,
};
selection.finalize();
assert_eq!(selection.start, start);
assert_eq!(selection.end, end);
assert!(!selection.active);
}
#[test]
fn double_click_then_scroll_moves_both_positions() {
let word_start = Position::new(10, 5);
let word_end = ... |
rust_dataset_chunk_513928 | rust_dataset.txt | 513,928 | 512 | };
use std::fmt::Write;
fn read_fixture(fixture_name: &str) -> Vec<u8> {
let mut path_to_file = std::path::PathBuf::new();
path_to_file.push("../src");
path_to_file.push("tests");
path_to_file.push("fixtures");
path_to_file.push(fixture_name);
std::fs::read(path_to_file)
.unwrap_or_els... |
rust_dataset_chunk_513929 | rust_dataset.txt | 513,929 | 512 | _snapshot!(format!("{:?}", terminal_pane.grid));
terminal_pane.clear_scroll();
assert_snapshot!(format!("{:?}", terminal_pane.grid));
}
#[test]
pub fn sixel_image_inside_terminal_pane() {
let mut fake_win_size = PaneGeom::default();
fake_win_size.cols.set_inner(121);
fake_win_size.rows.set_inner(20... |
rust_dataset_chunk_513930 | rust_dataset.txt | 513,930 | 512 | the
// scrollbuffer
let mut fake_win_size = PaneGeom::default();
fake_win_size.cols.set_inner(121);
fake_win_size.rows.set_inner(20);
let pid = 1;
let style = Style::default();
let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default()));
let terminal_emulator_colors = Rc:... |
rust_dataset_chunk_513931 | rust_dataset.txt | 513,931 | 512 | Cell::new(HashMap::new()));
let character_cell_size = Rc::new(RefCell::new(Some(SizeInPixels {
width: 8,
height: 21,
})));
let debug = false;
let arrow_fonts = true;
let styled_underlines = true;
let osc8_hyperlinks = true;
let explicitly_disable_kitty_keyboard_protocol = fal... |
rust_dataset_chunk_513932 | rust_dataset.txt | 513,932 | 512 | _cell_size,
sixel_image_store,
Rc::new(RefCell::new(KittyImageStore::default())),
terminal_emulator_colors,
terminal_emulator_color_codes,
None,
None,
debug,
arrow_fonts,
styled_underlines,
osc8_hyperlinks,
explicitly_disable_kitty_... |
rust_dataset_chunk_513933 | rust_dataset.txt | 513,933 | 512 | RefCell::new(LinkHandler::new())),
character_cell_size,
sixel_image_store,
Rc::new(RefCell::new(KittyImageStore::default())),
terminal_emulator_colors,
terminal_emulator_color_codes,
None,
None,
debug,
arrow_fonts,
styled_underlines,
... |
rust_dataset_chunk_513934 | rust_dataset.txt | 513,934 | 512 | _win_size,
style,
0,
String::new(),
Rc::new(RefCell::new(LinkHandler::new())),
character_cell_size,
sixel_image_store,
Rc::new(RefCell::new(KittyImageStore::default())),
terminal_emulator_colors,
terminal_emulator_color_codes,
None,
... |
rust_dataset_chunk_513935 | rust_dataset.txt | 513,935 | 512 | = true;
let explicitly_disable_kitty_keyboard_protocol = false;
let mut terminal_pane = TerminalPane::new(
pid,
fake_win_size,
style,
0,
String::new(),
Rc::new(RefCell::new(LinkHandler::new())),
character_cell_size.clone(),
sixel_image_store,
... |
rust_dataset_chunk_513936 | rust_dataset.txt | 513,936 | 512 | ::new(RefCell::new(Palette::default()));
let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new()));
let character_cell_size = Rc::new(RefCell::new(Some(SizeInPixels {
width: 8,
height: 21,
})));
let debug = false;
let arrow_fonts = true;
let styled_underlines = tr... |
rust_dataset_chunk_513937 | rust_dataset.txt | 513,937 | 512 | _store = Rc::new(RefCell::new(SixelImageStore::default()));
let terminal_emulator_colors = Rc::new(RefCell::new(Palette::default()));
let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new()));
let character_cell_size = Rc::new(RefCell::new(Some(SizeInPixels {
width: 8,
height... |
rust_dataset_chunk_513938 | rust_dataset.txt | 513,938 | 512 | assert!(terminal_pane.position_is_on_frame(&Position::new(10, 70)));
assert!(terminal_pane.position_is_on_frame(&Position::new(10, 129)));
assert!(terminal_pane.position_is_on_frame(&Position::new(10, 130)));
assert!(!terminal_pane.position_is_on_frame(&Position::new(10, 131)));
// second row: border ... |
rust_dataset_chunk_513939 | rust_dataset.txt | 513,939 | 512 | _is_on_frame(&Position::new(30, 10)));
assert!(!terminal_pane.position_is_on_frame(&Position::new(30, 11)));
assert!(!terminal_pane.position_is_on_frame(&Position::new(30, 70)));
assert!(!terminal_pane.position_is_on_frame(&Position::new(30, 130)));
assert!(!terminal_pane.position_is_on_frame(&Position:... |
rust_dataset_chunk_513940 | rust_dataset.txt | 513,940 | 512 | new(9, 10)));
assert!(!terminal_pane.position_is_on_frame(&Position::new(9, 11)));
assert!(!terminal_pane.position_is_on_frame(&Position::new(9, 70)));
assert!(!terminal_pane.position_is_on_frame(&Position::new(9, 129)));
assert!(!terminal_pane.position_is_on_frame(&Position::new(9, 130)));
assert!(... |
rust_dataset_chunk_513941 | rust_dataset.txt | 513,941 | 512 | _is_on_frame(&Position::new(15, 130)));
assert!(!terminal_pane.position_is_on_frame(&Position::new(15, 131)));
// last row: border for 10 <= col <= 130
assert!(!terminal_pane.position_is_on_frame(&Position::new(29, 9)));
assert!(terminal_pane.position_is_on_frame(&Position::new(29, 10)));
assert!(t... |
rust_dataset_chunk_513942 | rust_dataset.txt | 513,942 | 512 | ]
pub fn bell_notification_state_set_and_cleared() {
let mut terminal_pane = make_terminal_pane_for_bell();
assert!(
!terminal_pane.get_bell_notification(),
"Initially no bell notification"
);
terminal_pane.set_bell_notification(true);
assert!(
terminal_pane.get_bell_notifi... |
rust_dataset_chunk_513943 | rust_dataset.txt | 513,943 | 512 | x1b]7;file://localhost/first\x1b\\";
terminal_pane.handle_pty_bytes(osc7_first.to_vec());
assert_eq!(terminal_pane.osc7_payload(), Some("file://localhost/first"));
let osc7_second = b"\x1b]7;file://localhost/second\x1b\\";
terminal_pane.handle_pty_bytes(osc7_second.to_vec());
assert_eq!(
te... |
rust_dataset_chunk_513944 | rust_dataset.txt | 513,944 | 512 | ]
pub fn osc7_payload_rejects_c1_control_characters() {
// C1 control characters (U+0080..U+009F) include ST (U+009C) which
// could terminate the OSC sequence in the parent terminal.
use crate::vt_parser::Handler;
let mut terminal_pane = make_terminal_pane_for_bell();
// U+009C (ST) in UTF-8 is 0x... |
rust_dataset_chunk_513945 | rust_dataset.txt | 513,945 | 512 | assert_eq!(
terminal_pane.osc7_payload(),
Some("file://localhost/a;b;c"),
"A URI containing semicolons is reassembled from the split params"
);
}
#[test]
pub fn osc7_payload_is_cleared_by_a_terminal_reset() {
let mut terminal_pane = make_terminal_pane_for_bell();
terminal_pane.... |
rust_dataset_chunk_513946 | rust_dataset.txt | 513,946 | 512 | is the pane index
terminal_pane.set_content_offset(Offset::default());
// row above pane: no border
assert!(!terminal_pane.position_is_on_frame(&Position::new(9, 9)));
assert!(!terminal_pane.position_is_on_frame(&Position::new(9, 10)));
assert!(!terminal_pane.position_is_on_frame(&Position::new(9... |
rust_dataset_chunk_513947 | rust_dataset.txt | 513,947 | 512 | 10)));
assert!(!terminal_pane.position_is_on_frame(&Position::new(15, 11)));
assert!(!terminal_pane.position_is_on_frame(&Position::new(15, 70)));
assert!(!terminal_pane.position_is_on_frame(&Position::new(15, 130)));
assert!(!terminal_pane.position_is_on_frame(&Position::new(15, 131)));
// last r... |
rust_dataset_chunk_513948 | rust_dataset.txt | 513,948 | 512 | ittyImageStore::default())),
terminal_emulator_colors,
terminal_emulator_color_codes,
None,
None,
false,
true,
true,
true,
false,
None,
)
}
fn press_key(
pane: &mut TerminalPane,
bare_key: zellij_utils::data::BareKey,
clien... |
rust_dataset_chunk_513949 | rust_dataset.txt | 513,949 | 512 | ane();
let client_id = 1;
pane.set_guest_modal(&[client_id]);
let outcome = press_key(&mut pane, BareKey::Enter, client_id);
assert!(matches!(outcome, Some(AdjustedInput::GuestModalZoom)));
pane.set_guest_modal(&[client_id]);
press_key(&mut pane, BareKey::Down, client_id);
let outcome = pr... |
rust_dataset_chunk_513950 | rust_dataset.txt | 513,950 | 512 | _guest_modal(&[client_a, client_b]);
press_key(&mut pane, BareKey::Down, client_a);
assert_eq!(pane.guest_modal_selection(client_a), Some(1));
assert_eq!(pane.guest_modal_selection(client_b), Some(0));
}
#[test]
pub fn guest_modal_no_modal_passes_input_through() {
use zellij_utils::data::BareKey;
l... |
rust_dataset_chunk_513951 | rust_dataset.txt | 513,951 | 512 | 'b' as u32);
assert!(bold.cell.has(ATTR_BOLD));
assert!(!screen.cell(5, 0).unwrap().cell.has(ATTR_BOLD));
let wide = screen.cell(5, 0).unwrap();
assert_eq!(wide.cell.ch, '中' as u32);
assert_eq!(wide.cell.width, 2);
let link = screen.cell(8, 0).unwrap();
assert_eq!(link.cell.ch, 'l' as u32);... |
rust_dataset_chunk_513952 | rust_dataset.txt | 513,952 | 512 | .terminal_characters
.iter()
.map(|character| character.character)
.collect()
}
fn chunk_width(chunk: &crate::output::CharacterChunk) -> usize {
chunk
.terminal_characters
.iter()
.map(|character| character.width())
.sum()
}
fn pinned(cols: usize, rows: usi... |
rust_dataset_chunk_513953 | rust_dataset.txt | 513,953 | 512 | pane was drawn: {}", chunk.y);
assert!(chunk.x + chunk_width(chunk) <= 10, "a chunk is too wide");
}
let first_row = chunks.iter().find(|chunk| chunk.y == 0).unwrap();
assert_eq!(chunk_text(first_row), "abcdefghij");
assert!(!chunks
.iter()
.any(|chunk| chunk_text(chunk).contain... |
rust_dataset_chunk_513954 | rust_dataset.txt | 513,954 | 512 | ));
pane.handle_pty_bytes(b"\x1b[1;16H".to_vec());
assert_eq!(Pane::cursor_coordinates(&pane, None), None);
pane.handle_pty_bytes(b"\x1b[5;2H".to_vec());
assert_eq!(Pane::cursor_coordinates(&pane, None), None);
pane.handle_pty_bytes(b"\x1b[2;3H".to_vec());
assert_eq!(Pane::cursor_coordinates(&pa... |
rust_dataset_chunk_513955 | rust_dataset.txt | 513,955 | 512 | )
}
#[test]
fn output_split_at_any_byte_renders_the_same_as_output_in_one_piece() {
let stream: &[u8] = b"\x1b[31mred\x1b[0m plain \x1b_Gi=1,a=q;AAAA\x1b\\after\x1b[1;32mgreen\x1b[m\r\n\x1b[4mund\x1b[24m end\x1b";
let mut whole = pane_for_split_test();
whole.handle_pty_bytes(stream.to_vec());
whole... |
rust_dataset_chunk_513956 | rust_dataset.txt | 513,956 | 512 | bindPresetWithError, LayoutInfo, LayoutWithError, MessageToPlugin,
OutsideClick, PermissionStatus, PermissionType, PipeMessage, PipePopupPlacement,
PipeSource, SettingKey, WebServerStatus,
},
errors::{prelude::*, ContextType, PluginContext},
input::{
actions::Action,
command:... |
rust_dataset_chunk_513957 | rust_dataset.txt | 513,957 | 512 | iledPaneLayout>,
Vec<FloatingPaneLayout>,
usize, // tab_id
Option<Vec<CommandOrPlugin>>, // initial_panes
bool, // block_on_first_terminal
bool, // should change focus to new tab
(ClientId, bool), ... |
rust_dataset_chunk_513958 | rust_dataset.txt | 513,958 | 512 | : bool,
popup_capture_all_keys: bool,
popup_outside_click: OutsideClick,
},
SetCliPipeExitCode {
pipe_id: String,
exit_code: i32,
plugin_id: PluginId,
},
PipePopupFailed {
pipe_id: String,
error: String,
},
PromptRequest {
caller: P... |
rust_dataset_chunk_513959 | rust_dataset.txt | 513,959 | 512 | ,
terminal_id: Option<u32>,
cli_client_id: Option<ClientId>,
},
LayoutListUpdate(Vec<LayoutInfo>, Vec<LayoutWithError>),
KeybindPresetListUpdate(Vec<KeybindPresetInfo>, Vec<KeybindPresetWithError>),
GlobalAttentionUpdate(zellij_utils::attention::GlobalAttention),
SessionHistoryUpdate... |
rust_dataset_chunk_513960 | rust_dataset.txt | 513,960 | 512 | Instruction::AddClient(_) => PluginContext::AddClient,
PluginInstruction::RemoveClient(_) => PluginContext::RemoveClient,
PluginInstruction::UpdatePluginTabIndices(..) => PluginContext::UpdatePluginTabIndices,
PluginInstruction::UpdateClientVisiblePlugins(..) => {
Plu... |
rust_dataset_chunk_513961 | rust_dataset.txt | 513,961 | 512 | LayoutToPlugin,
PluginInstruction::Reconfigure { .. } => PluginContext::Reconfigure,
PluginInstruction::FailedToWriteConfigToDisk { .. } => {
PluginContext::FailedToWriteConfigToDisk
},
PluginInstruction::ConfigWasWrittenToDisk => PluginContext::ConfigWasW... |
rust_dataset_chunk_513962 | rust_dataset.txt | 513,962 | 512 | layout_dir: Option<PathBuf>,
available_layouts: Vec<LayoutInfo>,
available_layout_errors: Vec<LayoutWithError>,
path_to_default_shell: PathBuf,
zellij_cwd: PathBuf,
session_env_vars: std::collections::BTreeMap<String, String>,
default_shell: Option<TerminalAction>,
plugin_aliases: PluginAli... |
rust_dataset_chunk_513963 | rust_dataset.txt | 513,963 | 512 | _plugin_id,
skip_cache,
should_focus_plugin,
floating_pane_coordinates,
completion_tx,
) => {
run_plugin_or_alias.populate_run_plugin_if_needed(&plugin_aliases);
let cwd = run_plugin_or_alias.get_initial_cwd().or... |
rust_dataset_chunk_513964 | rust_dataset.txt | 513,964 | 512 | _alias,
placement,
behavior,
width: size.cols,
height: size.rows,
anchor_pane,
}));
if !initial_events.is_empty() {
... |
rust_dataset_chunk_513965 | rust_dataset.txt | 513,965 | 512 | (err) => match err.downcast_ref::<ZellijError>() {
Some(ZellijError::PluginDoesNotExist) => {
log::warn!(
"Plugin {} not found, starting it instead",
run_plugin.location
... |
rust_dataset_chunk_513966 | rust_dataset.txt | 513,966 | 512 | initial_panes,
block_on_first_terminal,
should_change_focus_to_new_tab,
(client_id, is_web_client),
completion_tx,
) => {
// prefer connected clients so as to avoid opening plugins in the background for
... |
rust_dataset_chunk_513967 | rust_dataset.txt | 513,967 | 512 | f.run.clone())
.collect();
let mut all_run_instructions = extracted_run_instructions;
all_run_instructions.append(&mut extracted_floating_plugins);
for run_instruction in all_run_instructions {
if let Some(Run::Plugin(run_plugin_o... |
rust_dataset_chunk_513968 | rust_dataset.txt | 513,968 | 512 | _instructions =
tab_layout_info.tiled_layout.extract_run_instructions();
// Extract run instructions from floating layouts (excluding already_running)
let extracted_floating_plugins: Vec<Option<Run>> = tab_layout_info
.floating_lay... |
rust_dataset_chunk_513969 | rust_dataset.txt | 513,969 | 512 | worker_name,
messages,
) => {
wasm_bridge.post_messages_to_plugin_worker(
plugin_id,
client_id,
worker_name,
messages,
)?;
},
PluginInstruction::PostMessag... |
rust_dataset_chunk_513970 | rust_dataset.txt | 513,970 | 512 | _layout_metadata,
&wasm_bridge,
&plugin_aliases,
None,
);
drop(bus.senders.send_to_pty(PtyInstruction::DumpLayout(
session_layout_metadata,
client_id,
completion_tx,
... |
rust_dataset_chunk_513971 | rust_dataset.txt | 513,971 | 512 | _id),
);
let mut clients_metadata = session_layout_metadata.all_clients_metadata();
let mut client_list_for_plugin = vec![];
let default_editor = session_layout_metadata.default_editor.clone();
for (client_metadata_id, client_metadata) in c... |
rust_dataset_chunk_513972 | rust_dataset.txt | 513,972 | 512 | => {
match RunPluginOrAlias::from_url(
plugin_url,
&configuration,
Some(&plugin_aliases),
cwd.clone(),
) {
... |
rust_dataset_chunk_513973 | rust_dataset.txt | 513,973 | 512 | ,
exit_code,
plugin_id,
} => {
wasm_bridge.set_cli_pipe_exit_code(&pipe_id, exit_code, plugin_id);
},
PluginInstruction::PipePopupFailed { pipe_id, error } => {
wasm_bridge.fail_pipe_popup(&pipe_id, error);
}... |
rust_dataset_chunk_513974 | rust_dataset.txt | 513,974 | 512 | ,
cwd,
skip_cache,
cli_client_id,
plugin_and_client_id,
notification_end,
} => {
let should_float = floating.unwrap_or(true);
let mut pipe_messages = vec![];
let floating_pane_coor... |
rust_dataset_chunk_513975 | rust_dataset.txt | 513,975 | 512 | n| n.pane_id_to_replace);
let floating_pane_coordinates = message.floating_pane_coordinates;
match (message.plugin_url, message.destination_plugin_id) {
(Some(plugin_url), None) => {
// send to specific plugin(s)
pipe_to... |
rust_dataset_chunk_513976 | rust_dataset.txt | 513,976 | 512 | UnblockCliPipeInput(
release.pipe_id,
release.exit_code,
))
.context("failed to unblock input pipe");
}
},
PluginInstruction::Reconfigure {
client_id,
... |
rust_dataset_chunk_513977 | rust_dataset.txt | 513,977 | 512 | Instruction::ReportPluginCwd(
plugin_id,
new_host_folder,
)),
);
}
},
PluginInstruction::WebServerStarted(base_url) => {
let updates = vec![(
No... |
rust_dataset_chunk_513978 | rust_dataset.txt | 513,978 | 512 | _settings_entry(plugin_id, plugin_identity, &title);
},
PluginInstruction::UnregisterSettingsEntry(plugin_id) => {
wasm_bridge.unregister_settings_entry(plugin_id);
},
PluginInstruction::UpdateSessionSaveTime(timestamp_millis) => {
// Store... |
rust_dataset_chunk_513979 | rust_dataset.txt | 513,979 | 512 | ::remove_dir_all(&plugin_global_data_dir)
.or_else(|err| {
if err.kind() == std::io::ErrorKind::NotFound {
// I don't care...
Ok(())
} else {
Err(err)
}
})
.context("failed to cleanup plugin data directory")
}
f... |
rust_dataset_chunk_513980 | rust_dataset.txt | 513,980 | 512 | skip_cache: bool,
should_float: bool,
pane_id_to_replace: &Option<PaneId>,
pane_title: &Option<String>,
cli_client_id: Option<ClientId>,
pipe_messages: &mut Vec<(Option<PluginId>, Option<ClientId>, PipeMessage)>,
name: &str,
payload: &Option<String>,
args: &Option<BTreeMap<String, Strin... |
rust_dataset_chunk_513981 | rust_dataset.txt | 513,981 | 512 | ();
let size = Size::default();
let skip_cache = false;
let is_background = true;
match wasm_bridge.load_plugin_with_kind(
&run_plugin,
None,
size,
cwd.clone(),
skip_cache,
Some(client_id),
is_background,
) {
Ok((plugin_id, client_id)) ... |
rust_dataset_chunk_513982 | rust_dataset.txt | 513,982 | 512 | when spawning (monotonically increasing)
next_thread_idx: AtomicUsize,
// Maximum threads allowed
max_threads: usize,
// state to send to plugins (to be kept on execution threads)
senders: ThreadSenders,
plugin_map: Arc<Mutex<PluginMap>>,
connected_clients: Arc<Mutex<Vec<ClientId>>>,
... |
rust_dataset_chunk_513983 | rust_dataset.txt | 513,983 | 512 | : Engine,
) -> ExecutionThread {
let (sender, receiver) = channel::<Job>();
let jobs_in_flight = Arc::new(AtomicUsize::new(0));
let jobs_in_flight_clone = jobs_in_flight.clone();
let thread_handle = thread::Builder::new()
.name(format!("plugin-exec-{}", thread_idx))
... |
rust_dataset_chunk_513984 | rust_dataset.txt | 513,984 | 512 | }
}
}
let thread_idx = if let Some((idx, _)) = best_thread {
// Found a non-busy thread
idx
} else {
// All threads are busy - need to expand
if threads.len() < self.max_threads {
// Spawn a new thread
... |
rust_dataset_chunk_513985 | rust_dataset.txt | 513,985 | 512 | = thread_idx else {
log::error!("Failed to find thread for plugin with id: {}", plugin_id);
return;
};
// Get thread and mark as busy
let threads = self.execution_threads.lock().unwrap();
let thread = threads[thread_idx].as_ref();
let Some(thread) = thre... |
rust_dataset_chunk_513986 | rust_dataset.txt | 513,986 | 512 | Unregister plugin and potentially shrink the pool
executor.unregister_plugin(plugin_id);
},
);
}
/// Unregister a plugin and potentially shrink the pool
/// Called from wasm_bridge after plugin cleanup is complete
pub fn unregister_plugin(&self, plugin_id: u32) {
... |
rust_dataset_chunk_513987 | rust_dataset.txt | 513,987 | 512 | ::atomic::{AtomicUsize, Ordering};
use std::sync::mpsc::{channel, Sender};
use std::sync::{Arc, Barrier, Mutex};
use std::thread;
use std::time::Duration;
// Test fixtures
fn create_test_dependencies() -> (
ThreadSenders,
Arc<Mutex<PluginMap>>,
Arc<Mutex<Vec<ClientId>>>,... |
rust_dataset_chunk_513988 | rust_dataset.txt | 513,988 | 512 | {
let (senders, plugin_map, clients, cache, engine) = create_test_dependencies();
Arc::new(PinnedExecutor::new(
max_threads,
&senders,
&plugin_map,
&clients,
&cache,
&engine,
))
}
// Helper to create a job that sig... |
rust_dataset_chunk_513989 | rust_dataset.txt | 513,989 | 512 | #[test]
fn test_new_thread_spawns_when_all_busy() {
let executor = create_test_executor(3);
// Register plugin 1, gets thread 0
let thread_idx1 = executor.register_plugin(1);
assert_eq!(thread_idx1, 0);
// Make thread 0 busy with a barrier
let barrier = Arc::new(Ba... |
rust_dataset_chunk_513990 | rust_dataset.txt | 513,990 | 512 | executor.thread_count(), 2, "Should not exceed max_threads");
// Release barriers
barrier1.wait();
barrier2.wait();
}
#[test]
fn test_duplicate_registration_returns_same_thread() {
let executor = create_test_executor(4);
let thread_idx1 = executor.register_plugin(1)... |
rust_dataset_chunk_513991 | rust_dataset.txt | 513,991 | 512 | 2 to thread 1
executor.register_plugin(2);
// Release barrier
barrier.wait();
thread::sleep(Duration::from_millis(50));
// Get thread names for both plugins
let thread_name1 = get_thread_name_for_plugin(&executor, 1);
let thread_name2 = get_thread_name_for_plug... |
rust_dataset_chunk_513992 | rust_dataset.txt | 513,992 | 512 | #[test]
fn test_concurrent_jobs_on_different_threads() {
let executor = create_test_executor(3);
// Register plugin 1 to thread 0
executor.register_plugin(1);
// Make thread 0 busy to force plugin 2 to thread 1
let barrier = Arc::new(Barrier::new(2));
let barrie... |
rust_dataset_chunk_513993 | rust_dataset.txt | 513,993 | 512 | 4);
// Load plugin
let (tx_load, rx_load) = channel();
executor.execute_plugin_load(1, make_signaling_job(tx_load));
rx_load
.recv_timeout(Duration::from_secs(5))
.expect("Load should complete");
// Unload plugin with cleanup
let counter = Arc::n... |
rust_dataset_chunk_513994 | rust_dataset.txt | 513,994 | 512 | cleanup", "after"]);
}
#[test]
fn test_shrink_removes_idle_threads() {
let executor = create_test_executor(4);
// Load plugin 1 to thread 0
let (tx1, rx1) = channel();
executor.execute_plugin_load(1, make_signaling_job(tx1));
rx1.recv_timeout(Duration::from_secs(5))... |
rust_dataset_chunk_513995 | rust_dataset.txt | 513,995 | 512 | complete");
let (tx_unload, rx_unload) = channel();
executor.execute_plugin_unload(1, make_signaling_job(tx_unload));
rx_unload
.recv_timeout(Duration::from_secs(5))
.expect("Unload should complete");
// Give shrinking a moment
thread::sleep(Duration::f... |
rust_dataset_chunk_513996 | rust_dataset.txt | 513,996 | 512 | (),
"Plugin 1's thread should still work"
);
// Thread count should decrease after unloading
let thread_count_after = executor.thread_count();
assert!(
thread_count_after < thread_count_with_both,
"Idle thread should be removed"
);
ass... |
rust_dataset_chunk_513997 | rust_dataset.txt | 513,997 | 512 | 1.recv_timeout(Duration::from_secs(5))
.expect("Load should complete");
let barrier = Arc::new(Barrier::new(2));
let barrier_clone = barrier.clone();
executor.execute_for_plugin(1, move |_s, _p, _c, _ca, _e| {
barrier_clone.wait();
});
thread::sleep(Durat... |
rust_dataset_chunk_513998 | rust_dataset.txt | 513,998 | 512 | _idx1 = executor.register_plugin(1);
let thread_idx2 = executor.register_plugin(2);
let thread_idx3 = executor.register_plugin(3);
assert_eq!(thread_idx1, 0);
assert_eq!(thread_idx2, 0);
assert_eq!(thread_idx3, 0);
assert_eq!(executor.thread_count(), 1);
}
#[tes... |
rust_dataset_chunk_513999 | rust_dataset.txt | 513,999 | 512 | , rx) = channel();
// Load 5 plugins
for i in 1..=5 {
let tx_clone = tx.clone();
executor.execute_plugin_load(i, make_signaling_job(tx_clone));
}
// Wait for all loads
for _ in 0..5 {
rx.recv_timeout(Duration::from_secs(5))
.e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.