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_517400
rust_dataset.txt
517,400
512
harness.app.failure.is_some(), "closing it later is a failure" ); assert!(harness.app.closing(), "the first close request closes it"); } #[test] fn a_server_error_is_shown_in_the_window() { let mut harness = Harness::new(0, true, ""); harness.app.session_ended(Ending::Exited(ExitReason:...
rust_dataset_chunk_517401
rust_dataset.txt
517,401
512
""); harness.app.session_ended(Ending::Lost); for key in [ Key::Character(SmolStr::new("q")), Key::Named(NamedKey::Space), Key::Named(NamedKey::ArrowDown), Key::Named(NamedKey::Tab), ] { assert!(!harness.app.notice_key(&key), "{:?}", key); } assert!(harness.a...
rust_dataset_chunk_517402
rust_dataset.txt
517,402
512
#[test] fn a_connection_dropped_without_a_word_is_explained() { let mut harness = Harness::new(0, true, ""); assert!(!harness.app.session_ended(Ending::Lost)); assert!( shown(&harness).contains("closed without a reason"), "{}", shown(&harness) ); } #[test] fn a_failure_on_the_wi...
rust_dataset_chunk_517403
rust_dataset.txt
517,403
512
_some()); assert!( shown(&harness).contains("cannot read"), "{}", shown(&harness) ); assert!( !harness .app .session_ended(Ending::Exited(ExitReason::NormalDetached)), "the detach that follows must leave the message up" ); assert_eq!(ha...
rust_dataset_chunk_517404
rust_dataset.txt
517,404
512
(1)), None, "the only window on the session is the switching one" ); } #[test] fn a_handover_carries_the_pane_tab_and_history_of_the_switch() { let history = zellij_utils::session_history::SessionHistory { back: vec!["s1".to_owned()], forward: vec![], last: Some("s1".to_...
rust_dataset_chunk_517405
rust_dataset.txt
517,405
512
with Esc as before" ); } #[test] fn with_no_session_a_window_still_closes_itself() { let mut harness = Harness::new(0, true, ""); harness.app.sender = None; assert!(harness.app.closing()); assert!(harness.sent().is_empty()); } fn f11() -> Key { Key::Named(NamedKey::F11) } #[test] fn the_full...
rust_dataset_chunk_517406
rust_dataset.txt
517,406
512
assert_eq!( saved, WindowState { cols: 90, rows: 30, state: Shown::Fullscreen, } ); let startup = Startup::resolve(StartupMode::Remember, Some(saved), None, None); assert_eq!(startup.mode, StartupMode::Fullscreen); assert_eq!((startup.cols,...
rust_dataset_chunk_517407
rust_dataset.txt
517,407
512
!(harness.app.mouse.pointer_hidden); harness .app .on_wheel(MouseScrollDelta::LineDelta(0.0, 0.0), TouchPhase::Moved); assert!(!harness.app.mouse.pointer_hidden); harness.press(&f11()); assert!(harness.app.mouse.pointer_hidden); harness.app.on_focus_lost(); assert!(!harness.app.m...
rust_dataset_chunk_517408
rust_dataset.txt
517,408
512
_is_forwarded_to_the_pane() { let mut harness = Harness::new(1, true, ""); harness.press(&character("a")); assert_eq!( harness.sent(), vec![ClientToServerMsg::Key { key: zellij_utils::data::KeyWithModifier::new(zellij_utils::data::BareKey::Char('a')), raw_bytes: b"a"....
rust_dataset_chunk_517409
rust_dataset.txt
517,409
512
_is_pasted_as_its_path() { let mut harness = Harness::new(1, true, ""); harness .app .on_window_event(WindowEvent::DroppedFile("/shots/shot.png".into())); assert_eq!( harness.actions(), vec![Action::Paste { chars: "/shots/shot.png ".to_owned(), pane_id...
rust_dataset_chunk_517410
rust_dataset.txt
517,410
512
new(2, true, ""); let dir = remembering(&mut harness); harness.app.resized(720, 600); assert_eq!( harness.app.on_window_event(WindowEvent::Destroyed), Verdict::Close ); assert_eq!( remembered(&dir), Some(WindowState { cols: 90, rows: 30, ...
rust_dataset_chunk_517411
rust_dataset.txt
517,411
512
loses(Platform::MacOs, ModifiersState::SUPER, "q")); assert!(!closes(Platform::Linux, ModifiersState::SUPER, "w")); assert!(!closes(Platform::Windows, ModifiersState::SUPER, "w")); } #[test] fn a_window_already_leaving_is_not_remembered_again_when_destroyed() { let mut harness = Harness::new(2, true, ""); ...
rust_dataset_chunk_517412
rust_dataset.txt
517,412
512
.role = Role::Watcher; harness.app.settings.on_force_close = Some(OnForceClose::Quit); assert!(harness.app.close_requested()); assert!(matches!(harness.sent()[0], ClientToServerMsg::Key { .. })); } #[test] fn a_maximized_close_keeps_the_windowed_size_already_saved() { let mut harness = Harness::new(0, ...
rust_dataset_chunk_517413
rust_dataset.txt
517,413
512
state: Shown::Windowed, }), "the size a minimized window reports was remembered as its windowed size" ); } #[cfg(windows)] #[test] fn a_resize_keeps_what_a_windows_session_end_would_save_up_to_date() { let mut harness = Harness::new(2, true, ""); let dir = remembering(&mut harness); ha...
rust_dataset_chunk_517414
rust_dataset.txt
517,414
512
Harness::new(1, true, ""); let size = harness.app.state.size(); let frame = frame_with_sideband(size.rows, size.cols, 17, b""); harness.app.on_frame(&frame); assert_eq!( harness.sent(), vec![ClientToServerMsg::RenderFrameAck { seq: 17 }] ); } #[test] fn an_unreadable_frame_detaches...
rust_dataset_chunk_517415
rust_dataset.txt
517,415
512
low_reports_the_new_size_without_reshaping_the_screen_locally() { let mut harness = Harness::new(2, true, ""); let before = harness.app.state.size(); harness.app.reflow(320, 400); assert_eq!(harness.app.state.size(), before); assert_eq!( harness.sent()[0], ClientToServerMsg::Terminal...
rust_dataset_chunk_517416
rust_dataset.txt
517,416
512
on_mouse_input(MouseButton::Left, ElementState::Pressed); let events: Vec<_> = harness .actions() .into_iter() .map(|action| match action { Action::MouseEvent { event } => event, other => panic!("expected a mouse event, got {:?}", other), }) .collect()...
rust_dataset_chunk_517417
rust_dataset.txt
517,417
512
.rescale(2.0); let metrics = harness.app.metrics; harness.app.rescale(2.0); assert_eq!(harness.app.metrics, metrics); } #[test] fn a_reflow_after_a_scale_change_reports_the_scaled_cell_size() { let mut harness = Harness::new(2, true, ""); harness.app.rescale(2.0); harness.app.reflow(320, 400); ...
rust_dataset_chunk_517418
rust_dataset.txt
517,418
512
_look(&mut harness.app.options); let margins = harness.app.padding_px(); assert!(margins.left > 0 && margins.top > 0); harness.push(TerminalConfig::default()); assert_eq!(harness.app.padding_px(), margins); assert_eq!( harness.app.options.padding_color, zellij_utils::input::terminal:...
rust_dataset_chunk_517419
rust_dataset.txt
517,419
512
a_reload_that_changes_the_paste_chords_claims_the_new_one() { let mut harness = Harness::new(2, true, "copied"); harness.push(TerminalConfig { paste_keys: Some(vec![zellij_utils::data::KeyWithModifier::new( zellij_utils::data::BareKey::F(5), )]), ..TerminalConfig::default() ...
rust_dataset_chunk_517420
rust_dataset.txt
517,420
512
s.background, [2, 2, 2]); let sent = harness.sent(); assert_eq!(sent.len(), 6, "{:?}", sent); assert_eq!( sent[1], ClientToServerMsg::BackgroundColor { color: crate::emulation::palette::xparse_color([1, 1, 1]) } ); assert_eq!( sent[4], ClientToSer...
rust_dataset_chunk_517421
rust_dataset.txt
517,421
512
_reload_that_changes_the_opacity_reaches_the_scene_on_the_next_frame() { use zellij_utils::input::terminal::OpacityMode; let mut harness = Harness::new(0, true, ""); let before = harness.app.metrics; harness.app.refresh_scene(); let identity = harness.app.retained.identity(); harness.app.refresh...
rust_dataset_chunk_517422
rust_dataset.txt
517,422
512
inalConfig { opacity: Some(0.9), ..TerminalConfig::default() }); assert!(harness.app.see_through()); harness.push(TerminalConfig { opacity: Some(1.0), blur: Some(true), ..TerminalConfig::default() }); assert!( !harness.app.see_through(), "a bl...
rust_dataset_chunk_517423
rust_dataset.txt
517,423
512
::empty()), None); } #[test] fn only_macos_requires_a_transparent_config() { assert!( !requires_transparent_configs(Platform::Windows), "a driver that honors WGL_TRANSPARENT_ARB would offer no config at all" ); assert!( !requires_transparent_configs(Platform::Linux), "an X11...
rust_dataset_chunk_517424
rust_dataset.txt
517,424
512
.app.metrics.height > plain.height, "zooming in did not grow the cell" ); assert_eq!( harness.app.options.font.size, DEFAULT_FONT_SIZE, "the zoom must never be written back into the resolved size" ); harness.press(&character("-")); assert!((harness.app.zoom - 1.0).abs() < 1e...
rust_dataset_chunk_517425
rust_dataset.txt
517,425
512
("=")); let zoomed = harness.app.metrics; harness.push(TerminalConfig { blur: Some(true), ..TerminalConfig::default() }); assert_eq!(harness.app.zoom, 1.1); assert_eq!(harness.app.metrics, zoomed); assert!( harness.app.options.blur, "the pushed change was not ap...
rust_dataset_chunk_517426
rust_dataset.txt
517,426
512
_a_link_under_the_pointer(harness: &mut Harness, uri: &str) { crate::testing::painter::Painter::apply(&mut harness.app.state, |painter| { painter.links(&[(1, uri)]); painter.linked(0, 0, "link", 1); }); harness.app.on_cursor_moved(PhysicalPosition::new(4.0, 4.0)); } fn left_click(harness: &...
rust_dataset_chunk_517427
rust_dataset.txt
517,427
512
example.com"); harness .app .on_mouse_input(MouseButton::Left, ElementState::Pressed); assert_eq!( harness .app .mouse .armed_link .as_ref() .map(|armed| armed.uri.as_str()), Some("https://example.com") ); assert...
rust_dataset_chunk_517428
rust_dataset.txt
517,428
512
::launch::forget_opened(); let mut harness = Harness::new(3, true, ""); with_a_link_under_the_pointer(&mut harness, "https://example.com"); harness .app .on_cursor_moved(PhysicalPosition::new(455.0, 4.0)); assert!(harness.app.mouse.hovered_link.is_none()); harness .app ...
rust_dataset_chunk_517429
rust_dataset.txt
517,429
512
harness.push(TerminalConfig { open_links: Some(false), ..TerminalConfig::default() }); assert_eq!(harness.app.pointer_shape(), CursorIcon::Text); } #[test] fn the_hover_run_follows_the_pointer_across_a_link_boundary() { let mut harness = Harness::new(2, true, ""); with_a_link_under_...
rust_dataset_chunk_517430
rust_dataset.txt
517,430
512
_shift_click_on_a_link_opens_it_and_reaches_the_session_when_selecting_is_off() { links::launch::forget_opened(); let mut harness = Harness::new(3, true, ""); harness.push(TerminalConfig { shift_drag_selects: Some(false), ..TerminalConfig::default() }); with_a_link_under_the_pointer(...
rust_dataset_chunk_517431
rust_dataset.txt
517,431
512
_mouse_input(MouseButton::Left, ElementState::Released); harness.app.modifiers = ModifiersState::empty(); } fn copy_key(harness: &mut Harness) { harness.app.modifiers = ModifiersState::CONTROL | ModifiersState::SHIFT; harness.press(&character("C")); harness.app.modifiers = ModifiersState::empty(); } #...
rust_dataset_chunk_517432
rust_dataset.txt
517,432
512
with_an_interface_on_screen(&mut harness); shift_drag(&mut harness, (0, 0), (1, 3)); harness.press(&character("a")); assert_eq!(harness.app.mouse.selection, None); copy_key(&mut harness); assert_eq!(harness.clipboard_text(), None); } #[test] fn a_frame_drawn_under_the_selection_leaves_it_in_place(...
rust_dataset_chunk_517433
rust_dataset.txt
517,433
512
_on_screen(harness); shift_drag(harness, (0, 0), (1, 3)); assert!(harness.app.mouse.selection.is_some()); } #[test] fn scrolling_clears_the_selection() { let mut harness = Harness::new(0, true, ""); with_a_selection(&mut harness); harness .app .on_wheel(MouseScrollDelta::LineDelta(0...
rust_dataset_chunk_517434
rust_dataset.txt
517,434
512
fn text_from_the_input_method_clears_the_selection() { let mut harness = Harness::new(0, true, ""); with_a_selection(&mut harness); harness.app.on_ime(Ime::Preedit(String::new(), None)); assert!( harness.app.mouse.selection.is_some(), "a composition in progress types nothing yet" ); ...
rust_dataset_chunk_517435
rust_dataset.txt
517,435
512
!(!harness.app.mouse.selecting); } fn with_a_link_in_a_pane_watching_the_mouse(harness: &mut Harness) { use zellij_utils::structured_render::{ GeometryRecord, PaneRect, PANE_FOCUSED, PANE_SELECTABLE, PANE_WANTS_MOUSE, }; crate::testing::painter::Painter::apply(&mut harness.app.state, |painter| { ...
rust_dataset_chunk_517436
rust_dataset.txt
517,436
512
, }; crate::testing::painter::Painter::apply(&mut harness.app.state, |painter| { painter.geometry(&GeometryRecord { panes: vec![ PaneRect { x: 0, y: 0, cols: 120, rows: 40, top...
rust_dataset_chunk_517437
rust_dataset.txt
517,437
512
State::Pressed); assert!( harness.app.mouse.armed_link.is_some(), "until it moves, the press may still be a click" ); let away = over_cell(&harness, 0, 9); harness.app.on_cursor_moved(away); assert!(harness.app.mouse.armed_link.is_none()); harness .app .on_mouse_i...
rust_dataset_chunk_517438
rust_dataset.txt
517,438
512
be swallowed with it" ); } #[test] fn a_middle_click_over_a_popup_reaches_the_popup_instead_of_pasting() { let mut harness = Harness::new(3, true, ""); harness.set_primary("selected"); with_a_link_under_a_popup(&mut harness); harness .app .on_mouse_input(MouseButton::Middle, Elemen...
rust_dataset_chunk_517439
rust_dataset.txt
517,439
512
, true, ""); harness.set_primary("selected"); harness .app .on_mouse_input(MouseButton::Middle, ElementState::Pressed); harness.app.on_focus_lost(); assert_eq!( harness.actions().len(), 1, "losing focus released a button the session was never told was pressed" ...
rust_dataset_chunk_517440
rust_dataset.txt
517,440
512
() { let mut harness = Harness::new(2, true, ""); harness .app .on_mouse_input(MouseButton::Left, ElementState::Pressed); harness.app.on_focus_lost(); match &harness.actions()[1] { Action::MouseEvent { event } => { assert_eq!(event.event_type, MouseEventType::Release)...
rust_dataset_chunk_517441
rust_dataset.txt
517,441
512
test] fn a_single_character_commit_is_a_key_press_so_keybindings_see_it() { let mut harness = Harness::new(1, true, ""); harness.app.on_ime(Ime::Preedit(String::new(), None)); harness.app.on_ime(Ime::Commit("t".to_owned())); assert_eq!( harness.sent(), vec![Cl...
rust_dataset_chunk_517442
rust_dataset.txt
517,442
512
); match &sent[0] { ClientToServerMsg::Key { key, raw_bytes, .. } => { assert_eq!(*key, KeyWithModifier::new(BareKey::Char('à'))); assert_eq!(raw_bytes, "à".as_bytes()); }, other => panic!("expected a key, got {:?}", other), } } ...
rust_dataset_chunk_517443
rust_dataset.txt
517,443
512
('^')); press_with_text(&mut harness, Key::Named(NamedKey::Space), "^"); assert_eq!(harness.app.ime.composition.shown(), None); assert_eq!(harness.app.ime.composition.gate(), Gate::Open); assert_eq!(harness.sent(), vec![typed_key('^')]); } #[test] fn a_dead_key_pressed_twice...
rust_dataset_chunk_517444
rust_dataset.txt
517,444
512
_dead_key_still_reaches_the_pane_as_a_shortcut() { let mut harness = Harness::new(1, true, ""); harness.press(&dead('^')); harness.app.modifiers = ModifiersState::CONTROL; press_with_text(&mut harness, character("c"), "^c"); match &harness.sent()[0] { ClientToServerMs...
rust_dataset_chunk_517445
rust_dataset.txt
517,445
512
_for_the_next_key_keeps_the_accent() { let mut harness = Harness::new(1, true, ""); harness.press(&dead('^')); for named in [ NamedKey::AltGraph, NamedKey::AltGraph, NamedKey::Control, NamedKey::AltGraph, ] { harness.press(&Key:...
rust_dataset_chunk_517446
rust_dataset.txt
517,446
512
typed_key('ê')); } #[test] fn losing_focus_mid_composition_leaves_no_residue() { let mut harness = Harness::new(0, true, ""); harness.app.on_ime(preedit("ni")); harness.press(&dead('`')); harness.app.stop_composing(); harness.app.on_focus_lost(); assert_eq!(...
rust_dataset_chunk_517447
rust_dataset.txt
517,447
512
.size(); let frame = painter::Painter::frame(size.rows, size.cols, paint); harness.app.on_frame(&frame); } #[test] fn a_frame_damages_the_rows_it_writes_and_nothing_else() { let mut harness = Harness::new(4, true, ""); let _ = rebuilt(&mut harness); painted(&mut harn...
rust_dataset_chunk_517448
rust_dataset.txt
517,448
512
); }); let _ = rebuilt(&mut harness); harness .app .on_ime(Ime::Preedit("ni".to_owned(), Some((2, 2)))); assert_eq!(rebuilt(&mut harness), (false, vec![0])); } #[test] fn a_composition_that_ends_damages_the_row_it_was_drawn_on() { let mut harn...
rust_dataset_chunk_517449
rust_dataset.txt
517,449
512
: preedit.as_ref(), }, cache, ); retained.rebuilt_rows().to_vec() } #[test] fn frames_applied_between_two_draws_are_coalesced_into_a_single_draw() { let mut harness = Harness::new(3, true, ""); let _ = rebuilt_rows(&mut harness); let drawn = I...
rust_dataset_chunk_517450
rust_dataset.txt
517,450
512
, ""); assert_eq!( harness.app.timing.pacer.interval(), crate::render::pacing::interval_of(Some(60_000)) ); } } mod smooth_scrolling { use super::*; use zellij_utils::structured_render::{ FrameBuilder, GeometryRecord, PaneRect, ScrollEntry, ScrollRecord, Wire...
rust_dataset_chunk_517451
rust_dataset.txt
517,451
512
Decision::At(start + harness.app.timing.pacer.interval()), "a running slide must ask for the next refresh" ); let after = start + Duration::from_millis(500); harness.app.advance_scroll_animations(after); assert!(!harness.app.scroll.is_active()); harness.app.timing.p...
rust_dataset_chunk_517452
rust_dataset.txt
517,452
512
3); harness.push(TerminalConfig::default()); assert!(!harness.app.scroll.is_active()); harness.app.on_frame(&frame(3, false, 95, Some(2))); assert!(harness.app.scroll.is_active()); harness.app.theme_mode = Some(HostTerminalThemeMode::Dark); harness.app.reapply(false); ...
rust_dataset_chunk_517453
rust_dataset.txt
517,453
512
harness: Harness, seq: u64, start: Instant, } impl Fling { fn offline(wayland: bool) -> Self { Self::new(0, wayland, false) } fn wired(expected: usize, wayland: bool) -> Self { Self::new(expected, wayland, true) } fn new(...
rust_dataset_chunk_517454
rust_dataset.txt
517,454
512
mut self, why: &str) { assert!(!self.coasting(), "{}", why); assert!(self.tick(400).is_empty(), "{}", why); assert!(self.tick(2000).is_empty(), "{}", why); } } #[test] fn a_fast_swipe_through_scrollback_keeps_scrolling_after_the_lift() { let mut fling = F...
rust_dataset_chunk_517455
rust_dataset.txt
517,455
512
} #[test] fn a_slow_swipe_or_a_bare_lift_starts_nothing() { let mut fling = Fling::offline(true); fling.swipe(3.0, true); assert!(!fling.coasting()); let mut fling = Fling::offline(true); fling.frame(false, &[(0, 2)]); fling.wheel(pixels(0.0), TouchPhase::Ended...
rust_dataset_chunk_517456
rust_dataset.txt
517,456
512
(0.0), TouchPhase::Started, 80)), ), ( "fingers moving", Box::new(|f: &mut Fling| f.wheel(pixels(1.0), TouchPhase::Moved, 80)), ), ( "a mouse wheel", Box::new(|f: &mut Fling| { f.wheel(Mou...
rust_dataset_chunk_517457
rust_dataset.txt
517,457
512
inalConfig::default())), ), ( "a session switch", Box::new(|f: &mut Fling| { f.harness.app.follow(None, None); }), ), ( "the pointer moving to another pane", Box::new(|f: &...
rust_dataset_chunk_517458
rust_dataset.txt
517,458
512
0, true); let interval = fling.harness.app.timing.pacer.interval(); let now = fling.start + ms(80); fling.harness.app.timing.pacer.drawn(now); assert_eq!( fling.harness.app.advance_momentum(now), Some(now + interval) ); assert_eq!( flin...
rust_dataset_chunk_517459
rust_dataset.txt
517,459
512
, true, false); assert_eq!(sent, expected); } #[test] fn away_from_wayland_the_same_swipe_sends_exactly_what_it_did_before() { let (sent, expected) = run(false, true, true); assert_eq!(sent, expected); let mut fling = Fling::offline(false); fling.swipe(40.0, true); ...
rust_dataset_chunk_517460
rust_dataset.txt
517,460
512
seat: Option<WlSeat>, } fn surface_of(connection: &Connection, window: &Window) -> Option<WlSurface> { let handle = window.window_handle().ok()?.as_raw(); let RawWindowHandle::Wayland(handle) = handle else { return None; }; let id = unsafe { ObjectId::from_ptr(WlSurface::interface(), handle.su...
rust_dataset_chunk_517461
rust_dataset.txt
517,461
512
); } token.set_surface(&surface); token.set_app_id(crate::window::application_id().to_owned()); token.commit(); let deadline = Instant::now() + TOKEN_WAIT; while self.state.token.is_none() && Instant::now() < deadline { if self.queue.roundtrip(&mut self.state)...
rust_dataset_chunk_517462
rust_dataset.txt
517,462
512
: &mut Self, _: &WlPointer, event: wl_pointer::Event, _: &(), _: &Connection, _: &QueueHandle<Self>, ) { if let wl_pointer::Event::Button { serial, state: WEnum::Value(wl_pointer::ButtonState::Pressed), .. } = event ...
rust_dataset_chunk_517463
rust_dataset.txt
517,463
512
combined with the //! [`register_worker!`](register_worker) macro to register them //! //! ### Full Example and Development Environment //! For a working plugin example as well as a development environment, please see: //! [https://github.com/zellij-org/rust-plugin-example](https://github.com/zellij-org/rust-plugin-ex...
rust_dataset_chunk_517464
rust_dataset.txt
517,464
512
, rows: usize, cols: usize) {} } #[allow(unused_variables)] pub trait ZellijSharedPlugin: Default { fn load(&mut self, configuration: BTreeMap<String, String>) {} fn slot_added(&mut self, slot: Slot) {} fn slot_removed(&mut self, slot_id: SlotId) {} fn client_connected(&mut self, client_id: ClientId) {...
rust_dataset_chunk_517465
rust_dataset.txt
517,465
512
load /// Implement this trait on a struct (typically representing the worker state) and register it with /// the [`register_worker!`](register_worker) macro. /// /// ## Sending messages to workers and back to the plugin /// Send messages to workers with the [`post_message_to`](shim::post_message_to) method. /// Send m...
rust_dataset_chunk_517466
rust_dataset.txt
517,466
512
TryFrom; use std::convert::TryInto; use zellij_tile::shim::plugin_api::action::ProtobufPluginConfiguration; use zellij_tile::shim::prost::Message; let protobuf_bytes: Vec<u8> = $crate::shim::object_from_stdin().unwrap(); let protobuf_config...
rust_dataset_chunk_517467
rust_dataset.txt
517,467
512
fn on_message(&mut self, message: String, payload: String) { /// // ... /// } /// } /// /// register_worker!( /// FileSearchWorker, /// file_search_worker, // registers the worker as the namespace "file_search" /// FILE_SEARCH_WORKER // expanded to a static variable in which the worker state i...
rust_dataset_chunk_517468
rust_dataset.txt
517,468
512
().unwrap(); let protobuf_configuration: ProtobufPluginConfiguration = ProtobufPluginConfiguration::decode(protobuf_bytes.as_slice()).unwrap(); let plugin_configuration: BTreeMap<String, String> = BTreeMap::try_from(&protobuf_configuration).unwrap(...
rust_dataset_chunk_517469
rust_dataset.txt
517,469
512
] pub fn slot_added() { let slot = $crate::read_shared_slot(); STATE.with(|state| { <$t as $crate::ZellijSharedPlugin>::slot_added(&mut *state.borrow_mut(), slot); }); } #[no_mangle] pub fn slot_removed(slot_id: i32) { STAT...
rust_dataset_chunk_517470
rust_dataset.txt
517,470
512
::session_history::SwitchContext; pub use zellij_utils::session_history::{SessionArrival, SessionHistoryInfo}; --- FILE: zellij/zellij-tile/src/shim.rs --- use serde::{de::DeserializeOwned, Serialize}; use std::collections::{BTreeMap, HashSet}; use std::{ io, path::{Path, PathBuf}, }; use zellij_utils::data::...
rust_dataset_chunk_517471
rust_dataset.txt
517,471
512
IdResponse, ProtobufOpenCommandPaneInPlaceOfPluginResponse, ProtobufOpenCommandPaneInPlaceResponse, ProtobufOpenCommandPaneNearPluginResponse, ProtobufOpenCommandPaneResponse, ProtobufOpenEditPaneInPlaceOfPaneIdResponse, ProtobufOpenFileFloatingNearPluginResponse, ProtobufOpenFileFloatingResponse, Proto...
rust_dataset_chunk_517472
rust_dataset.txt
517,472
512
.encode_to_vec()); unsafe { host_run_plugin_command() }; } // Plugin Settings /// Sets the plugin as selectable or unselectable to the user. Unselectable plugins might be desired when they do not accept user input. pub fn set_selectable(selectable: bool) { let plugin_command = PluginCommand::SetSelectable(sel...
rust_dataset_chunk_517473
rust_dataset.txt
517,473
512
PermissionType]) { let plugin_command = PluginCommand::RequestPluginPermissions(permissions.into()); let protobuf_plugin_command: ProtobufPluginCommand = plugin_command.try_into().unwrap(); object_to_stdout(&protobuf_plugin_command.encode_to_vec()); unsafe { host_run_plugin_command() }; } // Query Func...
rust_dataset_chunk_517474
rust_dataset.txt
517,474
512
str) -> Result<String, String> { // Create the plugin command with the layout name let plugin_command = PluginCommand::DumpLayout(layout_name.to_string()); // Convert to protobuf and encode let protobuf_plugin_command: ProtobufPluginCommand = plugin_command.try_into().unwrap(); object_to_stdout(&pr...
rust_dataset_chunk_517475
rust_dataset.txt
517,475
512
EnvironmentVariablesResponse::decode( bytes_from_stdin().unwrap().as_slice(), ) .unwrap(); response .env_vars .into_iter() .map(|env_var| (env_var.name, env_var.value)) .collect() } /// Returns the focused pane ID and tab index for the client associated with this pl...
rust_dataset_chunk_517476
rust_dataset.txt
517,476
512
/// println!("Pane position: ({}, {})", info.pane_x, info.pane_y); /// }, /// None => println!("Pane not found"), /// } /// ``` pub fn get_pane_info(pane_id: PaneId) -> Option<PaneInfo> { let plugin_command = PluginCommand::GetPaneInfo(pane_id); let protobuf_plugin_command: ProtobufPluginCommand...
rust_dataset_chunk_517477
rust_dataset.txt
517,477
512
_tab_info| pb_tab_info.try_into().ok()) } /// Save the current session state to disk immediately. /// /// This triggers an immediate write of the current session metadata and layout /// to the session cache directory (~/.cache/zellij/contract_version_1/session_info/<session_name>/). /// /// # Returns /// /// - `Ok(())...
rust_dataset_chunk_517478
rust_dataset.txt
517,478
512
(); object_to_stdout(&protobuf_plugin_command.encode_to_vec()); unsafe { host_run_plugin_command() }; let protobuf_response = ProtobufCurrentSessionLastSavedTimeResponse::decode(bytes_from_stdin().unwrap().as_slice()) .unwrap(); protobuf_response.timestamp_millis } // Host Functio...
rust_dataset_chunk_517479
rust_dataset.txt
517,479
512
InPlaceResponse::decode(bytes_from_stdin().unwrap().as_slice()).unwrap(); OpenFileInPlaceResponse::try_from(response).unwrap() } /// Open a file in the user's default `$EDITOR` in a new pane near th eplugin pub fn open_file_near_plugin( file_to_open: FileToOpen, context: BTreeMap<String, String>, ) -> Opti...
rust_dataset_chunk_517480
rust_dataset.txt
517,480
512
FileInPlaceOfPluginResponse::try_from(response).unwrap() } /// Open a new terminal pane to the specified location on the host filesystem pub fn open_terminal<P: AsRef<Path>>(path: P) -> Option<PaneId> { let file_to_open = FileToOpen::new(path.as_ref().to_path_buf()); let plugin_command = PluginCommand::OpenTerm...
rust_dataset_chunk_517481
rust_dataset.txt
517,481
512
terminal pane to the specified location on the host filesystem /// This variant is identical to open_terminal_floating, except it opens it near the plugin regardless of /// whether the user was focused on it or not pub fn open_terminal_floating_near_plugin<P: AsRef<Path>>( path: P, coordinates: Option<Floating...
rust_dataset_chunk_517482
rust_dataset.txt
517,482
512
OpenTerminalInPlaceOfPluginResponse::decode(bytes_from_stdin().unwrap().as_slice()) .unwrap(); OpenTerminalInPlaceOfPluginResponse::try_from(response).unwrap() } /// Open a new command pane with the specified command and args (this sort of pane allows the user to control the command, re-run it and see ...
rust_dataset_chunk_517483
rust_dataset.txt
517,483
512
Command::OpenCommandPaneFloating(command_to_run, coordinates, context); let protobuf_plugin_command: ProtobufPluginCommand = plugin_command.try_into().unwrap(); object_to_stdout(&protobuf_plugin_command.encode_to_vec()); unsafe { host_run_plugin_command() }; let response = ProtobufOpenCommandPa...
rust_dataset_chunk_517484
rust_dataset.txt
517,484
512
Open a new in place command pane with the specified command and args (this sort of pane allows the user to control the command, re-run it and see its exit status through the Zellij UI). /// This variant is the same as open_command_pane_in_place, except that it always replaces the /// plugin pane rather than whichever ...
rust_dataset_chunk_517485
rust_dataset.txt
517,485
512
(); OpenCommandPaneInPlaceOfPaneIdResponse::try_from(response).unwrap() } /// Opens a terminal pane in place of the pane identified by `pane_id`. /// Unlike `open_terminal_in_place`, this targets an arbitrary pane by ID rather than the /// focused pane, and does not change focus. If `close_replaced_pane` is false,...
rust_dataset_chunk_517486
rust_dataset.txt
517,486
512
file_to_open, close_replaced_pane, context, ); let protobuf_plugin_command: ProtobufPluginCommand = plugin_command.try_into().unwrap(); object_to_stdout(&protobuf_plugin_command.encode_to_vec()); unsafe { host_run_plugin_command() }; let response = ProtobufOpenEditPaneInPla...
rust_dataset_chunk_517487
rust_dataset.txt
517,487
512
PluginCommand::ExecCmd(cmd.iter().cloned().map(|s| s.to_owned()).collect()); let protobuf_plugin_command: ProtobufPluginCommand = plugin_command.try_into().unwrap(); object_to_stdout(&protobuf_plugin_command.encode_to_vec()); unsafe { host_run_plugin_command() }; } /// Run this command in the backg...
rust_dataset_chunk_517488
rust_dataset.txt
517,488
512
_to_stdout(&protobuf_plugin_command.encode_to_vec()); unsafe { host_run_plugin_command() }; } /// Hide the plugin pane (suppress it) from the UI pub fn open_context_menu(target: ContextMenuTarget, line: usize, column: usize) { let plugin_command = PluginCommand::OpenContextMenu { target, line, ...
rust_dataset_chunk_517489
rust_dataset.txt
517,489
512
() }; } pub fn get_session_suggestions(limit: usize) { run_plugin_command(PluginCommand::GetSessionSuggestions { limit }); } pub fn set_popup_focused(focused: bool) { run_plugin_command(PluginCommand::SetPopupFocused(focused)); } pub fn popup_to_floating_pane(coordinates: Option<FloatingPaneCoordinates>) { ...
rust_dataset_chunk_517490
rust_dataset.txt
517,490
512
, new_window: bool) { run_plugin_command(PluginCommand::OpenSessionTerminal( SessionTerminalRequest::existing(session_name, None, new_window), )); } pub fn open_session_pane_terminal(session_name: &str, pane_id: PaneId, new_window: bool) { run_plugin_command(PluginCommand::OpenSessionTerminal( ...
rust_dataset_chunk_517491
rust_dataset.txt
517,491
512
_command(PluginCommand::SetLiveView(view)); } pub fn set_live_view_input(capture: bool) { run_plugin_command(PluginCommand::SetLiveViewInput(capture)); } pub fn get_saved_session_preview(name: &str) { run_plugin_command(PluginCommand::GetSavedSessionPreview(name.to_owned())); } pub fn request_desktop_integra...
rust_dataset_chunk_517492
rust_dataset.txt
517,492
512
let plugin_command = PluginCommand::ShowPaneWithId(pane_id, should_float_if_hidden, should_focus_pane); let protobuf_plugin_command: ProtobufPluginCommand = plugin_command.try_into().unwrap(); object_to_stdout(&protobuf_plugin_command.encode_to_vec()); unsafe { host_run_plugin_command() }; } /// C...
rust_dataset_chunk_517493
rust_dataset.txt
517,493
512
tab with the default layout pub fn new_tab<S: AsRef<str>>(name: Option<S>, cwd: Option<S>) -> Option<usize> where S: ToString, { let name = name.map(|s| s.to_string()); let cwd = cwd.map(|s| s.to_string()); let plugin_command = PluginCommand::NewTab { name, cwd }; let protobuf_plugin_command: Proto...
rust_dataset_chunk_517494
rust_dataset.txt
517,494
512
let plugin_command = PluginCommand::OpenCommandPaneInNewTab(command_to_run, context); let protobuf_plugin_command: ProtobufPluginCommand = plugin_command.try_into().unwrap(); object_to_stdout(&protobuf_plugin_command.encode_to_vec()); unsafe { host_run_plugin_command() }; let response = Pro...
rust_dataset_chunk_517495
rust_dataset.txt
517,495
512
OpenPluginPaneFloatingResponse::decode(bytes_from_stdin().unwrap().as_slice()) .unwrap(); OpenPluginPaneFloatingResponse::try_from(response).unwrap() } /// Opens a new tab with an editor pane for `file_to_open`. /// Returns `(tab_id, pane_id)` of the created tab and pane. pub fn open_editor_pane_in_new...
rust_dataset_chunk_517496
rust_dataset.txt
517,496
512
}; } /// Either Increase or Decrease the size of the focused pane pub fn resize_focused_pane(resize: Resize) { let plugin_command = PluginCommand::Resize(resize); let protobuf_plugin_command: ProtobufPluginCommand = plugin_command.try_into().unwrap(); object_to_stdout(&protobuf_plugin_command.encode_to_ve...
rust_dataset_chunk_517497
rust_dataset.txt
517,497
512
of the screen, the next tab is focused (next if right edge, previous if left edge). pub fn move_focus_or_tab(direction: Direction) { let plugin_command = PluginCommand::MoveFocusOrTab(direction); let protobuf_plugin_command: ProtobufPluginCommand = plugin_command.try_into().unwrap(); object_to_stdout(&prot...
rust_dataset_chunk_517498
rust_dataset.txt
517,498
512
; let protobuf_plugin_command: ProtobufPluginCommand = plugin_command.try_into().unwrap(); object_to_stdout(&protobuf_plugin_command.encode_to_vec()); unsafe { host_run_plugin_command() }; } /// Switch the position of the focused pane with a different pane pub fn move_pane() { let plugin_command = Plug...
rust_dataset_chunk_517499
rust_dataset.txt
517,499
512
_command = PluginCommand::ScrollToBottom; let protobuf_plugin_command: ProtobufPluginCommand = plugin_command.try_into().unwrap(); object_to_stdout(&protobuf_plugin_command.encode_to_vec()); unsafe { host_run_plugin_command() }; } /// Scroll the focused pane up one page pub fn page_scroll_up() { let pl...