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_511500 | rust_dataset.txt | 511,500 | 512 | ,
Payload(Option<String>),
}
const STREAM_BATCH_BYTES: usize = 256 * 1024;
pub(crate) fn next_payload(
queued: &mut VecDeque<Option<String>>,
batch: bool,
) -> Option<Option<String>> {
let first = queued.pop_front()?;
let Some(mut payload) = first else {
return Some(None);
};
if ba... |
rust_dataset_chunk_511501 | rust_dataset.txt | 511,501 | 512 | , &request.pipe_id, message) {
Some(PipeWaitOutcome::Released(Some(exit_code))) => return exit_code,
Some(PipeWaitOutcome::Released(None)) => {
waiting_for_release = false;
if input_ended && queued.is_empty() {
... |
rust_dataset_chunk_511502 | rust_dataset.txt | 511,502 | 512 | request, payload, b'\n', false)
}
pub fn start_prompt_client(
mut os_input: Box<dyn ClientOsApi>,
session_name: &str,
prompt_cli: PromptCli,
plugin_url: String,
) -> i32 {
let is_piped = !os_input.stdin_is_terminal();
let plan = match plan_prompt(
&prompt_cli,
|| {
l... |
rust_dataset_chunk_511503 | rust_dataset.txt | 511,503 | 512 | ,
in_place: None,
pane_id: Some(pane_id),
cwd: None,
pane_title: Some(format!("prompt: {}", plan.element.name())),
popup: Some(prompt_cli.placement()),
popup_no_focus: !prompt_cli.takes_focus(),
popup_capture_all_keys: prompt_cli.answer_args().capture_all_keys,
... |
rust_dataset_chunk_511504 | rust_dataset.txt | 511,504 | 512 | romptPlan, String> {
let mut args = BTreeMap::new();
let answer_args = prompt_cli.answer_args();
if let Some(title) = &prompt_cli.title {
args.insert(prompt::ARG_TITLE.to_owned(), title.clone());
}
if let Some(timeout) = &prompt_cli.timeout {
prompt::parse_duration(timeout).map_err(|... |
rust_dataset_chunk_511505 | rust_dataset.txt | 511,505 | 512 | {
args.insert(prompt::ARG_LABELS.to_owned(), "true".to_owned());
}
if *null {
args.insert(prompt::ARG_NULL.to_owned(), "true".to_owned());
}
if !selected.is_empty() {
args.insert(
prompt::ARG_SELECTED.to... |
rust_dataset_chunk_511506 | rust_dataset.txt | 511,506 | 512 | let range = match (min, max) {
(Some(min), Some(max)) => format!("between {} and {}", min, max),
(Some(min), None) => format!("at least {}", min),
(_, Some(max)) => format!("at most {}", max),
_ => String::new(),
... |
rust_dataset_chunk_511507 | rust_dataset.txt | 511,507 | 512 | the form description with --spec or on stdin",
));
}
read_stdin()?
},
};
let form_spec = prompt::parse_form_spec(&text)?;
prompt::check_form_patterns(&form_spec, check_pattern)?;
if let Some(... |
rust_dataset_chunk_511508 | rust_dataset.txt | 511,508 | 512 | log_lines }, _)) => {
log_lines.iter().for_each(|line| eprintln!("{line}"));
return Some(2);
},
Ok((ServerToClientMsg::Exit { exit_reason }, _)) => match exit_reason {
ExitReason::Error(e) => {
eprintln!("{}", e);
... |
rust_dataset_chunk_511509 | rust_dataset.txt | 511,509 | 512 | _input.recv_from_server() {
Some((
ServerToClientMsg::PaneRenderUpdate {
pane_id,
viewport,
scrollback,
is_initial,
},
_,
)) => match subscribe_cli.format {
... |
rust_dataset_chunk_511510 | rust_dataset.txt | 511,510 | 512 | let zellij_ipc_pipe: PathBuf = {
let sock_dir = zellij_utils::consts::ZELLIJ_SOCK_DIR.clone();
fs::create_dir_all(&sock_dir).unwrap();
zellij_utils::shared::set_permissions(&sock_dir, 0o700).unwrap();
zellij_utils::sessions::resolve_session_socket_path(session_name)
.unwr... |
rust_dataset_chunk_511511 | rust_dataset.txt | 511,511 | 512 | mut self) {
let (lock, cvar) = &*self.input_thread;
let mut input_thread = lock.lock().unwrap();
*input_thread = false;
cvar.notify_all();
}
pub fn wait_until_input_thread_is_unblocked(&self) {
let (lock, cvar) = &*self.input_thread;
let mut input_thread = lock.lo... |
rust_dataset_chunk_511512 | rust_dataset.txt | 511,512 | 512 | writer.set_supported().unwrap();
assert!(written.starts_with("\u{1b}]7501;state=blocked:app=zellij:kind=permission:msg="));
assert!(written.ends_with("\u{1b}\\"));
assert_eq!(
writer.teardown(),
Some("\u{1b}]7501;state=clear\u{1b}\\".to_owned())
);
assert... |
rust_dataset_chunk_511513 | rust_dataset.txt | 511,513 | 512 | Message},
position::Position,
vendored::termwiz::input::{
InputEvent, Modifiers, MouseButtons, MouseEvent as TermwizMouseEvent,
},
};
/// Handles the dispatching of [`Action`]s according to the current
/// [`InputMode`], and keep tracks of the current [`InputMode`].
struct InputHandler {
/// Th... |
rust_dataset_chunk_511514 | rust_dataset.txt | 511,514 | 512 | to maintain a wee bit of
// state in between events.
//
// Note that only Left, Right, and Middle are saved in between
// calls. WheelUp/WheelDown typically do not generate Release
// events.
let mut new_event = MouseEvent::new();
termwiz_mouse_convert(&mut new_event, &event);
new_even... |
rust_dataset_chunk_511515 | rust_dataset.txt | 511,515 | 512 | with the attributes specified as arguments.
fn new(
os_input: Box<dyn ClientOsApi>,
command_is_executing: CommandIsExecuting,
config: Config,
options: Options,
send_client_instructions: SenderWithContext<ClientInstruction>,
mode: InputMode, // TODO: we can probably g... |
rust_dataset_chunk_511516 | rust_dataset.txt | 511,516 | 512 | (
ClientToServerMsg::HostTerminalFocusChanged { focused: true },
);
},
InputEvent::FocusLost => {
self.os_input.send_to_server(
ClientToServerMsg::HostT... |
rust_dataset_chunk_511517 | rust_dataset.txt | 511,517 | 512 | si_stdin_instructions {
self.handle_stdin_ansi_instruction(ansi_instruction);
}
},
Ok((InputInstruction::DesktopNotificationResponse(raw_bytes), _error_context)) => {
self.os_input
.send_to_server(Cli... |
rust_dataset_chunk_511518 | rust_dataset.txt | 511,518 | 512 | AnsiStdinInstruction::ForegroundColor(foreground_color_instruction) => {
self.os_input
.send_to_server(ClientToServerMsg::ForegroundColor {
color: foreground_color_instruction,
});
},
AnsiStdinInstruction... |
rust_dataset_chunk_511519 | rust_dataset.txt | 511,519 | 512 | Message::Pong),
))
.unwrap();
},
Some(_) => {
self.os_input
.send_to_server(ClientToServerMsg::NestedSessionFrameFromHost {
payload_bytes,
});
},
None =... |
rust_dataset_chunk_511520 | rust_dataset.txt | 511,520 | 512 | NewTiledPane { .. }
| Action::NewFloatingPane { .. }
| Action::ToggleFloatingPanes
| Action::TogglePaneEmbedOrFloating
| Action::NewTab { .. }
| Action::GoToNextTab
| Action::GoToPreviousTab
| Action::CloseTab
| Action::GoTo... |
rust_dataset_chunk_511521 | rust_dataset.txt | 511,521 | 512 | ();
}
--- FILE: zellij/zellij-client/src/keyboard_parser.rs ---
// for more info, please see: https://sw.kovidgoyal.net/kitty/keyboard-protocol
use zellij_utils::data::KeyWithModifier;
#[derive(Debug)]
enum KittyKeysParsingState {
Ground,
ReceivedEscapeCharacter,
ParsingNumber,
ParsingModifiers,
... |
rust_dataset_chunk_511522 | rust_dataset.txt | 511,522 | 512 | same
/// state machine as `parse()` but:
/// * resets to Ground after producing `Complete`/`NoMatch`, so the
/// parser can be reused for the next sequence;
/// * preserves state on `Incomplete`, so a sequence split across
/// chunks still resolves on a follow-up call.
///
/// The exist... |
rust_dataset_chunk_511523 | rust_dataset.txt | 511,523 | 512 | A` etc. (Complete).
match self.modifier_bytes.last().copied() {
Some(last) if is_csi_final_letter(last) => {
let last_modifier = self.modifier_bytes.pop().unwrap();
let result = KeyWithModifier::from_bytes_with_no_ending_byte(
... |
rust_dataset_chunk_511524 | rust_dataset.txt | 511,524 | 512 | assertion shape (`Some(KeyWithModifier { … })`) stays
/// readable. The full-byte tests in this file expect the input to be a
/// single complete sequence; `Incomplete` and `NoMatch` both flatten to
/// `None`.
#[cfg(test)]
fn parse_for_test(bytes: &[u8]) -> Option<KeyWithModifier> {
match KittyKeyboardParser::new... |
rust_dataset_chunk_511525 | rust_dataset.txt | 511,525 | 512 | );
let key = "\u{1b}[57359u";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::ScrollLock)),
"Can parse a bare 'ScrollLock' keypress"
);
let key = "\u{1b}[57360u";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifi... |
rust_dataset_chunk_511526 | rust_dataset.txt | 511,526 | 512 | (KeyWithModifier::new(BareKey::Home)),
"Can parse a bare 'Home' keypress"
);
let key = "\u{1b}[8~";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::End)),
"Can parse a bare 'End' keypress"
);
let key = "\u{1b}[11~";
assert_eq!(
... |
rust_dataset_chunk_511527 | rust_dataset.txt | 511,527 | 512 | keypress"
);
let key = "\u{1b}[20~";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::F(9))),
"Can parse a bare 'F9' keypress"
);
let key = "\u{1b}[21~";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(B... |
rust_dataset_chunk_511528 | rust_dataset.txt | 511,528 | 512 | areKey::End)),
"Can parse a bare 'End' keypress"
);
let key = "\u{1b}[P";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::F(1))),
"Can parse a bare 'F1 (alternate)' keypress"
);
let key = "\u{1b}[Q";
assert_eq!(
parse_for_tes... |
rust_dataset_chunk_511529 | rust_dataset.txt | 511,529 | 512 | u{1b}[27;2u";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::Esc).with_shift_modifier()),
"Can parse a bare 'ESC' keypress with shift"
);
let key = "\u{1b}[13;2u";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::ne... |
rust_dataset_chunk_511530 | rust_dataset.txt | 511,530 | 512 | _test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::Pause).with_shift_modifier()),
"Can parse a bare 'Pause' keypress with shift"
);
let key = "\u{1b}[57363;2u";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::Menu).with_shift_modifier()),... |
rust_dataset_chunk_511531 | rust_dataset.txt | 511,531 | 512 | parse a bare 'F1' keypress with shift"
);
let key = "\u{1b}[12;2~";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::F(2)).with_shift_modifier()),
"Can parse a bare 'F2' keypress with shift"
);
let key = "\u{1b}[13;2~";
assert_eq!(
p... |
rust_dataset_chunk_511532 | rust_dataset.txt | 511,532 | 512 | press with shift"
);
let key = "\u{1b}[21;2~";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::F(10)).with_shift_modifier()),
"Can parse a bare 'F10' keypress with shift"
);
let key = "\u{1b}[23;2~";
assert_eq!(
parse_for_test(key.as... |
rust_dataset_chunk_511533 | rust_dataset.txt | 511,533 | 512 | _eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::End).with_shift_modifier()),
"Can parse a bare 'End' keypress with shift"
);
let key = "\u{1b}[1;2P";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::F(1)).with_shi... |
rust_dataset_chunk_511534 | rust_dataset.txt | 511,534 | 512 | with alt"
);
let key = "\u{1b}[49;3u";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::Char('1')).with_alt_modifier()),
"Can parse a bare '1' keypress with alt"
);
let key = "\u{1b}[27;3u";
assert_eq!(
parse_for_test(key.as_bytes())... |
rust_dataset_chunk_511535 | rust_dataset.txt | 511,535 | 512 | u";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::PrintScreen).with_alt_modifier()),
"Can parse a bare 'PrintScreen' keypress with alt"
);
let key = "\u{1b}[57362;3u";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifie... |
rust_dataset_chunk_511536 | rust_dataset.txt | 511,536 | 512 | ::End).with_alt_modifier()),
"Can parse a bare 'End' keypress with alt"
);
let key = "\u{1b}[11;3~";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::F(1)).with_alt_modifier()),
"Can parse a bare 'F1' keypress with alt"
);
let key = "\u{1... |
rust_dataset_chunk_511537 | rust_dataset.txt | 511,537 | 512 | Can parse a bare 'F8' keypress with alt"
);
let key = "\u{1b}[20;3~";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::F(9)).with_alt_modifier()),
"Can parse a bare 'F9' keypress with alt"
);
let key = "\u{1b}[21;3~";
assert_eq!(
pars... |
rust_dataset_chunk_511538 | rust_dataset.txt | 511,538 | 512 | u{1b}[1;3H";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::Home).with_alt_modifier()),
"Can parse a bare 'Home' keypress with alt"
);
let key = "\u{1b}[1;3F";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(Ba... |
rust_dataset_chunk_511539 | rust_dataset.txt | 511,539 | 512 | _modifier() {
use zellij_utils::data::BareKey;
let key = "\u{1b}[97;5u";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier()),
"Can parse a bare 'a' keypress with ctrl"
);
let key = "\u{1b}[49;5u";
assert_eq!(
... |
rust_dataset_chunk_511540 | rust_dataset.txt | 511,540 | 512 | u{1b}[57360;5u";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::NumLock).with_ctrl_modifier()),
"Can parse a bare 'NumLock' keypress with ctrl"
);
let key = "\u{1b}[57361;5u";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWith... |
rust_dataset_chunk_511541 | rust_dataset.txt | 511,541 | 512 | _bytes()),
Some(KeyWithModifier::new(BareKey::Home).with_ctrl_modifier()),
"Can parse a bare 'Home' keypress with ctrl"
);
let key = "\u{1b}[8;5~";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::End).with_ctrl_modifier()),
"Can parse a ... |
rust_dataset_chunk_511542 | rust_dataset.txt | 511,542 | 512 | (7)).with_ctrl_modifier()),
"Can parse a bare 'F7' keypress with ctrl"
);
let key = "\u{1b}[19;5~";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::F(8)).with_ctrl_modifier()),
"Can parse a bare 'F8' keypress with ctrl"
);
let key = "\u{... |
rust_dataset_chunk_511543 | rust_dataset.txt | 511,543 | 512 | keypress with ctrl"
);
let key = "\u{1b}[1;5B";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::Down).with_ctrl_modifier()),
"Can parse a bare 'Down' keypress with ctrl"
);
let key = "\u{1b}[1;5H";
assert_eq!(
parse_for_test(key.as_... |
rust_dataset_chunk_511544 | rust_dataset.txt | 511,544 | 512 | ctrl"
);
let key = "\u{1b}[1098;5u";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::Char('ъ')).with_ctrl_modifier()),
"Can parse a bare 'ъ' keypress with ctrl"
);
}
#[test]
pub fn can_parse_keys_with_super_modifier() {
use zellij_utils::data:... |
rust_dataset_chunk_511545 | rust_dataset.txt | 511,545 | 512 | CapsLock' keypress with super"
);
let key = "\u{1b}[57359;9u";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::ScrollLock).with_super_modifier()),
"Can parse a bare 'ScrollLock' keypress with super"
);
let key = "\u{1b}[57360;9u";
assert_eq!... |
rust_dataset_chunk_511546 | rust_dataset.txt | 511,546 | 512 | }[6;9~";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::PageDown).with_super_modifier()),
"Can parse a bare 'PageDown' keypress with super"
);
let key = "\u{1b}[7;9~";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier... |
rust_dataset_chunk_511547 | rust_dataset.txt | 511,547 | 512 | .as_bytes()),
Some(KeyWithModifier::new(BareKey::F(6)).with_super_modifier()),
"Can parse a bare 'F6' keypress with super"
);
let key = "\u{1b}[18;9~";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::F(7)).with_super_modifier()),
"Can pa... |
rust_dataset_chunk_511548 | rust_dataset.txt | 511,548 | 512 | areKey::Right).with_super_modifier()),
"Can parse a bare 'Right' keypress with super"
);
let key = "\u{1b}[1;9A";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::Up).with_super_modifier()),
"Can parse a bare 'Up' keypress with super"
);
... |
rust_dataset_chunk_511549 | rust_dataset.txt | 511,549 | 512 | bare 'п' keypress with super"
);
let key = "\u{1b}[1255;9u";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(KeyWithModifier::new(BareKey::Char('ӧ')).with_super_modifier()),
"Can parse a bare 'ӧ' keypress with super"
);
let key = "\u{1b}[1098;9u";
assert_eq!(
pa... |
rust_dataset_chunk_511550 | rust_dataset.txt | 511,550 | 512 | key = "\u{1b}[9;16u";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(
KeyWithModifier::new(BareKey::Tab)
.with_super_modifier()
.with_ctrl_modifier()
.with_alt_modifier()
.with_shift_modifier()
),
"Can par... |
rust_dataset_chunk_511551 | rust_dataset.txt | 511,551 | 512 | Screen' keypress with all modifiers"
);
let key = "\u{1b}[57362;16u";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(
KeyWithModifier::new(BareKey::Pause)
.with_super_modifier()
.with_ctrl_modifier()
.with_alt_modifier()
... |
rust_dataset_chunk_511552 | rust_dataset.txt | 511,552 | 512 | a bare 'PageDown' keypress with all modifiers"
);
let key = "\u{1b}[7;16~";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(
KeyWithModifier::new(BareKey::Home)
.with_super_modifier()
.with_ctrl_modifier()
.with_alt_modifier()
... |
rust_dataset_chunk_511553 | rust_dataset.txt | 511,553 | 512 | with_shift_modifier()
),
"Can parse a bare 'F4' keypress with all modifiers"
);
let key = "\u{1b}[15;16~";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(
KeyWithModifier::new(BareKey::F(5))
.with_super_modifier()
.with_ctrl_modif... |
rust_dataset_chunk_511554 | rust_dataset.txt | 511,554 | 512 | _modifier()
.with_ctrl_modifier()
.with_alt_modifier()
.with_shift_modifier()
),
"Can parse a bare 'F10' keypress with all modifiers"
);
let key = "\u{1b}[23;16~";
assert_eq!(
parse_for_test(key.as_bytes()),
Some(
Ke... |
rust_dataset_chunk_511555 | rust_dataset.txt | 511,555 | 512 | )
.with_super_modifier()
.with_ctrl_modifier()
.with_alt_modifier()
.with_shift_modifier()
),
"Can parse a bare 'Down' keypress with all modifiers"
);
let key = "\u{1b}[1;16H";
assert_eq!(
parse_for_test(key.as_bytes()),... |
rust_dataset_chunk_511556 | rust_dataset.txt | 511,556 | 512 | _for_test(key.as_bytes()),
Some(
KeyWithModifier::new(BareKey::Char('п'))
.with_super_modifier()
.with_ctrl_modifier()
.with_alt_modifier()
.with_shift_modifier()
),
"Can parse a bare 'п' keypress with all modifiers"
... |
rust_dataset_chunk_511557 | rust_dataset.txt | 511,557 | 512 | = KittyKeyboardParser::new();
for &b in &full[..full.len() - 1] {
assert!(
matches!(p.feed(&[b]), KittyParseOutcome::Incomplete),
"byte 0x{:02x} should be Incomplete",
b
);
}
match p.feed(&[full[full.len() - 1]]) {
KittyParseOutcome::Complete(k) =... |
rust_dataset_chunk_511558 | rust_dataset.txt | 511,558 | 512 | #[cfg(feature = "web_server_capability")]
use tokio_tungstenite::tungstenite::Message;
#[cfg(feature = "web_server_capability")]
use crate::web_client::control_message::{
WebClientToWebServerControlMessage, WebClientToWebServerControlMessagePayload,
WebServerToWebClientControlMessage,
};
#[cfg(feature = "web_... |
rust_dataset_chunk_511559 | rust_dataset.txt | 511,559 | 512 | h";
/// Cancel the CSI 2031 subscription (sent on detach / shutdown so we
/// don't leave the host emitting DSR 997s into nothing).
const DISABLE_HOST_THEME_NOTIFY: &str = "\u{1b}[?2031l";
/// Actively query the current host theme (DSR 996). Reply arrives in the
/// same `CSI ? 997 ; {1|2} n` form as unsolicited notifi... |
rust_dataset_chunk_511560 | rust_dataset.txt | 511,560 | 512 | io::runtime::Builder::new_multi_thread()
.worker_threads(number_of_workers)
.thread_name("zellij client async-runtime")
.enable_all()
.build()
.expect("Failed to create tokio runtime")
});
runtime... |
rust_dataset_chunk_511561 | rust_dataset.txt | 511,561 | 512 | envs,
errors::{ClientContext, ContextType, ErrorInstruction},
input::{
cli_assets::{host_terminal_env, CliAssets},
config::Config,
options::Options,
},
ipc::{ClientToServerMsg, ExitReason, IpcReceiveError, ServerToClientMsg},
nested_session,
pane_size::Size,
vendo... |
rust_dataset_chunk_511562 | rust_dataset.txt | 511,562 | 512 | ClientMsg::UnblockCliPipeInput { .. } => {
ClientInstruction::UnblockCliPipeInput(())
},
ServerToClientMsg::CliPipeOutput { .. } => ClientInstruction::CliPipeOutput((), ()),
ServerToClientMsg::QueryTerminalSize => ClientInstruction::QueryTerminalSize,
Serv... |
rust_dataset_chunk_511563 | rust_dataset.txt | 511,563 | 512 | &ClientInstruction) -> Self {
match *client_instruction {
ClientInstruction::Exit(_) => ClientContext::Exit,
ClientInstruction::Error(_) => ClientContext::Error,
ClientInstruction::Render(_) => ClientContext::Render,
ClientInstruction::UnblockInputThread => Clien... |
rust_dataset_chunk_511564 | rust_dataset.txt | 511,564 | 512 | config file, we'll use it
// to start the webserver
cmd.arg("--config");
cmd.arg(format!("{}", config_file_path.display()));
}
cmd.arg("web");
cmd.arg("-d");
let output = cmd.output();
match output {
Ok(output) => {
if output.status.success() {
... |
rust_dataset_chunk_511565 | rust_dataset.txt | 511,565 | 512 | cli_args: &CliArgs) -> Result<String, String> {
log::error!(
"This version of Zellij was compiled without web server support, cannot run web server!"
);
Ok("".to_owned())
}
fn ipc_pipe_length_error(ipc_pipe: &Path) -> Option<String> {
use zellij_utils::consts::{
socket_path_length, SOCK... |
rust_dataset_chunk_511566 | rust_dataset.txt | 511,566 | 512 | _id))
}
fn check_ipc_pipe_length(ipc_pipe: &Path) {
if let Some(message) = ipc_pipe_length_error(ipc_pipe) {
eprintln!("{}", message);
std::process::exit(1);
}
}
#[derive(Clone, Copy)]
struct TerminalTeardown {
include_kitty_exit: bool,
}
fn exit_after_startup_error(teardown: Option<Termi... |
rust_dataset_chunk_511567 | rust_dataset.txt | 511,567 | 512 | format!(
"Error: failed to create the {} socket directory:\n {}\n\n\
Reason: {}\n\n\
This usually means the directory (or one of its parents) is owned by \
another user or is not writable - for example if {} was previously \
... |
rust_dataset_chunk_511568 | rust_dataset.txt | 511,568 | 512 | _DIR/<id>`.
fn create_ipc_pipe(name: &str, teardown: Option<TerminalTeardown>) -> PathBuf {
prepare_sock_dir(teardown);
let path = zellij_utils::consts::new_session_socket_path_in(&ZELLIJ_SOCK_DIR, name);
prepare_parent_dir(teardown, &path);
check_ipc_pipe_length(&path);
path
}
/// IPC pipe path fo... |
rust_dataset_chunk_511569 | rust_dataset.txt | 511,569 | 512 | => *initial_panes = Some(new_initial_panes),
_ => {},
}
}
}
#[derive(Debug, Clone)]
pub(crate) enum InputInstruction {
KeyEvent(InputEvent, Vec<u8>),
KeyWithModifierEvent(KeyWithModifier, Vec<u8>, bool), // bool = is_kitty_keyboard_protocol
#[allow(dead_code)] // constructed in std... |
rust_dataset_chunk_511570 | rust_dataset.txt | 511,570 | 512 | (new_size))
.await
{
log::error!("Failed to send resize message: {}", e);
}
let mut nested_frame_extractor = nested_session::NestedFrameExtractor::new();
let mut reannounce_scheduler =
nested_session::ReannounceScheduler::new(std::time::Instant::now());
let mut reannounce_ch... |
rust_dataset_chunk_511571 | rust_dataset.txt | 511,571 | 512 | }
}
}
_ = reannounce_check.tick() => {
if let Some(session_name) = &nested_session_name {
if reannounce_scheduler.on_tick(std::time::Instant::now()) {
let announce = nested_session::NestedSessionMessage::Announce {
... |
rust_dataset_chunk_511572 | rust_dataset.txt | 511,572 | 512 | ");
}
Some(Ok(Message::Close(_))) => {
break;
}
Some(Err(e)) => {
log::error!("Error: {}", e);
break;
}
None => {
... |
rust_dataset_chunk_511573 | rust_dataset.txt | 511,573 | 512 | pub fn start_remote_client(
mut os_input: Box<dyn ClientOsApi>,
remote_session_url: &str,
token: Option<String>,
remember: bool,
forget: bool,
ca_cert: Option<std::path::PathBuf>,
insecure: bool,
async_worker_tasks: Option<usize>,
) -> Result<Option<ConnectToSession>, RemoteClientError> ... |
rust_dataset_chunk_511574 | rust_dataset.txt | 511,574 | 512 | |info| {
os_input.disable_mouse().non_fatal();
os_input.restore_console_mode();
if let Ok(()) = os_input.unset_raw_mode() {
handle_panic::<ClientInstruction>(info, None);
}
})
});
let reset_controlling_terminal_state = |e: String, exit_st... |
rust_dataset_chunk_511575 | rust_dataset.txt | 511,575 | 512 | ::collections::BTreeMap<String, String>,
tab_position_to_focus: Option<usize>,
pane_id_to_focus: Option<(u32, bool)>,
switch_context: Option<zellij_utils::session_history::SwitchContext>,
) -> Handshake {
let is_web_client = false;
let layout_from_cli_args = |config_options: &Options| {
if l... |
rust_dataset_chunk_511576 | rust_dataset.txt | 511,576 | 512 | Client {
terminal_size: terminal_window_size,
is_web_client,
},
starts_server: false,
},
ClientInfo::Resurrect(_name, path_to_layout, force_run_commands, cwd) => Handshake {
message: ClientToServerMsg::FirstClientConnected {
... |
rust_dataset_chunk_511577 | rust_dataset.txt | 511,577 | 512 | is_some(),
web_client: false,
};
let own_session_name = info.get_session_name().to_owned();
if let Some(message) = sock_dir_ipc_pipe_length_error(&ZELLIJ_SOCK_DIR) {
eprintln!("{}", message);
std::process::exit(1);
}
let explicitly_disable_kitty_keyboard_protocol = config_op... |
rust_dataset_chunk_511578 | rust_dataset.txt | 511,578 | 512 | _or(false);
let dangerously_allow_web_serving_without_a_certificate = config_options
.dangerously_allow_web_serving_without_a_certificate
.unwrap_or(false);
let terminal_teardown = TerminalTeardown {
include_kitty_exit: !explicitly_disable_kitty_keyboard_protocol,
};
let Handsh... |
rust_dataset_chunk_511579 | rust_dataset.txt | 511,579 | 512 | {
os_input.send_to_server(ClientToServerMsg::NestedSessionFrameFromHost {
payload_bytes: nested_session::encode_payload(&message),
});
}
}
let nested_reannounce = crate::nested_reannounce::NestedReannounce::spawn(
os_input.clone(),
own_session_nam... |
rust_dataset_chunk_511580 | rust_dataset.txt | 511,580 | 512 |
// that arrive on stdin until the barrier reply closes the slot.
// The pane that asked gets the captured bytes piped to its pty.
//
// If the host never answers, we must close the slot anyway so
// the server can dispatch the next queued forward. A per-slot
// timer task enforces that deadline... |
rust_dataset_chunk_511581 | rust_dataset.txt | 511,581 | 512 | let _ = stdout.flush();
}
}
#[cfg(windows)]
let _ = &stdin_ansi_parser;
}
}),
Box::new({
... |
rust_dataset_chunk_511582 | rust_dataset.txt | 511,582 | 512 | = os_input.unset_raw_mode();
os_input.restore_console_mode();
let error = terminal_teardown_message(
&backtrace,
full_screen_ws.rows,
false,
include_grapheme_cluster_exit,
);
let mut stdout = os_input.get_stdout_writer();
let _ = s... |
rust_dataset_chunk_511583 | rust_dataset.txt | 511,583 | 512 | LogError(lines_to_log) => {
for line in lines_to_log {
log::error!("{line}");
}
},
ClientInstruction::SwitchSession(connect_to_session) => {
reconnect_to_session = Some(connect_to_session);
os_input.send_to_serve... |
rust_dataset_chunk_511584 | rust_dataset.txt | 511,584 | 512 | ::time::Duration::from_millis(
stdin_ansi_parser::CLIENT_CLIPBOARD_FORWARD_TIMEOUT_MS,
),
move |token, reply_bytes| {
let _ = sender_for_timer.send(
InputInstruction::ForwardedReplyFromHostComplete { toke... |
rust_dataset_chunk_511585 | rust_dataset.txt | 511,585 | 512 | _ansi_parser.clone();
let sender_for_timer = send_input_instructions.clone();
stdin_ansi_parser::schedule_forward_timeout(
runtime.handle(),
parser_for_timer,
token,
std::time::Duration::from_millis(500),
... |
rust_dataset_chunk_511586 | rust_dataset.txt | 511,586 | 512 | EXIT_DRAIN_TIMEOUT
};
quiet_host_input(
&*os_input,
&stdin_ansi_parser,
!explicitly_disable_kitty_keyboard_protocol,
exit_drain_timeout,
);
info!("{}", exit_msg);
let _ = os_input.unset_raw_mode();
os_input.restore_console_... |
rust_dataset_chunk_511587 | rust_dataset.txt | 511,587 | 512 | _run_layout_commands: force_run_commands,
cwd,
host_terminal_env: host_terminal_env(),
initial_panes: None,
switch_context: None,
};
let ipc_pipe = create_ipc_pipe(&name, None);
os_input.update_session_name(name);
... |
rust_dataset_chunk_511588 | rust_dataset.txt | 511,588 | 512 | _start_web_server {
if let Err(e) = spawn_web_server(&cli_args) {
log::error!("Failed to start web server: {}", e);
}
}
let is_web_client = false;
(
ClientToServerMsg::FirstClientConnected {
cli_... |
rust_dataset_chunk_511589 | rust_dataset.txt | 511,589 | 512 | _launcher().is_none()
}
#[cfg(not(all(unix, not(target_os = "macos"))))]
fn launcher_missing() -> bool {
false
}
fn input_reporting_off_sequence(include_kitty_exit: bool) -> String {
let kitty_exit = if include_kitty_exit {
EXIT_KITTY_KEYBOARD_MODE
} else {
""
};
format!(
"... |
rust_dataset_chunk_511590 | rust_dataset.txt | 511,590 | 512 | EXIT_ALTERNATE_SCREEN,
RESET_STYLE,
SHOW_CURSOR,
goto_start_of_last_line,
message
)
}
#[cfg(test)]
mod unit;
--- FILE: zellij/zellij-client/src/nested_reannounce.rs ---
use crate::os_input_output::ClientOsApi;
use std::io::Write;
use std::sync::atomic::{AtomicBool, Orderin... |
rust_dataset_chunk_511591 | rust_dataset.txt | 511,591 | 512 | ::HintReporting,
],
};
let mut stdout = os_input.get_stdout_writer();
if stdout
.write_all(&nested_session::encode_frame(&announce))
.is_ok()
{
... |
rust_dataset_chunk_511592 | rust_dataset.txt | 511,592 | 512 | h\u{1b}[?1006h";
pub(crate) const DISABLE_MOUSE_SUPPORT: &str =
"\u{1b}[?1006l\u{1b}[?1015l\u{1b}[?1003l\u{1b}[?1002l\u{1b}[?1000l";
/// Trait for async stdin reading, allowing for testable implementations
#[async_trait]
pub trait AsyncStdin: Send {
async fn read(&mut self) -> io::Result<Vec<u8>>;
}
pub struc... |
rust_dataset_chunk_511593 | rust_dataset.txt | 511,593 | 512 | _state: Arc<Mutex<RememberedHostState>>,
}
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub struct RememberedHostState {
pub focused: Option<bool>,
pub fullscreen: Option<bool>,
}
impl RememberedHostState {
pub fn note(&mut self, message: &zellij_utils::nested_session::NestedSessionMessage) {
... |
rust_dataset_chunk_511594 | rust_dataset.txt | 511,594 | 512 | line, also locks STDIN
fn get_stdin_reader(&self) -> Box<dyn io::BufRead>;
fn stdin_is_terminal(&self) -> bool {
true
}
fn stdout_is_terminal(&self) -> bool {
true
}
fn update_session_name(&mut self, new_session_name: String);
/// Returns the raw contents of standard input.
... |
rust_dataset_chunk_511595 | rust_dataset.txt | 511,595 | 512 | sterm's disable_raw_mode() leaves behind. No-op on other platforms.
fn restore_console_mode(&self) {}
fn discard_pending_input(&self) {}
fn env_variable(&self, _name: &str) -> Option<String> {
None
}
/// Returns an async stdin reader that can be polled in tokio::select
fn get_async_stdin... |
rust_dataset_chunk_511596 | rust_dataset.txt | 511,596 | 512 | // this can happen for example when switching sessions, the old thread will only be
// released once it sees input over STDIN
//
// when this happens, we detect in the other thread that our session is ended (by comparing
// the session name at the beginning of the call and the one after... |
rust_dataset_chunk_511597 | rust_dataset.txt | 511,597 | 512 | stdout();
stdout.is_terminal()
}
fn send_to_server(&self, msg: ClientToServerMsg) {
match self.send_instructions_to_server.lock().unwrap().as_mut() {
Some(sender) => {
let _ = sender.send_client_msg(msg);
},
None => {
log::warn... |
rust_dataset_chunk_511598 | rust_dataset.txt | 511,598 | 512 | (())
}
fn load_palette(&self) -> Palette {
// this was removed because termbg doesn't release stdin in certain scenarios (we know of
// windows terminal and FreeBSD): https://github.com/zellij-org/zellij/issues/538
//
// let palette = default_palette();
// let timeout = s... |
rust_dataset_chunk_511599 | rust_dataset.txt | 511,599 | 512 | edHostState::default())),
})
}
pub fn get_cli_client_os_input() -> Result<ClientOsInputOutput, std::io::Error> {
let reading_from_stdin = Arc::new(Mutex::new(None));
Ok(ClientOsInputOutput {
send_instructions_to_server: Arc::new(Mutex::new(None)),
receive_instructions_from_server: Arc::new(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.