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_516700 | rust_dataset.txt | 516,700 | 512 | reshaped = FrameBuilder::new(4, 1, 2);
reshaped.push_row(0, 0, &run("no"));
assert!(matches!(
state.apply_frame(&reshaped.finish()),
Err(FrameError::Unapplicable { seq: 2, .. })
));
assert_eq!(row_text(&state, 0), "kept ");
}
#[test]
fn the_frame_... |
rust_dataset_chunk_516701 | rust_dataset.txt | 516,701 | 512 | ]
fn bells_are_counted_and_drained() {
let mut state = TerminalState::new(2, 8);
state.apply_frame(&frame_of(8, 2, 0, b"\x07\x07")).unwrap();
assert_eq!(state.take_bells(), 2);
assert_eq!(state.take_bells(), 0);
}
#[test]
fn osc_9_and_osc_99_notifications_are_captured_wi... |
rust_dataset_chunk_516702 | rust_dataset.txt | 516,702 | 512 | assert!(
state.take_notifications().is_empty(),
"a chunk that says more is coming must not be shown on its own"
);
state
.apply_frame(&frame_of(8, 2, 1, b"\x1b]99;i=3:p=body;done\x1b\\"))
.unwrap();
assert_eq!(
state.take_notifications... |
rust_dataset_chunk_516703 | rust_dataset.txt | 516,703 | 512 | state
.apply_frame(&frame_of(8, 2, 0, b"\x1b]52;c;Y29waWVk\x1b\\"))
.unwrap();
assert_eq!(state.take_copied_text().as_deref(), Some("copied"));
assert_eq!(state.take_copied_text(), None);
}
#[test]
fn a_copy_carried_by_a_frame_the_viewport_moved_past_still_re... |
rust_dataset_chunk_516704 | rust_dataset.txt | 516,704 | 512 | : 2,
source_height: 2,
z: 0,
}
}
fn apply_graphics(state: &mut TerminalState, records: &[GraphicsRecord]) {
let size = state.size();
let mut builder = FrameBuilder::new(size.cols as u16, size.rows as u16, 0);
builder.extend_graphics(records.iter());
... |
rust_dataset_chunk_516705 | rust_dataset.txt | 516,705 | 512 | {
let directory = std::env::temp_dir();
let path = directory.join(format!(
"zellij-terminal-remote-test-{}",
std::process::id()
));
let pixels = rgba([0, 0, 255, 255], 4);
std::fs::write(&path, &pixels).unwrap();
let mut state = TerminalState::ne... |
rust_dataset_chunk_516706 | rust_dataset.txt | 516,706 | 512 | , &[GraphicsRecord::DeleteImage { id: 1 }]);
assert_eq!(state.graphics().placements().count(), 0);
assert!(state.graphics().image(1).is_none());
}
#[test]
fn a_clear_record_retires_every_image_and_placement() {
let mut state = TerminalState::new(6, 12);
apply_graphics(
... |
rust_dataset_chunk_516707 | rust_dataset.txt | 516,707 | 512 | GraphicsRecord::SixelChunk {
cell_x,
cell_y,
pixel_x: 0,
pixel_y: 0,
pixel_width: width,
pixel_height: bands * 6,
payload: sixel_image(width as usize, bands as usize),
}
}
#[test]
fn a_full_repaint_retires_t... |
rust_dataset_chunk_516708 | rust_dataset.txt | 516,708 | 512 | 0, 255]);
assert_eq!(&chunk.image.pixels[stride * 20..stride * 20 + 4], &[0; 4]);
}
#[test]
fn a_row_record_beside_a_sixel_leaves_it_alone() {
let mut state = TerminalState::new(6, 20);
state.set_cell_size(8, 20);
apply_graphics(&mut state, &[sixel_at(0, 0, 16, 7)]);
... |
rust_dataset_chunk_516709 | rust_dataset.txt | 516,709 | 512 | _a_smaller_client_attaching_leaves_nothing_outside_the_new_area() {
let mut state = TerminalState::new(4, 10);
let mut before = FrameBuilder::new(10, 4, 0);
before.set_full_repaint(true);
for row in 0..4 {
before.push_row(row, 0, &run("wide-pane!"));
}
state.a... |
rust_dataset_chunk_516710 | rust_dataset.txt | 516,710 | 512 | <String>;
fn set_primary(&mut self, text: &str);
}
impl SystemClipboard for arboard::Clipboard {
fn set_text(&mut self, text: &str) -> Result<(), arboard::Error> {
arboard::Clipboard::set_text(self, text)
}
fn get_text(&mut self) -> Result<String, arboard::Error> {
arboard::Clipboard::... |
rust_dataset_chunk_516711 | rust_dataset.txt | 516,711 | 512 | );
self.reported_unavailable = false;
true
},
Err(e) => {
if !self.reported_unavailable {
report!(
"no system clipboard ({}); copy and paste stay inside this window \
until it can... |
rust_dataset_chunk_516712 | rust_dataset.txt | 516,712 | 512 | (|| primary.clone()),
}
}
pub fn set_primary(&mut self, text: &str) {
match &mut self.backend {
Backend::System(clipboard) => clipboard.set_primary(text),
Backend::Memory { primary, .. } => {
primary.clear();
primary.push_str(text);
... |
rust_dataset_chunk_516713 | rust_dataset.txt | 516,713 | 512 | .encode(text)).into_bytes();
reply.extend_from_slice(terminator);
Some(reply)
}
fn parse_osc52_query(bytes: &[u8]) -> Option<(char, &[u8])> {
let rest = bytes.strip_prefix(b"\x1b]52;")?;
let (selection, rest) = rest.split_first()?;
let rest = rest.strip_prefix(b";")?;
let rest = rest.strip_pref... |
rust_dataset_chunk_516714 | rust_dataset.txt | 516,714 | 512 | "
);
clipboard.set_primary("selected");
assert_eq!(clipboard.get_primary().as_deref(), Some("selected"));
assert_eq!(
clipboard.get().as_deref(),
Some("copied"),
"the primary selection must not overwrite the clipboard"
);
}
fn handle(t... |
rust_dataset_chunk_516715 | rust_dataset.txt | 516,715 | 512 | }) as Box<dyn SystemClipboard>)
}))
}
#[test]
fn a_system_clipboard_that_was_unreachable_at_startup_is_used_once_it_can_be_reached() {
let system = Arc::new(Mutex::new(FakeSystem {
refused_opens: 2,
..FakeSystem::default()
}));
let mut cli... |
rust_dataset_chunk_516716 | rust_dataset.txt | 516,716 | 512 | System::default()));
let mut clipboard = fake_system(&system);
assert_eq!(clipboard.get(), None);
assert_eq!(system.lock().unwrap().opens, 1);
}
#[test]
fn a_thread_that_crashed_while_copying_does_not_end_copying_for_everyone() {
let clipboard = handle("before");
let... |
rust_dataset_chunk_516717 | rust_dataset.txt | 516,717 | 512 | b\\", &handle(text)).unwrap();
let payload = &reply[b"\x1b]52;c;".len()..reply.len() - 2];
assert_eq!(BASE64.decode(payload).unwrap(), text.as_bytes());
}
#[test]
fn only_the_clipboard_read_query_is_answered() {
let clipboard = handle("copied");
for query in [
&b... |
rust_dataset_chunk_516718 | rust_dataset.txt | 516,718 | 512 | pub fn columns(&self) -> Vec<Column> {
let mut columns: Vec<Column> = Vec::new();
for (cluster, _) in zellij_utils::graphemes::clusters(&self.text) {
let mut first_of_cluster = true;
for character in cluster.chars() {
let width = character.width().unwrap_or(0);
... |
rust_dataset_chunk_516719 | rust_dataset.txt | 516,719 | 512 | new(text, Some((end, end))))
}
pub fn ime(&mut self, event: Ime) -> Reaction {
match event {
Ime::Enabled => Reaction::Nothing,
Ime::Preedit(text, cursor) => {
let preedit = (!text.is_empty()).then(|| Preedit::new(text, cursor));
if preedit.is_som... |
rust_dataset_chunk_516720 | rust_dataset.txt | 516,720 | 512 | if let Reaction::Commit(text) = composition.ime(event) {
committed.push(text);
}
}
assert_eq!(committed, vec!["你好".to_owned()]);
assert_eq!(composition.shown(), None);
assert_eq!(composition.gate(), Gate::Open);
}
#[test]
fn a_preedit... |
rust_dataset_chunk_516721 | rust_dataset.txt | 516,721 | 512 | _name_still_gates_and_draws_nothing() {
let mut composition = Composition::new();
assert_eq!(composition.dead_key(None), Reaction::Nothing);
assert_eq!(composition.gate(), Gate::Resolving);
assert_eq!(composition.shown(), None);
}
#[test]
fn a_composition_that_starts_while_a... |
rust_dataset_chunk_516722 | rust_dataset.txt | 516,722 | 512 | );
assert_eq!(columns[0].character(), 'e');
}
#[test]
fn a_family_emoji_in_a_preedit_is_one_group_of_per_code_point_cells() {
let family = "\u{1f468}\u{200d}\u{1f469}\u{200d}\u{1f467}";
let columns = Preedit::new(format!("{}a", family), None).columns();
let described: Vec<(... |
rust_dataset_chunk_516723 | rust_dataset.txt | 516,723 | 512 | ::new(text, Some((99, 99))).cursor_column(),
Some(4),
"a cursor past the end of the text sits at its end"
);
assert_eq!(Preedit::new(text, None).cursor_column(), None);
}
}
--- FILE: zellij/zellij-terminal/src/input/dropped.rs ---
//! The text pasted for a dropped file: its... |
rust_dataset_chunk_516724 | rust_dataset.txt | 516,724 | 512 | txt",
r"/tmp/it\'s\ \$HOME\ \(1\)\&\[x\].txt ",
),
("/tmp/x^y~z.png", r"/tmp/x\^y\~z.png "),
// A control character becomes a `?` glob that still matches it.
("/tmp/a\nrm -rf ~", r"/tmp/a?rm\ -rf\ \~ "),
] {
assert_eq!(dropped_file_text... |
rust_dataset_chunk_516725 | rust_dataset.txt | 516,725 | 512 | ().map(|text| text.to_string()),
}
}
pub fn new(logical: Key, modifiers: ModifiersState) -> Self {
Self {
logical,
unmodified: None,
modifiers,
option_as_alt: false,
text: None,
}
}
fn is_shortcut(&self) -> bool {
... |
rust_dataset_chunk_516726 | rust_dataset.txt | 516,726 | 512 | if press.spelled().as_deref() == Some(text.as_str()) {
return Resolution::Key;
}
if press.is_named_key() {
Resolution::TypeThenKey(text)
} else {
Resolution::Type(text)
}
}
pub fn unidentified_text(press: &Press) -> Option<String> {
match press.logical {
Key::Uni... |
rust_dataset_chunk_516727 | rust_dataset.txt | 516,727 | 512 | }
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Typed {
Key(KeyWithModifier),
Text(String),
}
#[cfg(any(target_os = "windows", target_os = "macos", freedesktop))]
fn unmodified_key(event: &KeyEvent) -> Option<Key> {
use winit::platform::modifier_supplement::KeyEventExtModifierSupplement;
Some(event.... |
rust_dataset_chunk_516728 | rust_dataset.txt | 516,728 | 512 | : KeyWithModifier) -> ClientToServerMsg {
match key.serialize_kitty() {
Some(kitty) => ClientToServerMsg::Key {
key,
raw_bytes: kitty.into_bytes(),
is_kitty_keyboard_protocol: true,
},
None => {
let raw_bytes = key
.serialize_no... |
rust_dataset_chunk_516729 | rust_dataset.txt | 516,729 | 512 | KeyWithModifier::new_with_modifiers(bare_key, key_modifiers)
}
fn named_key(named: NamedKey) -> Option<BareKey> {
let bare = match named {
NamedKey::ArrowLeft => BareKey::Left,
NamedKey::ArrowRight => BareKey::Right,
NamedKey::ArrowUp => BareKey::Up,
NamedKey::ArrowDown => BareKey:... |
rust_dataset_chunk_516730 | rust_dataset.txt | 516,730 | 512 | crate::session::connection::{send, test_attach_at as attach_at, Capabilities, Geometry};
use crate::testing::test_server::FakeServer;
fn character(text: &str) -> Key {
Key::Character(SmolStr::new(text))
}
fn none() -> ModifiersState {
ModifiersState::empty()
}
fn press(logica... |
rust_dataset_chunk_516731 | rust_dataset.txt | 516,731 | 512 | assert!(key.key_modifiers.is_empty());
assert_eq!(bytes(&character("A"), ModifiersState::SHIFT), b"A");
}
#[test]
fn an_absorbed_shift_still_matches_the_keybinding_form() {
assert_eq!(
translated(&character("A"), ModifiersState::SHIFT),
KeyWithModifier::new(BareKey:... |
rust_dataset_chunk_516732 | rust_dataset.txt | 516,732 | 512 | Key::Enter),
(NamedKey::Tab, BareKey::Tab),
(NamedKey::Escape, BareKey::Esc),
(NamedKey::Space, BareKey::Char(' ')),
(NamedKey::F1, BareKey::F(1)),
(NamedKey::F12, BareKey::F(12)),
];
for (named, expected) in cases {
assert_eq!(tran... |
rust_dataset_chunk_516733 | rust_dataset.txt | 516,733 | 512 | assert!(typed(&press(Key::Dead(Some('`')), none())).is_none());
assert!(typed(&press(Key::Named(NamedKey::BrightnessUp), none())).is_none());
assert!(typed(&press(Key::Unidentified(NativeKey::Unidentified), none())).is_none());
}
fn unidentified() -> Key {
Key::Unidentified(NativeKey::... |
rust_dataset_chunk_516734 | rust_dataset.txt | 516,734 | 512 | ::Key
);
}
#[test]
fn a_named_key_after_a_dead_key_types_the_accent_then_acts() {
let pressed = press(Key::Named(NamedKey::Enter), none()).with_text("^\r");
assert_eq!(
resolve_pending_accent(&pressed),
Resolution::TypeThenKey("^".to_owned()),
"th... |
rust_dataset_chunk_516735 | rust_dataset.txt | 516,735 | 512 | cent_alone() {
for named in [
NamedKey::Shift,
NamedKey::Control,
NamedKey::Alt,
NamedKey::AltGraph,
NamedKey::Super,
NamedKey::CapsLock,
] {
assert!(
leaves_the_accent_pending(&press(Key::Named(named), n... |
rust_dataset_chunk_516736 | rust_dataset.txt | 516,736 | 512 | ".to_owned()),
key_message(&press(character("^"), none()))
);
assert_eq!(
typed_text_message("^x".to_owned()),
Some(text_message("^x".to_owned()))
);
}
#[test]
fn a_multi_character_key_is_delivered_as_its_text() {
assert_eq!(
t... |
rust_dataset_chunk_516737 | rust_dataset.txt | 516,737 | 512 | key_message(&press(character("@"), none())),
"an AltGr-typed @ must be indistinguishable from a plain one"
);
}
#[test]
fn a_third_level_character_does_not_claim_an_alt_chord_either() {
let keys = vec![KeyWithModifier::new(BareKey::Char('q')).with_alt_modifier()];
asser... |
rust_dataset_chunk_516738 | rust_dataset.txt | 516,738 | 512 | claims(&keys, &pressed));
}
#[test]
fn an_option_key_left_typing_characters_is_not_an_alt_chord() {
let both = ModifiersState::ALT | ModifiersState::SHIFT;
for (logical, unmodified, modifiers) in [("˙", "h", ModifiersState::ALT), ("±", "=", both)]
{
let pressed = layered... |
rust_dataset_chunk_516739 | rust_dataset.txt | 516,739 | 512 | ("A"),
Some(&character("a"))
));
assert!(!alt_shifted_the_character(
&character("a"),
Some(&character("a"))
));
assert!(alt_shifted_the_character(
&character("œ"),
Some(&character("q"))
));
assert!(alt_shifted_th... |
rust_dataset_chunk_516740 | rust_dataset.txt | 516,740 | 512 | F(5)).with_alt_modifier()];
assert!(claims(
&keys,
&press(Key::Named(NamedKey::F5), ModifiersState::ALT)
));
assert!(!claims(&keys, &press(Key::Named(NamedKey::F5), none())));
assert!(!claims(
&paste_keys(),
&press(Key::Named(NamedKey::F5),... |
rust_dataset_chunk_516741 | rust_dataset.txt | 516,741 | 512 | "{key}"
);
}
}
#[test]
fn shift_insert_is_distinguishable_from_a_bare_insert() {
assert_eq!(
bytes(&Key::Named(NamedKey::Insert), ModifiersState::SHIFT),
b"\x1b[2;2~"
);
assert_eq!(bytes(&Key::Named(NamedKey::Insert), none(... |
rust_dataset_chunk_516742 | rust_dataset.txt | 516,742 | 512 | send(&connection.sender, msg.clone()).unwrap();
}
drop(connection);
assert_eq!(&server.finish()[8..], &sent[..]);
}
#[test]
fn every_message_declares_the_kitty_encoding() {
match key_message(&press(character("a"), none())).unwrap() {
ClientToServerMsg::Key {
... |
rust_dataset_chunk_516743 | rust_dataset.txt | 516,743 | 512 | child = Command::new(opener)
.arg(uri)
.stdin(Stdio::null())
.stdout(Stdio::null())
.stderr(Stdio::null())
.spawn()
.map_err(|e| format!("could not run {}: {}", opener, e))?;
reap(child);
Ok(())
}
fn reap(mut child: std::process::Child) {
std::thread::Builde... |
rust_dataset_chunk_516744 | rust_dataset.txt | 516,744 | 512 | )>,
}
impl LinkRun {
pub fn covers(&self, row: usize, col: usize) -> bool {
self.spans
.iter()
.any(|(at, start, end)| *at == row && col >= *start && col <= *end)
}
}
pub fn run_at(buffer: &ScreenBuffer, row: usize, col: usize) -> Option<LinkRun> {
let size = buffer.size();... |
rust_dataset_chunk_516745 | rust_dataset.txt | 516,745 | 512 | Opening {
pub const OFF: Opening = Opening {
enabled: false,
with_shift: false,
};
pub const WITHOUT_SHIFT: Opening = Opening {
enabled: true,
with_shift: false,
};
pub const WITH_SHIFT: Opening = Opening {
enabled: true,
with_shift: true,
};
}
p... |
rust_dataset_chunk_516746 | rust_dataset.txt | 516,746 | 512 | = "macos") && deliberate_modifier_held(modifiers)
}
pub fn released_on(armed: Option<Armed>, cell: Option<(u16, u16)>) -> Option<String> {
let armed = armed?;
(Some(armed.cell) == cell).then_some(armed.uri)
}
pub fn gesture_matches(
opening: Opening,
pane_wants_mouse: bool,
modifiers: ModifiersSt... |
rust_dataset_chunk_516747 | rust_dataset.txt | 516,747 | 512 | &str) -> Result<(), String> {
if !is_openable(uri) {
return Err(format!("refusing to open {:?}", uri));
}
let Some(opener) = opener() else {
return Err("this platform has no known way to open a link".to_owned());
};
launch(opener, uri)
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg... |
rust_dataset_chunk_516748 | rust_dataset.txt | 516,748 | 512 | assert_eq!(run.spans, vec![(0, 4, 7)]);
assert!(run.covers(0, 4));
assert!(!run.covers(0, 3));
assert_eq!(
run_at(&buffer, 0, 1).expect("the first run").spans,
vec![(0, 0, 1)]
);
}
#[test]
fn a_cell_outside_any_link_resolves_to_nothing() {
... |
rust_dataset_chunk_516749 | rust_dataset.txt | 516,749 | 512 | 0])], &[]);
let buffer = buffer(1, 4, &[frame]);
assert!(run_at(&buffer, 0, 0).is_none());
}
#[test]
fn the_allow_list_accepts_the_schemes_a_terminal_link_really_uses() {
for uri in [
"http://example.com",
"https://example.com/a?b=c#d",
"HTTPS://E... |
rust_dataset_chunk_516750 | rust_dataset.txt | 516,750 | 512 | a shell"
);
}
fn run(uri: &str) -> LinkRun {
LinkRun {
id: 1,
uri: uri.to_owned(),
spans: vec![(0, 0, 3)],
}
}
const NONE: ModifiersState = ModifiersState::empty();
fn armed(wants: bool, modifiers: ModifiersState, uri: &str) -> Option<A... |
rust_dataset_chunk_516751 | rust_dataset.txt | 516,751 | 512 | _shift(false, NONE).is_some());
assert_eq!(armed_with_shift(true, NONE), None);
}
#[test]
fn with_shift_opening_no_other_modifier_opens_a_link() {
for modifiers in [
ModifiersState::CONTROL,
ModifiersState::ALT,
OTHER_PLATFORM_KEY,
ModifiersSt... |
rust_dataset_chunk_516752 | rust_dataset.txt | 516,752 | 512 | }
assert_eq!(
armed(true, CMD | ModifiersState::ALT, "https://example.com"),
None
);
assert_eq!(
armed_by_press(Opening::OFF, true, CMD, Some((1, 0)), Some(&link)),
None
);
}
#[test]
fn a_plain_click_never_opens_a_file_or_ftp_... |
rust_dataset_chunk_516753 | rust_dataset.txt | 516,753 | 512 | }
#[test]
fn web_links_keep_opening_on_a_plain_click() {
let armed = armed(false, NONE, "https://example.com").expect("a plain click opens");
assert!(!armed.deliberate);
assert!(armed_by_press(
Opening::WITHOUT_SHIFT,
false,
NONE,
Some... |
rust_dataset_chunk_516754 | rust_dataset.txt | 516,754 | 512 | _reachable(
Opening::WITHOUT_SHIFT,
true,
ModifiersState::SHIFT,
Some(&allowed)
));
assert!(is_reachable(
Opening::WITH_SHIFT,
false,
ModifiersState::SHIFT,
Some(&allowed)
));
assert!(
... |
rust_dataset_chunk_516755 | rust_dataset.txt | 516,755 | 512 | narrow(&args.file), uri);
assert!(args.file.len() > uri.chars().count() + 1);
}
#[test]
fn the_windows_opener_refuses_a_link_with_an_embedded_nul() {
assert!(shell_execute_args("https://example.com/\0calc.exe").is_err());
}
}
--- FILE: zellij/zellij-terminal/src/input/mod.rs ---
pub m... |
rust_dataset_chunk_516756 | rust_dataset.txt | 516,756 | 512 | ) -> f64 {
let (Some(&(first, _)), Some(&(last, _))) = (self.samples.front(), self.samples.back())
else {
return 0.0;
};
if now.saturating_duration_since(last) > HISTORY {
return 0.0;
}
let span = last.saturating_duration_since(first).as_secs_f64()... |
rust_dataset_chunk_516757 | rust_dataset.txt | 516,757 | 512 | )
.max(self.reached);
let k = self.friction;
let distance = self.speed / k * ((-k * self.reached).exp() - (-k * elapsed).exp());
self.reached = elapsed;
distance
}
fn finished(&self) -> bool {
self.reached >= self.lasts
}
}
#[derive(Debug, Default)]
pub ... |
rust_dataset_chunk_516758 | rust_dataset.txt | 516,758 | 512 | , target, speed);
},
TouchPhase::Cancelled => self.stop(),
}
}
pub fn note_frame(&mut self, hints: &ScrollRecord, geometry: &GeometryRecord) {
if let Some(swipe) = self.swipe.as_mut() {
if let Some(target) = swipe.target {
if geometry.panes.ge... |
rust_dataset_chunk_516759 | rust_dataset.txt | 516,759 | 512 | ,
bottom: 1,
left: 1,
right: 1,
flags: PANE_FRAMED,
}
}
fn geometry() -> GeometryRecord {
GeometryRecord {
panes: vec![pane(0), pane(60)],
}
}
fn left() -> Option<Target> {
target_at(&geometry(), Some((10, 10))... |
rust_dataset_chunk_516760 | rust_dataset.txt | 516,760 | 512 | geometry(), None), None);
}
#[test]
fn the_speed_is_the_movement_over_the_time_it_took() {
let mut speed = Speed::default();
let start = Instant::now();
speed.push(start, 40.0);
assert_eq!(speed.per_second(start), 0.0, "one sample has no speed");
speed.push(start + m... |
rust_dataset_chunk_516761 | rust_dataset.txt | 516,761 | 512 | its_speed_afresh() {
let mut momentum = Momentum::default();
let start = Instant::now();
momentum.touchpad(touch(TouchPhase::Started, 40.0, start));
momentum.touchpad(touch(TouchPhase::Moved, 40.0, start + ms(10)));
momentum.touchpad(touch(TouchPhase::Started, 1.0, start + ms(20)... |
rust_dataset_chunk_516762 | rust_dataset.txt | 516,762 | 512 | )));
momentum.note_frame(&hints(1), &geometry());
momentum.touchpad(touch(TouchPhase::Ended, 0.0, start + ms(15)));
assert!(
!momentum.is_coasting(),
"a hint for another pane is no evidence"
);
}
#[test]
fn a_swipe_with_ctrl_or_alt_starts_nothing() {
... |
rust_dataset_chunk_516763 | rust_dataset.txt | 516,763 | 512 | 55);
let mut sixty = Momentum::default();
swipe(&mut sixty, start, 40.0, 5, true);
let at_sixty = glide_total(&mut sixty, end, Duration::from_nanos(16_666_667));
let mut fast = Momentum::default();
swipe(&mut fast, start, 40.0, 5, true);
let at_fast = glide_total(&mut fas... |
rust_dataset_chunk_516764 | rust_dataset.txt | 516,764 | 512 | ScrollRecord::default(), &geometry());
assert!(
momentum.is_coasting(),
"nothing was sent since the last answered scroll"
);
momentum.sent();
momentum.note_frame(&ScrollRecord::default(), &geometry());
assert!(!momentum.is_coasting(), "the scrollback has r... |
rust_dataset_chunk_516765 | rust_dataset.txt | 516,765 | 512 | ;
use zellij_utils::position::Position;
use zellij_utils::structured_render::{GeometryRecord, PointerKind};
use crate::session::connection::Geometry;
const MAX_LINES_PER_DELTA: usize = 16;
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
struct Buttons {
left: bool,
right: bool,
middle: bool,
}
imp... |
rust_dataset_chunk_516766 | rust_dataset.txt | 516,766 | 512 | ) -> CursorIcon {
if openable_link && cell.is_some() {
return CursorIcon::Pointer;
}
pointer_shape(cell, geometry, ctrl)
}
pub fn pointer_shape(
cell: Option<(u16, u16)>,
geometry: &GeometryRecord,
ctrl: bool,
) -> CursorIcon {
let Some((x, y)) = cell else {
return CursorIco... |
rust_dataset_chunk_516767 | rust_dataset.txt | 516,767 | 512 | ,
modifiers,
))
}
pub fn button(
&mut self,
button: MouseButton,
state: ElementState,
geometry: Geometry,
modifiers: ModifiersState,
) -> Option<MouseEvent> {
let button = Button::of(button)?;
let position = self.at(geometry);
... |
rust_dataset_chunk_516768 | rust_dataset.txt | 516,768 | 512 | horizontal_wheel = if horizontal > 0 {
Wheel::Right
} else {
Wheel::Left
};
for _ in 0..horizontal.unsigned_abs() {
events.push(horizontal_wheel.event(position, modifiers));
}
events
}
pub fn swallow_middle(&mut self) {
self.s... |
rust_dataset_chunk_516769 | rust_dataset.txt | 516,769 | 512 | );
match self {
Wheel::Up => event.wheel_up = true,
Wheel::Down => event.wheel_down = true,
Wheel::Left => event.wheel_left = true,
Wheel::Right => event.wheel_right = true,
}
event
}
}
pub fn message(event: MouseEvent) -> ClientToServerMsg {... |
rust_dataset_chunk_516770 | rust_dataset.txt | 516,770 | 512 | ::FakeServer;
use zellij_utils::structured_render::{
PaneRect, PANE_FLOATING, PANE_FOCUSED, PANE_FRAMED, PANE_PLUGIN_UI, PANE_POPUP,
PANE_SELECTABLE, PANE_UNDER_FLOATING, PANE_WANTS_MOUSE,
};
fn geometry() -> Geometry {
Geometry {
rows: 40,
cols: 120,
... |
rust_dataset_chunk_516771 | rust_dataset.txt | 516,771 | 512 | _FRAMED | PANE_SELECTABLE,
}
}
fn bare(x: u16, y: u16, cols: u16, rows: u16, flags: u8) -> PaneRect {
PaneRect {
x,
y,
cols,
rows,
top: 0,
bottom: 0,
left: 0,
right: 0,
flags,
}
... |
rust_dataset_chunk_516772 | rust_dataset.txt | 516,772 | 512 | CursorIcon::Text
);
assert_eq!(pointer_shape(None, &geometry, false), CursorIcon::Default);
}
#[test]
fn the_pointer_is_a_beam_over_pane_content_and_an_arrow_over_the_bars() {
let geometry = two_framed_columns();
assert_eq!(
pointer_shape(Some((5, 5)), &geometry... |
rust_dataset_chunk_516773 | rust_dataset.txt | 516,773 | 512 | panes: vec![
rect(0, 0, 40, 20, PANE_FOCUSED | PANE_WANTS_MOUSE),
rect(40, 0, 40, 20, PANE_WANTS_MOUSE),
],
};
assert_eq!(
pointer_shape(Some((5, 5)), &watching, false),
CursorIcon::Default
);
assert_eq!(
po... |
rust_dataset_chunk_516774 | rust_dataset.txt | 516,774 | 512 | agonal_arrow_at_the_corner_of_a_framed_pane() {
let geometry = GeometryRecord {
panes: vec![
rect(0, 0, 40, 10, PANE_FOCUSED),
rect(40, 0, 40, 10, 0),
rect(0, 10, 40, 10, 0),
rect(40, 10, 40, 10, 0),
],
};
as... |
rust_dataset_chunk_516775 | rust_dataset.txt | 516,775 | 512 | _flags(mut pane: PaneRect, flags: u8) -> PaneRect {
pane.flags |= flags;
pane
}
fn popup(x: u16, y: u16, cols: u16, rows: u16, takes_focus: bool) -> PaneRect {
let focus = if takes_focus { PANE_FOCUSED } else { 0 };
bare(x, y, cols, rows, PANE_POPUP | focus)
}
#[test]
... |
rust_dataset_chunk_516776 | rust_dataset.txt | 516,776 | 512 | };
assert_eq!(
pointer_shape(Some((5, 5)), &geometry, false),
CursorIcon::Default
);
assert_eq!(
pointer_shape(Some((45, 5)), &geometry, false),
CursorIcon::Text
);
}
fn floating_over_two_columns() -> GeometryRecord {
let ... |
rust_dataset_chunk_516777 | rust_dataset.txt | 516,777 | 512 | Move
);
}
#[test]
fn a_tiled_border_under_shown_floating_panes_only_resizes_with_ctrl() {
let geometry = floating_over_two_columns();
assert_eq!(
pointer_shape(Some((39, 17)), &geometry, false),
CursorIcon::Default
);
assert_eq!(
p... |
rust_dataset_chunk_516778 | rust_dataset.txt | 516,778 | 512 | .set_origin(12, 7);
pointer.moved(at(12.0, 7.0), geometry(), ModifiersState::empty());
assert_eq!(pointer.cell(geometry()), (0, 0));
pointer.moved(at(21.9, 26.9), geometry(), ModifiersState::empty());
assert_eq!(pointer.cell(geometry()), (0, 0));
pointer.moved(at(22.0, 27.0), geo... |
rust_dataset_chunk_516779 | rust_dataset.txt | 516,779 | 512 | is_none());
assert!(pointer.moved(at(39.9, 59.9), geometry(), none()).is_none());
assert!(pointer.moved(at(40.0, 40.0), geometry(), none()).is_some());
}
#[test]
fn re_entering_the_window_reports_the_cell_again() {
let mut pointer = PointerState::new();
assert!(pointer.moved... |
rust_dataset_chunk_516780 | rust_dataset.txt | 516,780 | 512 | let mut pointer = PointerState::new();
for button in [
MouseButton::Back,
MouseButton::Forward,
MouseButton::Other(9),
] {
assert!(pointer
.button(button, ElementState::Pressed, geometry(), none())
.is_none());
}
... |
rust_dataset_chunk_516781 | rust_dataset.txt | 516,781 | 512 | ::LineDelta(0.0, 0.4), geometry(), none())
.is_empty());
assert_eq!(
pointer
.wheel(MouseScrollDelta::LineDelta(0.0, 0.4), geometry(), none())
.len(),
1
);
}
#[test]
fn reversing_direction_discards_the_carried_remainder() {... |
rust_dataset_chunk_516782 | rust_dataset.txt | 516,782 | 512 | let events = pointer.wheel(
MouseScrollDelta::PixelDelta(at(0.0, 1.0e9)),
geometry(),
none(),
);
assert_eq!(events.len(), 1);
assert_eq!(events[0].wheel_lines as usize, MAX_LINES_PER_DELTA);
}
#[test]
fn reversing_pixel_travel_discards_the_carrie... |
rust_dataset_chunk_516783 | rust_dataset.txt | 516,783 | 512 | ::LineDelta(-1.0, 0.0), geometry(), none());
assert_eq!(left.len(), 1);
assert!(left[0].wheel_left);
}
#[test]
fn a_wheel_tick_is_reported_at_the_tracked_cursor() {
let mut pointer = PointerState::new();
pointer.moved(at(35.0, 51.0), geometry(), none());
let events =... |
rust_dataset_chunk_516784 | rust_dataset.txt | 516,784 | 512 | , 45.0)),
remembered,
geometry(),
none(),
);
assert_eq!(events.len(), 1);
assert_eq!(events[0].position, position(2, 3));
assert_eq!(events[0].wheel_lines, 2);
assert!(events[0].wheel_up);
let rest = pointer.wheel_at(
MouseS... |
rust_dataset_chunk_516785 | rust_dataset.txt | 516,785 | 512 | Server::spawn(move |side| side.expect(expected));
let connection = attach_at(
&server.path,
"window-test",
geometry(),
Capabilities::default(),
)
.unwrap();
for msg in &sent {
send(&connection.sender, msg.clone()).unwrap();
... |
rust_dataset_chunk_516786 | rust_dataset.txt | 516,786 | 512 | let token = app::launch_token();
let (handed, first) = match panel_view(&args) {
Some(view) => (
AppRequest::TogglePanel {
view,
token: token.clone(),
},
app::Intent::TogglePanel { view, token },
),
None => {
le... |
rust_dataset_chunk_516787 | rust_dataset.txt | 516,787 | 512 | &args,
None,
),
Err(e) => {
report!(
"the desktop app could not take charge, so this window runs on its own: {:#}",
e
);
let (config_options, settings) = match loaded.map_or_else(|| load(&args, &opts), Ok) {
... |
rust_dataset_chunk_516788 | rust_dataset.txt | 516,788 | 512 | os::claim_app_identity();
let options = configured(&settings, &args);
let capabilities = session::connection::Capabilities {
local_media: true,
paints: options.paints,
};
let config_path = Config::config_file_path(&opts);
let windowing = window::Windowing::bring_up()?;
let poste... |
rust_dataset_chunk_516789 | rust_dataset.txt | 516,789 | 512 | Event::Tray(event));
})
};
let background = app::Background::new(
config_path.clone(),
notifier,
watcher,
Some(holder),
Some(tray_events),
app::policy::state::CloseNotice::at(Some(app::policy::state::path())),
);
let launcher = Launcher {
d... |
rust_dataset_chunk_516790 | rust_dataset.txt | 516,790 | 512 | options_for(&self, request: &OpenWindowRequest) -> SessionOptions {
match &request.options {
Some(options) => {
let mut merged = self.config_options.merge_from_cli(options.clone());
// `pane_frames false` in the config would hide the requested style, also on
... |
rust_dataset_chunk_516791 | rust_dataset.txt | 516,791 | 512 | AttachArgs {
AttachArgs {
session_name: request.session.clone(),
token: request.token.clone(),
remember: request.remember,
forget: request.forget,
ca_cert: request.ca_cert.clone(),
insecure: request.insecure,
..AttachArgs::default()
}
}
impl Dialer {
... |
rust_dataset_chunk_516792 | rust_dataset.txt | 516,792 | 512 | WindowRequest) -> Result<window::PreparedWindow> {
let (settings, mut options) = self.current()?;
if let Some(mode) = request.startup_mode {
options.startup_mode = mode;
}
let args = TerminalArgs {
cell_width: 10,
cell_height: 20,
rows: req... |
rust_dataset_chunk_516793 | rust_dataset.txt | 516,793 | 512 | fonts = options.font.stack(1.0)?;
let metrics = fonts.metrics();
let (cell_width, cell_height) = (metrics.width.max(1), metrics.height.max(1));
let cols = ((area.0 * 0.85) / cell_width as f64) as usize;
let rows = ((area.1 * 0.75) / cell_height as f64) as usize;
let cols = cols.... |
rust_dataset_chunk_516794 | rust_dataset.txt | 516,794 | 512 | LayoutInfo;
use zellij_utils::input::options::{Options, PaneFrameStyle};
pub(crate) fn opened_request(path: &Path, shell: Option<&str>) -> OpenWindowRequest {
if path.is_dir() {
OpenWindowRequest {
cwd: Some(path.to_path_buf()),
..Default::default()
}
} else {
sc... |
rust_dataset_chunk_516795 | rust_dataset.txt | 516,795 | 512 | script in an interactive shell, so it sees what the user's rc files put on PATH (the
/// app's environment comes from a login shell, which skips `.zshrc`). The path is passed as an
/// argument, so it needs no quoting. Other shells run the script directly.
fn shell_args(shell: &str) -> Option<&'static [&'static str]> ... |
rust_dataset_chunk_516796 | rust_dataset.txt | 516,796 | 512 | _own_folder_in_a_new_session() {
let request = script_request(Path::new("/x/y/s.command"), Some("/bin/zsh"));
assert_eq!(request.cwd.as_deref(), Some(Path::new("/x/y")));
assert_eq!(request.session, None);
assert_eq!(only_pane(&request).name.as_deref(), Some("s.command"));
let co... |
rust_dataset_chunk_516797 | rust_dataset.txt | 516,797 | 512 | }
#[test]
fn any_path_reaches_the_pane_unchanged() {
let folder = "/x/a \"b\" \\c\n{d}; e";
let script = format!("{}/r\"un\\ me\n.command", folder);
let request = script_request(Path::new(&script), Some("/bin/zsh"));
assert_eq!(
only_pane(&request).name.as_deref(),
... |
rust_dataset_chunk_516798 | rust_dataset.txt | 516,798 | 512 | => config_options,
Err(e) => {
return Err(refuse(
Refusal::new(crate::window::notice::described(&e)),
args,
None,
))
},
};
let settings = if args.headless {
config::settings::Settings::default()
} else {
... |
rust_dataset_chunk_516799 | rust_dataset.txt | 516,799 | 512 | (
args: &TerminalArgs,
opts: &CliArgs,
) -> (TerminalArgs, CliArgs) {
let mut args = args.clone();
args.attach.options = None;
let mut opts = opts.clone();
if let Some(Command::Terminal(terminal_args)) = opts.command.as_mut() {
terminal_args.attach.options = None;
}
(args, opts)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.