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_513000
rust_dataset.txt
513,000
512
.presses.remove(&client_id); } pub fn forget_client(&mut self, client_id: ClientId) { self.gestures.remove(&client_id); self.presses.remove(&client_id); } pub fn key_pressed(&mut self, client_id: ClientId, key: &KeyWithModifier) -> bool { if self.gestures.contains_key(&client_i...
rust_dataset_chunk_513001
rust_dataset.txt
513,001
512
: None, state: MirrorState::NoTarget, input_captured: false, input_released_by, resize_allowed: false, view_only, pinned: false, source_size: None, } } pub fn into_event(self, release_key: String) -> Event { Eve...
rust_dataset_chunk_513002
rust_dataset.txt
513,002
512
(), view_only: self.view.is_view_only(), pinned: self.view.is_pinned(), source_size: self.view.source_size(), } } pub fn report_if_changed(&mut self) -> Option<LiveViewReport> { let report = self.report(); if !self.force_report && self.reported.as_ref...
rust_dataset_chunk_513003
rust_dataset.txt
513,003
512
{ return vec![]; } let handler_id = link_handler.map(|handler| Rc::as_ptr(handler) as usize); if handler_id != self.links_of { self.links.clear(); self.links_of = handler_id; } let links = &mut self.links; let mut link_for = |uri: &str...
rust_dataset_chunk_513004
rust_dataset.txt
513,004
512
_up || event.wheel_down; if self.view.wants_mouse() { let mut shifted = *event; shifted.position = zellij_utils::position::Position::new( (event.position.line() + self.drawn_offset as isize) as i32, event.position.column() as u16, ); ...
rust_dataset_chunk_513005
rust_dataset.txt
513,005
512
fn type_key() -> KeyWithModifier { KeyWithModifier::new(BareKey::Enter).with_alt_modifier() } pub fn parse_release_key(release_key: Option<&str>) -> Option<(LiveViewReleaseGesture, String)> { let text = release_key.map(str::trim).filter(|text| !text.is_empty())?; match LiveViewReleaseGesture::parse(text) ...
rust_dataset_chunk_513006
rust_dataset.txt
513,006
512
get_mut(&mut self, key: &LiveViewKey) -> Option<&mut LiveViewSlot> { self.views.get_mut(key) } pub fn insert(&mut self, key: LiveViewKey, slot: LiveViewSlot) -> Option<LiveViewSlot> { self.views.insert(key, slot) } pub fn remove(&mut self, key: &LiveViewKey) -> Option<LiveViewSlot> { ...
rust_dataset_chunk_513007
rust_dataset.txt
513,007
512
(|(_, slot)| slot.view.view_id() == view_id) .map(|(key, _)| *key) } pub fn keys_of_plugin(&self, plugin_pane_id: u32) -> Vec<LiveViewKey> { self.views .keys() .filter(|(pane, _)| *pane == plugin_pane_id) .copied() .collect() } pub fn...
rust_dataset_chunk_513008
rust_dataset.txt
513,008
512
_mut(&key) { if !slot.input_captured { slot.capture(); } } Ok(()) } pub fn release(&mut self, key: &LiveViewKey, reason: LiveViewRelease) -> bool { self.cut_drag_of_view(key); if let Ok(mut captures) = self.captures.lock() { ca...
rust_dataset_chunk_513009
rust_dataset.txt
513,009
512
usize, usize, bool, String)> { self.views .get(&(plugin_pane_id, client_id)) .filter(|slot| slot.input_captured) .map(|slot| slot.cursor(content)) } pub fn announce_captures(&mut self) { let changes = self.capture_changes(); if changes.is_empty() { ...
rust_dataset_chunk_513010
rust_dataset.txt
513,010
512
.get(client_id) != release_keys.get(client_id) { slot.force_report(); } } self.reported_release_keys = release_keys; } } #[cfg(test)] #[path = "./unit/live_view_tests.rs"] mod live_view_tests; --- FILE: zellij/zellij-server/src/pane_mirror/mod.rs --- pub mod cells; pub...
rust_dataset_chunk_513011
rust_dataset.txt
513,011
512
Message(message)).is_ok() } pub fn close(&self, reason: MirrorClosedReason) { let _ = self .sender .send(MirrorOutgoing::Message(SourceMessage::closed(reason))); } pub fn finish(&self) { let _ = self.sender.send(MirrorOutgoing::Finish); } } fn reply_now(sende...
rust_dataset_chunk_513012
rust_dataset.txt
513,012
512
::Rejected), ); return; } let Some(senders) = senders_when_ready(&session_data) else { reply_now( &mut sender, SourceMessage::closed(MirrorClosedReason::SessionEnding), ); return; }; let subscriber_id = NEXT_MIRROR_SUBSCRIBER_ID.fetch_add(1...
rust_dataset_chunk_513013
rust_dataset.txt
513,013
512
{ undecodable += 1; if undecodable >= MAX_CONSECUTIVE_UNDECODABLE { break; } }, Err(IpcReceiveError::Disconnected) => break, } } let _ = senders.send_to_screen(ScreenInstruction::MirrorDetach { subscriber_id });...
rust_dataset_chunk_513014
rust_dataset.txt
513,014
512
' as u32, fg: WireColor::Rgb(10, 20, 30).pack(), bg: WireColor::Indexed(200).pack(), underline_color: WireColor::Named(1).pack(), attrs: ATTR_BOLD | ATTR_ITALIC | ATTR_REVERSE | (UNDERLINE_CURLY << UNDERLINE_SHIFT), width: 1, link: LINK_NONE, }; let styles = cell_...
rust_dataset_chunk_513015
rust_dataset.txt
513,015
512
::Named(index as u8).pack()), AnsiCode::NamedColor(*named) ); } } #[test] fn a_wide_character_takes_one_character_and_two_columns() { let wide = MirrorCell::plain(WireCell { ch: '中' as u32, width: 2, ..WireCell::BLANK }); let row = vec![plain('a'), wide, plai...
rust_dataset_chunk_513016
rust_dataset.txt
513,016
512
_have_groups); assert_eq!(chunk.terminal_characters.len(), 2); assert!(chunk.terminal_characters[0].has_attached()); assert_eq!(chunk.terminal_characters[0].width(), 2); assert_eq!(chunk_text(&chunk), "\u{1F44D}\u{1F3FD}z"); } #[test] fn a_link_is_registered_and_carried_by_the_cell() { let linked =...
rust_dataset_chunk_513017
rust_dataset.txt
513,017
512
uvwx"), ], 8, ); let area = LiveViewRect::new(0, 0, 3, 2); let chunks = screen_chunks(&screen, &area, &MirrorRedraw::Full, &mut no_links, true); assert_eq!(chunks.len(), 2); assert_eq!(chunk_text(&chunks[0]), "abc"); assert_eq!(chunk_text(&chunks[1]), "ijk"); } #[test] fn a_tall...
rust_dataset_chunk_513018
rust_dataset.txt
513,018
512
, cols: u16) -> MirrorScreen { let mut all: Vec<Vec<MirrorCell>> = lines.iter().map(|line| text_row(line)).collect(); all.resize(rows, vec![]); screen_with(&all, cols) } #[test] fn a_visible_cursor_keeps_its_row_in_view() { let mut screen = screen_of(&["a", "b", "c", "d", "e", "f"], 6, 3); screen.c...
rust_dataset_chunk_513019
rust_dataset.txt
513,019
512
let empty = screen_of(&[], 10, 3); assert_eq!(anchor_row(&empty), 0); assert_eq!(screen_offset(&empty, 4), 0); } #[test] fn a_coloured_blank_row_counts_as_content() { let mut screen = screen_of(&["one"], 6, 2); let painted = MirrorCell::plain(WireCell { bg: WireColor::Indexed(4).pack(), ...
rust_dataset_chunk_513020
rust_dataset.txt
513,020
512
aced_in(&content), LiveViewRect::new(35, 6, 15, 6)); assert!(rect.placed_in(&content).contains(35, 6)); assert!(!rect.placed_in(&content).contains(50, 6)); assert!(!rect.placed_in(&content).contains(35, 12)); } #[test] fn a_placeholder_is_centred_in_the_rectangle() { let area = LiveViewRect::new(2, 3, ...
rust_dataset_chunk_513021
rust_dataset.txt
513,021
512
sync::{Arc, Mutex}; use zellij_utils::data::{BareKey, PaneId}; use zellij_utils::pane_mirror::{ MirrorAttach, MirrorCell, MirrorConnector, MirrorEventSink, MirrorFrameEncoder, MirrorScreen, MirrorTransport, MirrorTransportEvent, SourceMessage, ViewerMessage, }; use zellij_utils::structured_render::WireCell; #[...
rust_dataset_chunk_513022
rust_dataset.txt
513,022
512
new(FakeConnector { recorded: recorded.clone(), }); let route: MirrorEventRoute = Arc::new(|_, _, _| {}); let mut view = MirrorView::new(view_id, connector, route, view_only, true); view.set_target(target, Size { cols: 10, rows: 3 }); LiveViewSlot::new(view, LiveViewRect::new(1, 1, 10, 3), N...
rust_dataset_chunk_513023
rust_dataset.txt
513,023
512
fn capture_starts_only_for_a_focused_view_with_a_target_that_may_type() { let mut fixture = fixture(); assert_eq!( fixture.live_views.start_capture(KEY, false), Err(CaptureRefusal::NotFocused) ); assert!(!fixture.live_views.is_captured(PLUGIN, CLIENT)); assert_eq!( fixture ...
rust_dataset_chunk_513024
rust_dataset.txt
513,024
512
_eq!( fixture.live_views.send_key(CLIENT, &key('b'), b"b", false), LiveViewKeyOutcome::Sent ); assert_eq!( fixture .live_views .send_key(CLIENT, &None, b"\x1b[200~pasted", false), LiveViewKeyOutcome::Sent ); assert!(fixture.live_views.send_paste(CL...
rust_dataset_chunk_513025
rust_dataset.txt
513,025
512
_reaches_the_source() { let mut fixture = fixture(); fixture.configure("Ctrl Alt Home"); fixture.capture(); let release_key = KeyWithModifier::new(BareKey::Home) .with_ctrl_modifier() .with_alt_modifier(); assert!(fixture.route_key(release_key.clone(), b"\x1b[1;7H")); assert!(!fi...
rust_dataset_chunk_513026
rust_dataset.txt
513,026
512
(); fixture.configure("Esc Esc"); fixture.capture(); assert!(!fixture.route_key(f9(), b"\x1b[20~")); assert!(!fixture.route_key(esc(), b"\x1b")); assert!(fixture.route_key(esc(), b"\x1b")); assert!(!fixture.live_views.is_captured(PLUGIN, CLIENT)); assert_eq!( fixture.inputs().len(), ...
rust_dataset_chunk_513027
rust_dataset.txt
513,027
512
apturing(CLIENT)); fixture.capture(); assert!(fixture .live_views .captures .lock() .unwrap() .is_capturing(CLIENT)); assert!(!fixture.route_key(esc(), b"\x1b")); fixture .live_views .release_client(CLIENT, LiveViewRelease::ClickOutside); fixtu...
rust_dataset_chunk_513028
rust_dataset.txt
513,028
512
)); assert!(presses.is_empty()); } #[test] fn a_double_gesture_needs_two_presses_within_the_window_with_nothing_between() { let gesture = esc_twice(); let mut presses = BTreeMap::new(); assert!(!press(&gesture, BareKey::Esc, &mut presses)); assert!(press(&gesture, BareKey::Esc, &mut presses)); ...
rust_dataset_chunk_513029
rust_dataset.txt
513,029
512
is_release_press(&gesture, &alt_esc, &mut presses, CLIENT)); assert!(presses.is_empty()); let single = parse_release_key(Some("Ctrl Alt Home")).unwrap().0; let alt_ctrl_alt_home = KeyWithModifier::new(BareKey::Home) .with_ctrl_modifier() .with_alt_modifier(); assert!(is_release_press( ...
rust_dataset_chunk_513030
rust_dataset.txt
513,030
512
_the_first() { let mut fixture = fixture(); let other = (PLUGIN + 1, CLIENT); let target = PaneAddress::local("api", PaneId::Terminal(3)); let other_slot = slot(&fixture.recorded, 1, Some(target), false); fixture.live_views.insert(other, other_slot); fixture.live_views.start_capture(KEY, true).u...
rust_dataset_chunk_513031
rust_dataset.txt
513,031
512
.live_views.release_key.clone(); assert_eq!( fixture.live_views.capture_changes(), vec![(CLIENT, Some(release_key.clone()))] ); assert!(fixture.live_views.capture_changes().is_empty()); fixture.configure("Ctrl Alt End"); assert_eq!(fixture.live_views.capture_changes().len(), 1); ...
rust_dataset_chunk_513032
rust_dataset.txt
513,032
512
} #[test] fn links_are_registered_once_with_the_link_handler() { let mut fixture = fixture(); let mut screen = screen_of(&["ab"], 10, 3); screen.cells[0].link = Some("https://example.com".to_owned()); screen.cells[1].link = Some("https://example.com".to_owned()); let linked = MirrorTransportEvent::...
rust_dataset_chunk_513033
rust_dataset.txt
513,033
512
.cursor = zellij_utils::structured_render::CursorState { x: 5, y: 0, visible: true, shape: zellij_utils::structured_render::CURSOR_SHAPE_BEAM, }; let moved = MirrorTransportEvent::Message(SourceMessage::Frame { frame: fixture.encoder.encode(&screen).unwrap().bytes, ...
rust_dataset_chunk_513034
rust_dataset.txt
513,034
512
, 4)); assert!(fixture.live_views.release(&KEY, LiveViewRelease::Key)); assert_eq!(fixture.live_views.drag_of(CLIENT), None); let sent = mouse_inputs(&fixture); assert_eq!(sent.len(), 1); assert!(is_left_release_at(&sent[0], 2, 4), "{:?}", sent[0]); } #[test] fn a_drag_that_ends_normally_sends_noth...
rust_dataset_chunk_513035
rust_dataset.txt
513,035
512
_clients_drag_is_untouched() { let mut fixture = mouse_fixture(); fixture.live_views.start_capture(KEY, true).unwrap(); let other_client = (PLUGIN, CLIENT + 1); fixture .live_views .start_drag(other_client, DragButton::Left, Position::new(0, 0)); fixture .live_views ....
rust_dataset_chunk_513036
rust_dataset.txt
513,036
512
let recorded = Arc::new(Mutex::new(Recorded::default())); let connector = Arc::new(FakeConnector { recorded: recorded.clone(), }); let route: MirrorEventRoute = Arc::new(|_, _, _| {}); ( MirrorView::new(0xF000_0000, connector, route, view_only, true), recorded, ) } fn frame...
rust_dataset_chunk_513037
rust_dataset.txt
513,037
512
1); assert_eq!(recorded.connects[0].0, target); assert_eq!(recorded.connects[0].1.target_pane_id, PaneId::Terminal(2)); assert_eq!(recorded.connects[0].1.viewer_size, size(20, 4)); } assert!(placeholder_text(&view).contains("Connecting")); assert!(view.live_screen().is_none()); ...
rust_dataset_chunk_513038
rust_dataset.txt
513,038
512
.state(), MirrorState::Closed(MirrorClosedReason::UnsupportedHost) ); assert!(recorded.lock().unwrap().connects.is_empty()); assert!(placeholder_text(&view).contains("Unsupported host: laptop")); } #[test] fn closed_reasons_show_their_placeholder() { let cases = [ (MirrorClosedReason::P...
rust_dataset_chunk_513039
rust_dataset.txt
513,039
512
["x"], 10, 2), alternate_screen: false, }), ); assert!(!view.send_key(&None, b"typed".to_vec(), false)); assert!(recorded.lock().unwrap().connects[0].1.view_only); assert!(!recorded .lock() .unwrap() .sent .iter() .any(|m| matches!(m, ViewerMes...
rust_dataset_chunk_513040
rust_dataset.txt
513,040
512
of Zellij".to_owned(), "api / terminal_1".to_owned(), ] ); } #[test] fn a_live_mirror_has_no_connect_deadline() { let (mut view, _) = live_view(false); view.set_resize_allowed(false); assert_eq!(view.next_deadline(), None); assert_eq!(view.tick(Instant::now() + MIRROR_CONNECT_T...
rust_dataset_chunk_513041
rust_dataset.txt
513,041
512
(), "inner".to_owned()] ); assert!(attach.focused); assert!(attach.resize_allowed); assert!(!attach.view_only); } #[test] fn focus_changes_and_renewals_send_resize() { let (mut view, recorded) = live_view(false); assert!(resizes_sent(&recorded).is_empty()); assert!(view.set_focused(true)); ...
rust_dataset_chunk_513042
rust_dataset.txt
513,042
512
s[1].1.resize_allowed); assert!(!view.wants_pin()); } #[test] fn a_view_only_mirror_never_asks_for_a_pin() { let (mut view, recorded) = live_view(true); view.set_focused(true); assert!(!view.wants_pin()); assert!(resizes_sent(&recorded) .iter() .all(|(_, _, resize_allowed)| !resize_...
rust_dataset_chunk_513043
rust_dataset.txt
513,043
512
Some(&(size(14, 4), true, true)), "a resize of a typing view asks to resize the source" ); } #[test] fn a_view_only_mirror_reports_that_it_may_not_resize_and_ignores_turning_it_on() { let (mut view, recorded) = live_view(true); let sent_before = resizes_sent(&recorded).len(); assert!(!v...
rust_dataset_chunk_513044
rust_dataset.txt
513,044
512
(1, frame(&mut encoder, &["x", "changed"])) .unwrap(); assert!(!update.state_changed); match update.redraw { MirrorRedraw::Rows(rows) => assert!(rows.contains(&1)), other => panic!("expected a row redraw, got {:?}", other), } assert!(row_text(view.live_screen().unwrap(), 1).start...
rust_dataset_chunk_513045
rust_dataset.txt
513,045
512
assert!(resizes_sent(&recorded) .iter() .all(|(_, _, resize_allowed)| !resize_allowed)); view.set_focused(true); assert_eq!( resizes_sent(&recorded).last(), Some(&(size(10, 2), true, true)), "typing asks for the resize" ); view.set_focused(false); assert_e...
rust_dataset_chunk_513046
rust_dataset.txt
513,046
512
the_new_targets_first_frame_or_a_close_replaces_the_held_picture() { let (mut view, _) = live_view(false); view.set_target( Some(PaneAddress::local("api", PaneId::Terminal(2))), size(10, 2), ); view.handle_event( 2, MirrorTransportEvent::Message(SourceMessage::Frame { ...
rust_dataset_chunk_513047
rust_dataset.txt
513,047
512
_target_unparks_its_connection_without_connecting_again() { let (mut view, recorded) = live_view(false); view.set_target(Some(target(2)), size(10, 2)); recorded.lock().unwrap().sent.clear(); view.set_target(Some(target(1)), size(12, 3)); assert_eq!(recorded.lock().unwrap().connects.len(), 2); as...
rust_dataset_chunk_513048
rust_dataset.txt
513,048
512
(false); view.set_target(Some(target(2)), size(10, 2)); view.set_target(Some(target(3)), size(10, 2)); assert_eq!(view.parked_targets().len(), 2); assert_eq!(recorded.lock().unwrap().closed, 0); drop(view); assert_eq!(recorded.lock().unwrap().closed, 3); } #[test] fn at_most_eight_connections_a...
rust_dataset_chunk_513049
rust_dataset.txt
513,049
512
view.state(), MirrorState::Connecting); } --- FILE: zellij/zellij-server/src/pane_mirror/view.rs --- use std::collections::{BTreeSet, VecDeque}; use std::sync::Arc; use std::time::Instant; use zellij_utils::data::{KeyWithModifier, MirrorClosedReason, MirrorState, PaneAddress}; use zellij_utils::input::mouse::MouseEve...
rust_dataset_chunk_513050
rust_dataset.txt
513,050
512
, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("MirrorView") .field("view_id", &self.view_id) .field("target", &self.target) .field("state", &self.state) .field("generation", &self.generation) .field("view_only", &self.view_onl...
rust_dataset_chunk_513051
rust_dataset.txt
513,051
512
self) -> Option<Size> { self.source_size } pub fn wants_pin(&self) -> bool { !self.view_only && (self.resize_allowed || self.typed_into) } pub fn alternate_screen_active(&self) -> bool { self.is_live() && self .screen .as_ref() ...
rust_dataset_chunk_513052
rust_dataset.txt
513,052
512
{ MirrorState::Connecting => self .connecting_since .map(|since| since + MIRROR_CONNECT_TIMEOUT), _ => None, }; let renew_deadline = if self.wants_pin() && self.transport.is_some() { let renewal = self .last_resize_sent...
rust_dataset_chunk_513053
rust_dataset.txt
513,053
512
self) -> Vec<PaneAddress> { self.parked .iter() .map(|parked| parked.target.clone()) .collect() } fn detach_parked(&mut self) { for mut parked in self.parked.drain(..) { parked.transport.close(); } } fn new_generation(&mut self) -...
rust_dataset_chunk_513054
rust_dataset.txt
513,054
512
decode(&frame) { Ok(view) => { let seq = view.header().seq; self.parked[index] .transport .send(ViewerMessage::FrameAck { seq }) }, Err(_) => false, ...
rust_dataset_chunk_513055
rust_dataset.txt
513,055
512
::ConnectionLost); self.state } }, (None, None) => { self.generation = self.new_generation(); MirrorState::NoTarget }, (Some(target), None) if !target.is_local() => { self.generation = sel...
rust_dataset_chunk_513056
rust_dataset.txt
513,056
512
Event::Message(SourceMessage::Frame { frame, alternate_screen, }) => { let screen = self.screen.get_or_insert_with(|| MirrorScreen::blank(0, 0)); let applied = match screen.apply_frame(&frame) { Ok(applied) => applied, ...
rust_dataset_chunk_513057
rust_dataset.txt
513,057
512
unwrap_or(false) } pub fn send_key( &self, key: &Option<KeyWithModifier>, raw_bytes: Vec<u8>, is_kitty_keyboard_protocol: bool, ) -> bool { match key { Some(key) => self.send_input(MirrorInput::Key { key: key.clone(), raw_b...
rust_dataset_chunk_513058
rust_dataset.txt
513,058
512
}, MirrorState::Closed(MirrorClosedReason::VersionMismatch) => { "Preview not available".to_owned() }, MirrorState::Closed(MirrorClosedReason::UnsupportedHost) => { let host = self .target .as_ref() ...
rust_dataset_chunk_513059
rust_dataset.txt
513,059
512
Panes { active_panes: HashMap::new(), last_panes: HashMap::new(), os_api, } } pub fn get(&self, client_id: &ClientId) -> Option<&PaneId> { self.active_panes.get(client_id) } pub fn get_last(&self, client_id: &ClientId) -> Option<&PaneId> { self...
rust_dataset_chunk_513060
rust_dataset.txt
513,060
512
, panes); } } pub fn focus_all_panes( &self, panes: &mut BTreeMap<PaneId, Box<dyn Pane>>, connected_clients: &HashSet<ClientId>, ) { for pane_id in self.panes_focused_by(connected_clients) { self.focus_pane(pane_id, panes); } } fn panes_foc...
rust_dataset_chunk_513061
rust_dataset.txt
513,061
512
(terminal_id) = pane_id { if let Some(focus_event) = panes.get(&pane_id).and_then(|p| p.focus_event()) { let _ = self .os_api .write_to_tty_stdin(terminal_id, focus_event.as_bytes()); } } } pub fn pane_id_is_focused(&self, p...
rust_dataset_chunk_513062
rust_dataset.txt
513,062
512
.len() as u32) - 1; let value = u32::from_str_radix(input, 16).ok()?; Some((255 * value / max) as u8) } }; Some(AnsiCode::RgbCode(( scale(colors[0])?, scale(colors[1])?, scale(colors[2])?, ))) } /// Parse colors in `#r(rrr)g(ggg)b(bbb)` format. pub f...
rust_dataset_chunk_513063
rust_dataset.txt
513,063
512
shall mean the terms and conditions for use, reproduction, // and distribution as defined by Sections 1 through 9 of this document. // // "Licensor" shall mean the copyright owner or entity authorized by // the copyright owner that is granting the License. // // "Legal Entity" shall mean the union of the a...
rust_dataset_chunk_513064
rust_dataset.txt
513,064
512
// submitted to Licensor for inclusion in the Work by the copyright owner // or by an individual or Legal Entity authorized to submit on behalf of // the copyright owner. For the purposes of this definition, "submitted" // means any form of electronic, verbal, or written communication sent // to the Lice...
rust_dataset_chunk_513065
rust_dataset.txt
513,065
512
// 4. Redistribution. You may reproduce and distribute copies of the // Work or Derivative Works thereof in any medium, with or without // modifications, and in Source or Object form, provided that You // meet the following conditions: // // (a) You must give any other recipients of the Work or // De...
rust_dataset_chunk_513066
rust_dataset.txt
513,066
512
submitted for inclusion in the Work // by You to the Licensor shall be under the terms and conditions of // this License, without any additional terms or conditions. // Notwithstanding the above, nothing herein shall supersede or modify // the terms of any separate license agreement you may have executed /...
rust_dataset_chunk_513067
rust_dataset.txt
513,067
512
You may act only // on Your own behalf and on Your sole responsibility, not on behalf // of any other Contributor, and only if You agree to indemnify, // defend, and hold each Contributor harmless for any liability // incurred by, or claims asserted against, such Contributor by reason // of your accepti...
rust_dataset_chunk_513068
rust_dataset.txt
513,068
512
when // dropped or overwritten. At zero the entry is freed and its id reused (`free`). A count that // reaches u32::MAX saturates and the entry is never freed. // - Memory is capped at DEFAULT_BYTE_LIMIT, charging each entry its text length plus // ENTRY_OVERHEAD. When full, `intern` returns None, the caller dro...
rust_dataset_chunk_513069
rust_dataset.txt
513,069
512
{ return None; } self.entries.push(Entry { text: None, refs: 0, }); next }, }; let text: Rc<str> = Rc::from(text); self.entries[id as usize] = Entry { ...
rust_dataset_chunk_513070
rust_dataset.txt
513,070
512
| table.borrow().text(id)) .ok() .flatten() } pub fn bytes() -> usize { TABLE.try_with(|table| table.borrow().bytes).unwrap_or(0) } pub fn live_entries() -> usize { TABLE .try_with(|table| table.borrow().by_text.len()) .unwrap_or(0) } #[cfg(test)] pub fn set_limit_for_tests(li...
rust_dataset_chunk_513071
rust_dataset.txt
513,071
512
Size, viewport: Viewport, ) -> Self { let panes: HashMap<_, _> = panes.into_iter().map(|(p_id, p)| (*p_id, p)).collect(); FloatingPaneGrid { panes: Rc::new(RefCell::new(panes)), desired_pane_positions: Rc::new(RefCell::new(desired_pane_positions)), displa...
rust_dataset_chunk_513072
rust_dataset.txt
513,072
512
set pane {pane_id:?} geometry to {:?}", new_pane_geom ) }; let mut panes = self.panes.borrow_mut(); let pane = panes .iter_mut() .find(|(p_id, _p)| **p_id == pane_id) .with_context(|| no_pane_id(&pane_id)) .with_contex...
rust_dataset_chunk_513073
rust_dataset.txt
513,073
512
{ let pane_right_side = new_pane_geom.x + new_pane_geom.cols.as_usize(); let pane_bottom_side = new_pane_geom.y + new_pane_geom.rows.as_usize(); let viewport_right_side = new_viewport.x + new_viewport.cols; let viewport_bottom_side = new_viewport.y + new_...
rust_dataset_chunk_513074
rust_dataset.txt
513,074
512
{ let reduce_y_by = new_pane_geom.y.saturating_sub(new_viewport.y); let reduced_height = new_pane_geom .rows .as_usize() .saturating_sub(excess_height.saturating_sub(reduce_y_by)); new_pa...
rust_dataset_chunk_513075
rust_dataset.txt
513,075
512
= desired_pane_geom.y } else if new_pane_geom.y + new_pane_geom.rows.as_usize() + extra_height < max_bottom_coords { new_pane_geom.y += extra_height; } else { new_...
rust_dataset_chunk_513076
rust_dataset.txt
513,076
512
{ let err_context = || format!("failed to move pane {pane_id:?} down"); if let Some(move_by) = self .can_move_pane_down(pane_id, MOVE_INCREMENT_VERTICAL) .with_context(err_context)? { self.move_pane_position_down(pane_id, move_by) .with_conte...
rust_dataset_chunk_513077
rust_dataset.txt
513,077
512
{ Some(move_by) } else if space_until_right_screen_edge > 0 { Some(space_until_right_screen_edge) } else { None }) } fn can_move_pane_up(&self, pane_id: &PaneId, move_by: usize) -> Result<Option<usize>> { let err_context = || form...
rust_dataset_chunk_513078
rust_dataset.txt
513,078
512
-= move_by; current_geom }; self.set_pane_geom(*pane_id, new_pane_geom) .with_context(err_context) } fn move_pane_position_right(&mut self, pane_id: &PaneId, move_by: usize) -> Result<()> { let err_context = || format!("failed to move pane {pane_id:?} right by {...
rust_dataset_chunk_513079
rust_dataset.txt
513,079
512
: &PaneId, strategy: &ResizeStrategy, change_by: (usize, usize), // (x, y) ) -> Result<()> { let err_context = || format!("failed to {strategy} for pane {pane_id:?}"); let mut geometry = self .panes .borrow() .get(pane_id) .with_contex...
rust_dataset_chunk_513080
rust_dataset.txt
513,080
512
_sub(MIN_TERMINAL_WIDTH), change_by.0, ); geometry .cols .set_inner(geometry.cols.as_usize().saturating_sub(increment)); }; // Move upper border if strategy.move_upper_border_up() || strategy.move_all_borders_out() { ...
rust_dataset_chunk_513081
rust_dataset.txt
513,081
512
.borrow(); let current_pane = panes.get(current_pane_id)?; let panes: Vec<(PaneId, &&mut Box<dyn Pane>)> = panes .iter() .filter(|(_, p)| p.selectable()) .map(|(p_id, p)| (*p_id, p)) .collect(); let next_index = panes .iter() ...
rust_dataset_chunk_513082
rust_dataset.txt
513,082
512
_comparison, } }, }) .map(|(_, (pid, _))| pid) .copied(); next_index } pub fn next_selectable_pane_id_below(&self, current_pane_id: &PaneId) -> Option<PaneId> { let panes = self.panes.borrow(); let current_pane = pan...
rust_dataset_chunk_513083
rust_dataset.txt
513,083
512
.copied(); next_index } pub fn next_selectable_pane_id_to_the_right(&self, current_pane_id: &PaneId) -> Option<PaneId> { let panes = self.panes.borrow(); let current_pane = panes.get(current_pane_id)?; let panes: Vec<(PaneId, &&mut Box<dyn Pane>)> = panes .iter() ...
rust_dataset_chunk_513084
rust_dataset.txt
513,084
512
(&self, current_pane_id: &PaneId) -> Option<PaneId> { let panes = self.panes.borrow(); let mut panes: Vec<(PaneId, &&mut Box<dyn Pane>)> = panes .iter() .filter(|(_, p)| p.selectable()) .map(|(p_id, p)| (*p_id, p)) .collect(); panes.sort_by(|(_a_id...
rust_dataset_chunk_513085
rust_dataset.txt
513,085
512
); find_unoccupied_offset!( |offset| half_size_top_left_geom(&self.viewport, offset), &self.viewport, &pane_geoms ); find_unoccupied_offset!( |offset| half_size_top_right_geom(&self.viewport, offset), &self.viewport, ...
rust_dataset_chunk_513086
rust_dataset.txt
513,086
512
stacked: None, is_pinned: false, logical_position: None, }; geom.cols.set_inner(space.cols / 3); geom.rows.set_inner(space.rows / 3); geom } fn half_size_bottom_left_geom(space: &Viewport, offset: usize) -> PaneGeom { let mut geom = PaneGeom { x: space.x + 2 + offset...
rust_dataset_chunk_513087
rust_dataset.txt
513,087
512
oms: &[PaneGeom], ) -> bool { pane_geom_is_inside_viewport(viewport, geom) && !existing_geoms.iter().any(|p| p == geom) } --- FILE: zellij/zellij-server/src/panes/floating_panes/mod.rs --- pub mod floating_pane_grid; use zellij_utils::{ data::{BorderStyle, Direction, FloatingPaneCoordinates, PaneInfo, ResizeS...
rust_dataset_chunk_513088
rust_dataset.txt
513,088
512
default_mode: InputMode, style: Style, session_is_mirrored: bool, desired_pane_positions: HashMap<PaneId, PaneGeom>, // this represents the positions of panes the user moved with intention, rather than by resizing the terminal window z_indices: Vec<PaneId>, active_panes: ActivePanes, show_panes...
rust_dataset_chunk_513089
rust_dataset.txt
513,089
512
], show_panes: false, active_panes: ActivePanes::new(&os_input), pane_being_moved_with_mouse: None, senders, window_title: None, dimmed_clients: HashSet::new(), panes_with_logged_render_errors: HashSet::new(), fullscreen_cov...
rust_dataset_chunk_513090
rust_dataset.txt
513,090
512
pub fn has_pinned_panes(&self) -> bool { self.panes .iter() .any(|(_, p)| p.position_and_size().is_pinned) } pub fn pane_ids(&self) -> impl Iterator<Item = &PaneId> { self.panes.keys() } pub fn rendered_pane_ids(&self) -> Vec<PaneId> { if let Some(full...
rust_dataset_chunk_513091
rust_dataset.txt
513,091
512
= self.panes.remove(&pane_id) else { log::error!("Cannot replace floating pane {:?}: pane not found", pane_id); return Err(with_pane); }; with_pane.set_content_offset(Offset::frame(1)); with_pane.set_geom(removed_pane.position_and_size()); match removed_pane.geom...
rust_dataset_chunk_513092
rust_dataset.txt
513,092
512
); self.desired_pane_positions.remove(&pane_id); let removed_pane = self.panes.remove(&pane_id); self.move_clients_out_of_pane(pane_id); removed_pane } pub fn discard_state_of_missing_panes(&mut self) { if let Some(fullscreen_pane_id) = self.fullscreen_pane_id { ...
rust_dataset_chunk_513093
rust_dataset.txt
513,093
512
self.active_panes .get(&client_id) .and_then(|active_pane_id| self.panes.get_mut(active_pane_id)) } pub fn panes_are_visible(&self) -> bool { self.show_panes && !*self.fullscreen_covers_ui.borrow() } pub fn panes_are_shown(&self) -> bool { self.show_panes } ...
rust_dataset_chunk_513094
rust_dataset.txt
513,094
512
.focus_all_panes(&mut self.panes, &connected_clients); } else { let connected_clients = self.connected_clients.borrow().clone(); self.active_panes .unfocus_all_panes(&mut self.panes, &connected_clients); } } pub fn active_panes_contain(&se...
rust_dataset_chunk_513095
rust_dataset.txt
513,095
512
_position(position, floating_pane_layout) } pub fn position_floating_pane_layout_or_fill_viewport( &mut self, floating_pane_layout: &FloatingPaneLayout, ) -> PaneGeom { let viewport = *self.viewport.borrow(); let mut fallback_position = PaneGeom { x: viewport.x, ...
rust_dataset_chunk_513096
rust_dataset.txt
513,096
512
} pub fn last_floating_pane_id(&self) -> Option<PaneId> { self.panes.keys().last().copied() } pub fn last_selectable_floating_pane_id(&self) -> Option<PaneId> { self.panes .iter() .filter(|(_p_id, p)| p.selectable()) .last() .map(|(p_id, _p)| ...
rust_dataset_chunk_513097
rust_dataset.txt
513,097
512
0)); } else { pane.set_frame(false); pane.set_content_offset(Offset::default()); } resize_pty!(pane, os_api, self.senders, self.character_cell_size) .with_context(|| err_context(&pane.pid())) ...
rust_dataset_chunk_513098
rust_dataset.txt
513,098
512
, None), ); } }, PaneId::Plugin(_) => { for client_id in &connected_clients { output.add_pane_contents( &[*client_id], pane.pid(), ...
rust_dataset_chunk_513099
rust_dataset.txt
513,099
512
(); for (z_index, (kind, pane)) in floating_panes.iter_mut().enumerate() { let mut active_panes = active_panes.clone(); let multiple_users_exist_in_session = { self.connected_clients_in_app.borrow().len() > 1 }; active_panes.retain(|c_id, _| self.connected_cli...