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_511800
rust_dataset.txt
511,800
512
println!("HTTP request failed: {:?}", e); }, Err(e) => { eprintln!("Task spawn failed: {:?}", e); }, } tokio::time::sleep(Duration::from_millis(100)).await; } Err(format!( "HTTP server failed to start...
rust_dataset_chunk_511801
rust_dataset.txt
511,801
512
::new()); let client_os_api_factory = Arc::new(MockClientOsApiFactory::new()); let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap(); let addr = listener.local_addr().unwrap(); let port = addr.port(); let server_handle = tokio::spawn(serve_web_client( C...
rust_dataset_chunk_511802
rust_dataset.txt
511,802
512
_blocking(move || { isahc::Request::post(&login_url) .header("Content-Type", "application/json") .body(login_payload.to_string()) .unwrap() .send() }), ) .await .expect("Login request time...
rust_dataset_chunk_511803
rust_dataset.txt
511,803
512
tokio::time::sleep(Duration::from_millis(100)).await; } #[tokio::test] #[serial] async fn test_invalid_auth_token_login() { let _ = delete_db(); let session_manager = Arc::new(MockSessionManager::new()); let client_os_api_factory = Arc::new(MockClientOsApiFactory::new()); ...
rust_dataset_chunk_511804
rust_dataset.txt
511,804
512
(MockClientOsApiFactory::new()); let factory_for_verification = client_os_api_factory.clone(); let config = Config::default(); let options = Options::default(); let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap(); let addr = listener.local_addr().unwrap(); ...
rust_dataset_chunk_511805
rust_dataset.txt
511,805
512
", "application/json") .body("{}") .unwrap() .send() } }), ) .await .unwrap() .unwrap() .unwrap(); assert!(client_response.status().is_success()); let client_data...
rust_dataset_chunk_511806
rust_dataset.txt
511,806
512
|| { let sent: Vec<ClientToServerMsg> = factory_for_verification .mock_apis .lock() .unwrap() .values() .flat_map(|mock_api| mock_api.get_sent_messages()) .collect(); sent.iter() .any...
rust_dataset_chunk_511807
rust_dataset.txt
511,807
512
let options = Options::default(); let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap(); let addr = listener.local_addr().unwrap(); let port = addr.port(); let temp_config_path = std::env::temp_dir().join("test_config.kdl"); let server_handle = tokio::spawn...
rust_dataset_chunk_511808
rust_dataset.txt
511,808
512
_success()); let client_data: serde_json::Value = serde_json::from_str(&client_response.text().unwrap()).unwrap(); let web_client_id = client_data["web_client_id"].as_str().unwrap().to_string(); let control_ws_url = format!( "ws://127.0.0.1:{}/ws/control?web_client_id={...
rust_dataset_chunk_511809
rust_dataset.txt
511,809
512
=> { let cell = pixel_dimensions .character_cell_size .expect("character_cell_size missing"); let area = pixel_dimensions .text_area_size .expect("text_area_size missing"); assert_eq!(cell.wi...
rust_dataset_chunk_511810
rust_dataset.txt
511,810
512
= delete_db(); let session_manager = Arc::new(MockSessionManager::new()); let client_os_api_factory = Arc::new(MockClientOsApiFactory::new()); let config = Config::default(); let options = Options::default(); let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap();...
rust_dataset_chunk_511811
rust_dataset.txt
511,811
512
unwrap(); let port = addr.port(); let temp_config_path = std::env::temp_dir().join("test_config.kdl"); let server_handle = tokio::spawn(async move { serve_web_client( config, options, Some(temp_config_path), listener, ...
rust_dataset_chunk_511812
rust_dataset.txt
511,812
512
)))) => { println!("✓ Control WebSocket received close frame"); }, Ok(Some(Ok(msg))) => { println!("Control WebSocket received unexpected message: {:?}", msg); }, Ok(Some(Err(e))) => { println!( "Control ...
rust_dataset_chunk_511813
rust_dataset.txt
511,813
512
{ serve_web_client( config, options, Some(temp_config_path), listener, None, Some(session_manager), Some(client_os_api_factory), addr.ip(), port, ) ...
rust_dataset_chunk_511814
rust_dataset.txt
511,814
512
.send(Message::Text( serde_json::to_string(&resize_msg_1).unwrap().into(), )) .await .expect("Failed to send resize message for client 1"); control_sink_2 .send(Message::Text( serde_json::to_string(&resize_msg_2).unwra...
rust_dataset_chunk_511815
rust_dataset.txt
511,815
512
in messages { if matches!(msg, ClientToServerMsg::TerminalResize { .. }) { total_resize_messages = total_resize_messages.saturating_add(1); } } } assert!( total_resize_messages >= 2, "Should have received at least ...
rust_dataset_chunk_511816
rust_dataset.txt
511,816
512
WebSocket connection timed out") .expect("Failed to connect to terminal WebSocket"); let (mut terminal_sink, mut terminal_stream) = terminal_ws.split(); terminal_sink .send(Message::Text("test input\n".to_string().into())) .await .expect("Failed to send ter...
rust_dataset_chunk_511817
rust_dataset.txt
511,817
512
connection_terminated = true; }, } } assert!( connection_terminated, "Connection should have been terminated due to server shutdown. Reason: {}", termination_reason ); revoke_token(test_token_name).expect("Failed to revok...
rust_dataset_chunk_511818
rust_dataset.txt
511,818
512
) = terminal_ws.split(); terminal_sink .send(Message::Text("echo test\n".to_string().into())) .await .expect("Failed to send terminal input"); tokio::time::sleep(Duration::from_millis(200)).await; let mock_apis = factory_for_verification.mock_apis.lock().un...
rust_dataset_chunk_511819
rust_dataset.txt
511,819
512
Factory::new()); let session_manager_for_verification = mock_session_manager.clone(); let config = Config::default(); let options = Options::default(); let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap(); let addr = listener.local_addr().unwrap(); let por...
rust_dataset_chunk_511820
rust_dataset.txt
511,820
512
time::sleep(Duration::from_millis(500)).await; assert!( !session_manager_for_verification.was_session_created("default"), "No session should be created for read-only token attempting to create new session" ); server_handle.abort(); let _ = delete_db(); t...
rust_dataset_chunk_511821
rust_dataset.txt
511,821
512
to control WebSocket"); let (mut regular_control_sink, _regular_control_stream) = regular_control_ws.split(); let regular_terminal_ws_url = format!( "ws://127.0.0.1:{}/ws/terminal?web_client_id={}", port, regular_web_client_id ); let (regular_terminal_ws, _) = ...
rust_dataset_chunk_511822
rust_dataset.txt
511,822
512
1:{}/ws/terminal?web_client_id={}", port, readonly_web_client_id ); let (readonly_terminal_ws, _) = timeout( Duration::from_secs(5), connect_async_with_cookie(&readonly_terminal_ws_url, &readonly_session_token), ) .await .expect("Readonly termi...
rust_dataset_chunk_511823
rust_dataset.txt
511,823
512
(); let options = Options::default(); let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap(); let addr = listener.local_addr().unwrap(); let port = addr.port(); let ip = addr.ip(); let temp_config_path = std::env::temp_dir().join("test_config.kdl"); ...
rust_dataset_chunk_511824
rust_dataset.txt
511,824
512
msg)| msg) .expect("Should have at least one message"); assert!( matches!(msg, ClientToServerMsg::FirstClientConnected { .. }), "Regular client creating new session should use FirstClientConnected, got {:?}", msg ); let sessions_created = sessio...
rust_dataset_chunk_511825
rust_dataset.txt
511,825
512
isahc::Request::post(&session_url) .header("Cookie", format!("session_token={}", session_token)) .header("Content-Type", "application/json") .body("{}") .unwrap() .send() ...
rust_dataset_chunk_511826
rust_dataset.txt
511,826
512
("Content-Type", "application/json") .body(login_payload.to_string()) .unwrap() .send() }), ) .await .unwrap() .unwrap() .unwrap(); assert!(login_response.status().is_success()); let set_coo...
rust_dataset_chunk_511827
rust_dataset.txt
511,827
512
let config = Config::default(); let options = Options::default(); let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap(); let addr = listener.local_addr().unwrap(); let port = addr.port(); let temp_config_path = std::env::temp_dir().join("test_config.kdl"); ...
rust_dataset_chunk_511828
rust_dataset.txt
511,828
512
.expect("Failed to send resize message"); tokio::time::sleep(Duration::from_millis(200)).await; { let mock_apis = factory_for_verification.mock_apis.lock().unwrap(); assert!( !mock_apis.is_empty(), "Expected at least one mock API to be registere...
rust_dataset_chunk_511829
rust_dataset.txt
511,829
512
control_closed = true; break; }, Ok(Some(Ok(Message::Close(None)))) => { control_closed = true; break; }, Ok(Some(Ok(_msg))) => { continue; }, ...
rust_dataset_chunk_511830
rust_dataset.txt
511,830
512
_url = format!( "ws://127.0.0.1:{}/ws/terminal?web_client_id={}", port, web_client_id ); let (terminal_ws, _) = timeout( Duration::from_secs(5), connect_async_with_cookie(&terminal_ws_url, &session_token), ) .await .expect("Terminal...
rust_dataset_chunk_511831
rust_dataset.txt
511,831
512
terminal_got_normal = frame.code == tokio_tungstenite::tungstenite::protocol::frame::coding::CloseCode::Normal; terminal_closed = true; break; }, Ok(Some(Ok(Message::Close(None)))) => { ...
rust_dataset_chunk_511832
rust_dataset.txt
511,832
512
Config::default(); let options = Options::default(); let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap(); let addr = listener.local_addr().unwrap(); let port = addr.port(); let temp_config_path = std::env::temp_dir().join("test_config.kdl"); let server_...
rust_dataset_chunk_511833
rust_dataset.txt
511,833
512
headers() .get("Strict-Transport-Security") .is_none(), "Strict-Transport-Security should NOT be present when is_https is false" ); server_handle.abort(); tokio::time::sleep(Duration::from_millis(100)).await; } #[tokio::test] #[serial] ...
rust_dataset_chunk_511834
rust_dataset.txt
511,834
512
()), Some("nosniff"), "X-Content-Type-Options header should be present on authenticated routes" ); assert_eq!( response .headers() .get("X-Frame-Options") .map(|v| v.to_str().unwrap()), Some("DENY"), ...
rust_dataset_chunk_511835
rust_dataset.txt
511,835
512
.0.1:{}/ws/control?web_client_id={}", port, rw_web_client_id ); let connect_result = timeout( Duration::from_secs(5), connect_async_with_cookie(&control_ws_url, &ro_session_token), ) .await .expect("Control WebSocket connection timed out"); ...
rust_dataset_chunk_511836
rust_dataset.txt
511,836
512
Server failed to start"); let session_token = login_and_get_session_token(port, &rw_token).await; let web_client_id = create_client_session(port, &session_token).await; let control_ws_url = format!( "ws://127.0.0.1:{}/ws/control?web_client_id={}", port, web_client_id ...
rust_dataset_chunk_511837
rust_dataset.txt
511,837
512
_api_factory = Arc::new(MockClientOsApiFactory::new()); let config = Config::default(); let options = Options::default(); let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap(); let addr = listener.local_addr().unwrap(); let port = addr.port(); let ip = addr...
rust_dataset_chunk_511838
rust_dataset.txt
511,838
512
{ let session_manager = Arc::new(MockSessionManager::new()); let client_os_api_factory = Arc::new(MockClientOsApiFactory::new()); let options = Options::default(); let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap(); let addr = listener.local_addr().unwrap(); ...
rust_dataset_chunk_511839
rust_dataset.txt
511,839
512
v| v.as_str()).is_some(), "manifest must declare `name`" ); assert!( manifest.get("start_url").is_some(), "manifest must declare `start_url` (W3C required member)" ); let icons = manifest .get("icons") .and_then(|v| v.as_array()...
rust_dataset_chunk_511840
rust_dataset.txt
511,840
512
and_then(|v| v.as_array()) .expect("icons array required"); for icon in icons { let src = icon.get("src").expect("each icon must have src"); assert!(is_relative(src), "icon src must be relative, got {:?}", src); } server_handle.abort(); tokio::time::s...
rust_dataset_chunk_511841
rust_dataset.txt
511,841
512
"index.html must declare a theme-color meta tag" ); assert!( !body.contains("<base "), "index.html must not declare a <base href>" ); assert!( !body.contains("data-authenticated"), "index.html must not carry a data-authenticated...
rust_dataset_chunk_511842
rust_dataset.txt
511,842
512
test_manifest_body_invariant_under_base_url() { // The server-side manifest response is identical regardless of base_url config — // base_url only affects the browser-side URL composition via <base href> in // serve_html. The manifest itself is a static asset. let _ = delete_db(); ...
rust_dataset_chunk_511843
rust_dataset.txt
511,843
512
) .await; }); wait_for_server(port, Duration::from_secs(5)) .await .expect("Server failed to start"); (port, server_handle) } #[tokio::test] #[serial] async fn test_session_list_requires_authentication() { let _ = delete_db(); ...
rust_dataset_chunk_511844
rust_dataset.txt
511,844
512
c::Request::get(&url) .header("Cookie", format!("session_token={}", session_token)) .body(()) .unwrap() .send() }), ) .await .expect("Request timed out") .expect("Spawn blocking failed") ....
rust_dataset_chunk_511845
rust_dataset.txt
511,845
512
}), ) .await .unwrap() .unwrap() .unwrap(); assert!(client_response.status().is_success()); let client_data: serde_json::Value = serde_json::from_str(&client_response.text().unwrap()).unwrap(); ( client_data["web_client_id"].as_s...
rust_dataset_chunk_511846
rust_dataset.txt
511,846
512
_unnamed_session_defaults_to_the_welcome_layout() { let _ = delete_db(); let layout = layout_of_first_message_for_query("").await; assert_eq!( layout, Some(LayoutInfo::BuiltIn("welcome".to_owned())), "an unnamed session must boot the welcome screen by defaul...
rust_dataset_chunk_511847
rust_dataset.txt
511,847
512
)))) => Some(serde_json::from_str(&text).unwrap()), _ => None, } } async fn next_terminal(&mut self) -> Option<Message> { self.next_terminal_within(Duration::from_secs(2)).await } async fn next_terminal_within(&mut self, within: Duration) -> Opti...
rust_dataset_chunk_511848
rust_dataset.txt
511,848
512
expect("terminal websocket connection timed out") .expect("failed to connect to the terminal websocket"); let (_terminal_sink, terminal_stream) = terminal_ws.split(); tokio::time::sleep(Duration::from_millis(300)).await; AttachedTestClient { web_client_id, contr...
rust_dataset_chunk_511849
rust_dataset.txt
511,849
512
= client.sent_to_session(); assert!( declarations.contains(&ClientToServerMsg::StructuredRenderSupport { supported: true, row_shifts: false }), "a structured client must be declared to the session, got {:?}", declarations )...
rust_dataset_chunk_511850
rust_dataset.txt
511,850
512
"); assert_eq!(theme["mode"], "Light"); client .os_api .queue_server_message(ServerToClientMsg::ForwardQueryToHost { token: 11, query_bytes: b"\x1b]11;?\x07".to_vec(), resolve_async: false, }); let query = clien...
rust_dataset_chunk_511851
rust_dataset.txt
511,851
512
await; client .send_control(WebClientToWebServerControlMessagePayload::Paste { chars: "pasted".to_owned(), }) .await; client .send_control(WebClientToWebServerControlMessagePayload::Text { chars: "\u{4f60}\u{597d}".to_owned(...
rust_dataset_chunk_511852
rust_dataset.txt
511,852
512
revoke_token(test_token_name).expect("Failed to revoke test token"); tokio::time::sleep(Duration::from_millis(100)).await; } #[tokio::test] #[serial] async fn test_browser_client_is_untouched_by_the_structured_path() { let _ = delete_db(); let test_token_name = "test_token_brow...
rust_dataset_chunk_511853
rust_dataset.txt
511,853
512
.is_none(), "a browser must never be sent a render frame" ); assert!( client .next_control_within(Duration::from_millis(300)) .await .is_none(), "a browser must be sent neither the theme mode nor a host ...
rust_dataset_chunk_511854
rust_dataset.txt
511,854
512
new())), all_sessions_exist: false, listed_sessions: Vec::new(), } } pub fn with_all_sessions_existing() -> Self { Self { mock_sessions: HashMap::new(), mock_layouts: HashMap::new(), sessions_created: Arc::new(Mutex::new(HashSet::new()...
rust_dataset_chunk_511855
rust_dataset.txt
511,855
512
)] struct MockClientOsApiFactory { mock_apis: Arc<Mutex<HashMap<String, Arc<MockClientOsApi>>>>, } impl MockClientOsApiFactory { fn new() -> Self { Self { mock_apis: Arc::new(Mutex::new(HashMap::new())), } } } impl ClientOsApiFactory for MockClientOsApiFactory { fn create_c...
rust_dataset_chunk_511856
rust_dataset.txt
511,856
512
_name: String) {} fn read_from_stdin(&mut self) -> Result<Vec<u8>, &'static str> { Ok(Vec::new()) } fn box_clone(&self) -> Box<dyn ClientOsApi> { Box::new(self.clone()) } fn send_to_server(&self, msg: ClientToServerMsg) { self.messages_to_server.lock().unwrap().push(msg); ...
rust_dataset_chunk_511857
rust_dataset.txt
511,857
512
> { let is_loopback = match ip { IpAddr::V4(ipv4) => ipv4.is_loopback(), IpAddr::V6(ipv6) => ipv6.is_loopback(), }; if has_certificate { Ok(true) } else if is_loopback && enforce_https_for_localhost { Err(format!("Cannot bind without an SSL certificate.")) } else if ...
rust_dataset_chunk_511858
rust_dataset.txt
511,858
512
fn localhost() -> IpAddr { IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)) } fn remote_v4() -> IpAddr { IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)) } fn remote_v6() -> IpAddr { IpAddr::V6(Ipv6Addr::UNSPECIFIED) } #[test] fn non_loopback_ipv4_without_certificate_is_refused_by_de...
rust_dataset_chunk_511859
rust_dataset.txt
511,859
512
fn non_loopback_with_certificate_still_uses_https_when_dangerously_allowed() { assert_eq!(should_use_https(remote_v4(), true, false, true), Ok(true)); } #[test] fn enforced_https_for_localhost_wins_over_dangerous_allowance() { assert!(should_use_https(localhost(), false, true, true).is_err...
rust_dataset_chunk_511860
rust_dataset.txt
511,860
512
let mut interval = tokio::time::interval_at(now + ping_interval, ping_interval); interval.set_missed_tick_behavior(MissedTickBehavior::Delay); Heartbeat { interval, last_pong: now, pong_timeout, } } async fn tick(&mut self) -> HeartbeatTick { ...
rust_dataset_chunk_511861
rust_dataset.txt
511,861
512
state .connection_table .lock() .unwrap() .add_client_control_tx(&web_client_id, control_channel_tx); let mut heartbeat = Heartbeat::new(PING_INTERVAL, PONG_TIMEOUT); let send_message_to_server = |deserialized_msg: WebClientToWebServerControlMessage| { let (client_os_a...
rust_dataset_chunk_511862
rust_dataset.txt
511,862
512
client msg: {:?}", e); }, } }, Message::Pong(_) => { heartbeat.pong_received(); }, Message::Close(_) => { return; }, _ => { log::error!("Unsupported messagetype : ...
rust_dataset_chunk_511863
rust_dataset.txt
511,863
512
_client_id, stdout_channel_tx); let (attachment_complete_tx, attachment_complete_rx) = tokio::sync::oneshot::channel(); zellij_server_listener( os_input.clone(), state.connection_table.clone(), session_name.map(|p| p.0), state.config.lock().unwrap().clone(), state.confi...
rust_dataset_chunk_511864
rust_dataset.txt
511,864
512
, }, _ = tokio::time::sleep(finalize_idle), if stdin_session.pending_finalize() => { TerminalSocketEvent::FinalizeIdle }, tick = heartbeat.tick() => TerminalSocketEvent::Heartbeat(tick), }; let msg = match event { TerminalSocket...
rust_dataset_chunk_511865
rust_dataset.txt
511,865
512
}; parse_stdin( msg.as_bytes(), client_connection.clone(), &mut mouse_old_event, &mut stdin_session, ); }, Message::Pong(_) => { heartbeat.pong_received(); ...
rust_dataset_chunk_511866
rust_dataset.txt
511,866
512
, command: None, pane_name: None, near_current_pane: false, no_focus: false, borderless: None, tab_id: None, border_style: None, }, terminal_id: Non...
rust_dataset_chunk_511867
rust_dataset.txt
511,867
512
false, }, WebClientToWebServerControlMessagePayload::Detach => ClientToServerMsg::Action { action: Action::Detach, terminal_id: None, client_id: None, is_cli_client: false, }, WebClientToWebServerControlMessagePayload::Quit => ClientToServ...
rust_dataset_chunk_511868
rust_dataset.txt
511,868
512
_client_id": "abc", "payload": { "type": "TerminalMetrics", "cell_pixel_width": 7, "cell_pixel_height": 14, "text_area_pixel_width": 560, "text_area_pixel_height": 336, } }); let parsed: WebClientToWe...
rust_dataset_chunk_511869
rust_dataset.txt
511,869
512
} #[test] fn new_pane_in_tab_payload_deserializes() { let raw = serde_json::json!({ "web_client_id": "abc", "payload": { "type": "NewPaneInTab", "tab_id": 2, } }); let parsed: WebClientToWebServerControlMessage = ...
rust_dataset_chunk_511870
rust_dataset.txt
511,870
512
pane is opened in the client's own tab so that it is focused for it, \ keeping single-pane mode attached to the new pane" ); assert!(!no_focus, "The new pane takes focus"); }, other => panic!("expected a NewTiledPane action, got {:?}", other)...
rust_dataset_chunk_511871
rust_dataset.txt
511,871
512
) .is_none()); } fn structured_input_payloads() -> Vec<WebClientToWebServerControlMessagePayload> { use zellij_utils::data::{BareKey, KeyWithModifier}; vec![ WebClientToWebServerControlMessagePayload::Key { key: KeyWithModifier::new(BareKey::Char('a')...
rust_dataset_chunk_511872
rust_dataset.txt
511,872
512
ToServerMsg::Action { action: Action::MouseEvent { event }, terminal_id: None, client_id: None, is_cli_client: false, }, "a typed mouse event keeps the fields an SGR encoding cannot carry" ); let paste = control_pay...
rust_dataset_chunk_511873
rust_dataset.txt
511,873
512
json!({ "web_client_id": "abc", "payload": { "type": "Mouse", "event": { "event_type": "Press", "left": true, "right": false, "middle": false, "wheel_up": false, ...
rust_dataset_chunk_511874
rust_dataset.txt
511,874
512
::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; use std::sync::{Arc, Condvar, Mutex}; use std::time::Instant; use crate::deadline::{ProgressDeadline, CLIENT_SCREEN_PROGRESS}; use zellij_server::panes::kitty_graphics::KittyImageStore; pub use zellij_server::panes::terminal_character::AnsiCode; use zell...
rust_dataset_chunk_511875
rust_dataset.txt
511,875
512
"\x1b]7501;?\x1b\\"; struct HostResponder { host_terminal: HostTerminal, stdin_tx: crossbeam::channel::Sender<Vec<u8>>, carry: Vec<u8>, } impl HostResponder { fn answers(&self) -> Vec<(&'static [u8], Vec<u8>)> { let static_answers: &[(&'static [u8], &'static [u8])] = match self.host_terminal {...
rust_dataset_chunk_511876
rust_dataset.txt
511,876
512
{ replies.extend_from_slice(reply); index += query.len(); continue; } if answers.iter().any(|(query, _)| query.starts_with(rest)) { self.carry = rest.to_vec(); break; ...
rust_dataset_chunk_511877
rust_dataset.txt
511,877
512
received_bytes.bytes, size); let (byte_count, generation) = (received_bytes.bytes.len(), received_bytes.generation); drop(received_bytes); panic!( "timed out waiting for: {}\n{}\nlast rendered grid:\n{}\n=== (received {} stdout byte...
rust_dataset_chunk_511878
rust_dataset.txt
511,878
512
); } let last_generation = received_bytes.generation; let (guard, _) = self .inner .change_signal .wait_timeout(received_bytes, deadline.remaining(now)) .unwrap(); received_bytes = guard; ...
rust_dataset_chunk_511879
rust_dataset.txt
511,879
512
pub background: Option<AnsiCode>, } #[derive(Clone, Debug)] pub struct GridSnapshot { pub text: String, pub cursor: Option<CursorPosition>, pub styles: Vec<Vec<CellStyle>>, } impl GridSnapshot { pub fn contains(&self, needle: &str) -> bool { self.text.contains(needle) } pub fn cell_st...
rust_dataset_chunk_511880
rust_dataset.txt
511,880
512
for y in y_range { for x in x_range.clone() { if self.char_is_dim(x, y) { return true; } } } false } pub fn line_has_dim(&self, needle: &str) -> bool { match self.row_of_line(needle) { Some(y) => sel...
rust_dataset_chunk_511881
rust_dataset.txt
511,881
512
ane.grid, bytes); let cursor = terminal_pane .cursor_coordinates() .and_then(|(x, y, visible)| { if visible { Some(CursorPosition { x, y }) } else { None } }); let mut text = String::new(); let mut styles: Vec<Vec<C...
rust_dataset_chunk_511882
rust_dataset.txt
511,882
512
: 21, width: 8, }))); let sixel_image_store = Rc::new(RefCell::new(Default::default())); let terminal_emulator_colors = Rc::new(RefCell::new(Palette::default())); let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new())); let initial_pane_title = None; let invoked_with = ...
rust_dataset_chunk_511883
rust_dataset.txt
511,883
512
, last_progress_at: Instant, hard_cap_at: Instant, } impl ProgressDeadline { pub(crate) fn starting_now(phrases: ProgressPhrases) -> Self { Self::with_budgets(phrases, crate::default_timeout(), crate::hard_cap_timeout()) } pub(crate) fn with_budgets( phrases: ProgressPhrases, ...
rust_dataset_chunk_511884
rust_dataset.txt
511,884
512
(no_progress: u64, hard_cap: u64) -> ProgressDeadline { ProgressDeadline::with_budgets( CLIENT_SCREEN_PROGRESS, Duration::from_millis(no_progress), Duration::from_millis(hard_cap), ) } #[test] fn silence_trips_the_no_progress_tier_and_names_it() { ...
rust_dataset_chunk_511885
rust_dataset.txt
511,885
512
assert_eq!(deadline.hard_cap_budget, Duration::from_millis(100)); let inside = deadline.last_progress_at + Duration::from_millis(50); assert!(deadline.expired(inside).is_none()); } } --- FILE: zellij/zellij-integration-tests/src/fake_client_os_api.rs --- use std::collections::HashMap; use ...
rust_dataset_chunk_511886
rust_dataset.txt
511,886
512
Keyboard", ServerToClientMsg::StartWebServer => "StartWebServer", ServerToClientMsg::RenamedSession { .. } => "RenamedSession", ServerToClientMsg::ConfigFileUpdated => "ConfigFileUpdated", ServerToClientMsg::TerminalSettingsChanged { .. } => "TerminalSettingsChanged", ServerToCli...
rust_dataset_chunk_511887
rust_dataset.txt
511,887
512
mut self, buf: &mut [u8]) -> std::io::Result<usize> { if self.pending.is_empty() { match self.receiver.recv() { Ok(bytes) => self.pending = bytes, Err(_) => return Ok(0), } } let count = buf.len().min(self.pending.len()); buf[..coun...
rust_dataset_chunk_511888
rust_dataset.txt
511,888
512
client_id: None, is_cli_client: false, }; if let Some(sender) = self.server_sender.lock().unwrap().as_mut() { let _ = sender.send_client_msg(msg); } } } impl FakeClientOsApi { pub fn new( initial_size: Size, server_spawner: Option<ServerSpawner>,...
rust_dataset_chunk_511889
rust_dataset.txt
511,889
512
ClientOsApi for FakeClientOsApi { fn get_terminal_size(&self) -> Size { *self.size.lock().unwrap() } fn set_raw_mode(&mut self) {} fn unset_raw_mode(&self) -> Result<(), std::io::Error> { Ok(()) } fn get_stdout_writer(&self) -> Box<dyn std::io::Write> { self.client_scree...
rust_dataset_chunk_511890
rust_dataset.txt
511,890
512
)); if let ServerToClientMsg::TerminalSettingsChanged { settings } = msg { self.received_terminal_settings .lock() .unwrap() .push((**settings).clone()); } } received } fn handle_signals( ...
rust_dataset_chunk_511891
rust_dataset.txt
511,891
512
fn env_variable(&self, name: &str) -> Option<String> { self.env.lock().unwrap().get(name).cloned() } fn should_install_panic_hook(&self) -> bool { false } } --- FILE: zellij/zellij-integration-tests/src/fake_pty.rs --- use std::collections::{HashMap, VecDeque}; use std::sync::{Arc, Con...
rust_dataset_chunk_511892
rust_dataset.txt
511,892
512
-> String { let mut fake_pty_state_lines: Vec<String> = self .fake_pty_states .iter() .map(|(terminal_id, fake_pty_state)| { format!("terminal {}: {}", terminal_id, fake_pty_state.describe()) }) .collect(); fake_pty_state_lines...
rust_dataset_chunk_511893
rust_dataset.txt
511,893
512
: None, size_history: Vec::new(), quit_cb, exited: false, echo: true, stdin_tap: None, foreground: Vec::new(), foreground_reported: false, }, ); ...
rust_dataset_chunk_511894
rust_dataset.txt
511,894
512
.get_mut(&terminal_id) { // like a real pty, setting the same size again is a no-op that will not make the // program inside the terminal react (the kernel only sends a SIGWINCH if the // winsize actually changed) if fake_pty_state.size != Some((cols, rows...
rust_dataset_chunk_511895
rust_dataset.txt
511,895
512
FAKE_PTY_PROGRESS), what, condition, ) } fn wait_for_within<T>( &self, mut deadline: ProgressDeadline, what: &str, mut condition: impl FnMut(&mut FakePtyRegistry) -> Option<T>, ) -> T { let mut fake_pty_registry = self.lock_registry();...
rust_dataset_chunk_511896
rust_dataset.txt
511,896
512
for FakeAsyncReader { async fn read_chunk(&mut self, max: usize) -> Result<Vec<u8>, std::io::Error> { if self.pending.is_empty() { match self.output_rx.recv().await { Some(bytes) => self.pending.extend(bytes), None => return Ok(Vec::new()), } ...
rust_dataset_chunk_511897
rust_dataset.txt
511,897
512
()) }, ); } pub fn disable_echo(&self) { self.shared_ptys.mutate(|fake_pty_registry| { if let Some(fake_pty_state) = fake_pty_registry.fake_pty_states.get_mut(&self.terminal_id) { fake_pty_state.echo = false; } ...
rust_dataset_chunk_511898
rust_dataset.txt
511,898
512
fake_pty_state| fake_pty_state.exited) .unwrap_or(true) }) } pub fn stdin_bytes(&self) -> Vec<u8> { self.shared_ptys.read(|fake_pty_registry| { fake_pty_registry .fake_pty_states .get(&self.terminal_id) .map(|fake_pty_s...
rust_dataset_chunk_511899
rust_dataset.txt
511,899
512
, u16)) -> Option<(u16, u16)> { self.shared_ptys .wait_for_change(self.terminal_id, last_seen) } } #[cfg(test)] mod tests { use super::*; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc as StdArc; const NO_PROGRESS_MS: u64 = 200; const HARD_CAP_MS: u64 = 6...