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_517300
rust_dataset.txt
517,300
512
::Move)) } pub(super) fn panel_grip(app: &App, position: winit::dpi::PhysicalPosition<f64>) -> Option<Grip> { let size = app.window()?.inner_size(); grip_or_header( (position.x, position.y), (size.width, size.height), app.edge_margins(), || app.header_is_blank_at(position), ...
rust_dataset_chunk_517301
rust_dataset.txt
517,301
512
at(797.0, 598.0), Some(Grip::Resize(ResizeDirection::SouthEast)) ); assert_eq!( at(8.0, 597.0), Some(Grip::Resize(ResizeDirection::SouthWest)) ); } #[derive(Default)] struct FakeWindow { calls: std::cell::RefCell<Vec<String>>, } impl FakeWindow { fn log(&self, call: impl I...
rust_dataset_chunk_517302
rust_dataset.txt
517,302
512
), Some(Grip::Move) ); assert_eq!( grip_or_header((400.0, 30.0), size, margins(), || false), None ); start_grip(&window, Grip::Move); assert_eq!(window.calls(), vec!["drag".to_owned()]); } #[test] fn hovering_a_grip_shows_its_cursor_and_leaving_it_restores_the_pointer() { ...
rust_dataset_chunk_517303
rust_dataset.txt
517,303
512
AppEvent; use crate::session::connection::Connection; use crate::window::conductor::Input; use crate::window::desktop::Pending; use crate::window::desktop::World; use crate::window::Desktop; use crate::window::DesktopMode; use crate::window::{terminal_app, with_activation, Switched, Verdict, Wake}; use anyhow::Result; ...
rust_dataset_chunk_517304
rust_dataset.txt
517,304
512
window::activate_app(); if let Some(pane_id) = pane { app.send_action(Action::FocusPaneByPaneId { pane_id }); } else if let Some(position) = tab { app.send_action(Action::GoToTab { index: position as u32, }); } } pub(super) fn switched...
rust_dataset_chunk_517305
rust_dataset.txt
517,305
512
, }, ); let spawned = std::thread::Builder::new() .name("app_connect".to_owned()) .spawn(move || { if let Some(session) = routed { let standalone = crate::app::control::standalone::windows_dir(); if crate::app::c...
rust_dataset_chunk_517306
rust_dataset.txt
517,306
512
terminal_app(made, ticket, proxy), pending.token); app.set_standalone(false); let verdict = app.on_resumed(event_loop); self.windows.insert(ticket, app); if verdict == Verdict::Close { self.drop_window(ticket); return false; } if let Some(window) =...
rust_dataset_chunk_517307
rust_dataset.txt
517,307
512
sessions", Some(PopupView::Quit) => "quit", None => "auto", } } /// Where the panel opens, given its size in logical pixels. pub(super) fn placement( event_loop: &ActiveEventLoop, anchor: Option<Anchor>, size: (f64, f64), ) -> Option<winit::dpi::Position> { if crate::window::is_wayl...
rust_dataset_chunk_517308
rust_dataset.txt
517,308
512
, frame: PanelFrame) { prepared.geometry.cols = frame.cols; prepared.geometry.rows = frame.rows; prepared.startup = Startup::windowed(frame.rows, frame.cols); } /// Where a panel the user left opens again: at the same place, pulled back inside the work area /// if it hangs over an edge, or nowhere in parti...
rust_dataset_chunk_517309
rust_dataset.txt
517,309
512
0); Some((x * scale, y * scale)) }, Some(Anchor::Above { x, y } | Anchor::At { x, y }) => Some((x, y)), None => event_loop .primary_monitor() .or_else(|| event_loop.available_monitors().next()) .map(|m| { let (p, s) = (m.position(),...
rust_dataset_chunk_517310
rust_dataset.txt
517,310
512
, ) }) .unwrap_or((0.0, 0.0, f64::MAX / 4.0, f64::MAX / 4.0)) } impl Desktop { /// Takes the panel away, keeping its size and place for the next time it opens. pub(super) fn take_panel(&mut self) -> Option<PanelWindow> { let panel = self.panel.take()?; self.panel_fra...
rust_dataset_chunk_517311
rust_dataset.txt
517,311
512
Ok(prepared) => prepared, Err(e) => { report!("the inbox panel could not be prepared: {:#}", e); return false; }, }; let frame = frame.filter(|frame| { let (width, height) = size_with(&prepared, frame.cols, frame.rows); wid...
rust_dataset_chunk_517312
rust_dataset.txt
517,312
512
} if let Some(window) = app.window() { window.focus_window(); } crate::window::activate_app(); send_panel_view(&app, view); self.panel = Some(PanelWindow { app, pointer: None, on_edge: false, }); self.ensure_...
rust_dataset_chunk_517313
rust_dataset.txt
517,313
512
self.run(event_loop, Input::PanelClosedByUser); } }, } } } #[cfg(test)] mod tests { use super::*; #[test] fn at_200_percent_the_panel_is_centred_by_its_size_in_pixels() { let above_the_taskbar = (0.0, 0.0, 2880.0, 1704.0); assert_...
rust_dataset_chunk_517314
rust_dataset.txt
517,314
512
and above the taskbar" ); assert_eq!( kept_inside(above_the_taskbar, (-50.0, -20.0), (2480.0, 1386.0)), Some((0.0, 0.0)) ); } #[test] fn a_panel_that_no_longer_fits_is_placed_afresh() { assert_eq!( kept_inside((0.0, 0.0, 1920.0, 1040.0), ...
rust_dataset_chunk_517315
rust_dataset.txt
517,315
512
connector(&self) -> Connector; fn make(&self, connection: Connection, prepared: PreparedWindow) -> TerminalWindow; fn panel(&self, area: (f64, f64)) -> Result<PreparedWindow>; fn panel_connector(&self) -> PanelConnector; } pub(crate) struct Hosting { pub background: Background, pub maker: Box<dyn ...
rust_dataset_chunk_517316
rust_dataset.txt
517,316
512
let hosted = matches!(mode, DesktopMode::Background(_)); Desktop { windows: BTreeMap::new(), conductor: Conductor::new(hosted), proxy, failure: None, mode, sessions: Vec::new(), pending: HashMap::new(), arrived: Has...
rust_dataset_chunk_517317
rust_dataset.txt
517,317
512
Abandoned { ticket }); } }, Effect::OpenPanel { ticket, view, at, token, } => { if !self.open_panel(event_loop, ticket, view, at, token) { queue.push_back(Input::OpenAb...
rust_dataset_chunk_517318
rust_dataset.txt
517,318
512
_activator(&mut self, event_loop: &ActiveEventLoop) { let windows = &self.windows; let panel = &self.panel; self.activation.ensure(event_loop, || { windows .values() .find_map(|app| app.window()) .or_else(|| panel.as_ref().and_then(|pan...
rust_dataset_chunk_517319
rust_dataset.txt
517,319
512
{ .. } | AppEvent::Terminate | AppEvent::Snapshot(_) | AppEvent::Describe(_) | AppEvent::RaiseWindows { .. } | AppEvent::DetachWindows | AppEvent::Handled { .. } => vec![], }; if !intents.is_empty() { self.run(event_loo...
rust_dataset_chunk_517320
rust_dataset.txt
517,320
512
::config::ConfigError; use zellij_utils::ipc::ExitReason; use zellij_utils::structured_render::{FrameBuilder, WireCell}; use crate::session::client_loop::Ending; use crate::config::options::Options; use crate::session::connection::Geometry; use crate::text::font::FontStack; const MARGIN: usize = 2; const TAB: &str =...
rust_dataset_chunk_517321
rust_dataset.txt
517,321
512
LEAVE ) } pub fn refused(text: &str) -> String { format!("{}\n\n{}", text, LEAVE) } pub fn described(error: &ConfigError) -> String { let ConfigError::KdlError(kdl) = error else { return error.to_string(); }; if kdl.src.is_none() { let mut text = format!("{}: {}", kdl, kdl.error_m...
rust_dataset_chunk_517322
rust_dataset.txt
517,322
512
scroll(&mut self, by: isize, rows: usize, cols: usize) -> bool { let last = self.last_top(rows, cols) as isize; let top = (self.top as isize).saturating_add(by).clamp(0, last) as usize; let moved = top != self.top; self.top = top; moved } pub fn wheel(&mut self, lines: ...
rust_dataset_chunk_517323
rust_dataset.txt
517,323
512
WireCell> { let mut cells = Vec::new(); for (cluster, width) in clusters(line) { if width == 0 { continue; } let mut characters = cluster.chars(); let ch = match (characters.next(), characters.next()) { (Some(only), None) => only as u32, (Some(...
rust_dataset_chunk_517324
rust_dataset.txt
517,324
512
= split_at_columns(&line, room); if tail.is_empty() { break; } lines.push(format!("{}{}", indent, head)); line = tail; } } lines.push(format!("{}{}", indent, line)); } lines } pub fn show(message: &...
rust_dataset_chunk_517325
rust_dataset.txt
517,325
512
lines ); assert_eq!( lines.join(" "), "one two three four five six seven", "{:?}", lines ); } #[test] fn a_word_longer_than_the_window_is_broken_rather_than_dropped() { let lines = wrapped(&"x".repeat(100), 40); ...
rust_dataset_chunk_517326
rust_dataset.txt
517,326
512
panic!("{:?} went unexplained", reason)); assert_eq!(explained, reason.to_string().trim(), "{:?}", reason); } } #[test] fn a_dropped_connection_and_a_client_failure_are_explained() { assert_eq!(trouble(&Ending::Lost, "work"), Some(LOST.to_owned())); assert_eq!( ...
rust_dataset_chunk_517327
rust_dataset.txt
517,327
512
16); assert_eq!(lines[0], "list:"); assert!( lines[1..].iter().all(|line| line.starts_with(" ")), "{:?}", lines ); assert!( lines.iter().all(|line| line.chars().count() <= 16), "{:?}", lines ); ass...
rust_dataset_chunk_517328
rust_dataset.txt
517,328
512
"); let mut notice = Notice::new(text); let (rows, cols) = (10, 40); let mut state = TerminalState::new(rows, cols); state.apply_frame(&notice.frame(rows, cols)).unwrap(); assert!(state.dump().contains("line 0")); assert!(!state.dump().contains("line 29")); assert...
rust_dataset_chunk_517329
rust_dataset.txt
517,329
512
fn a_wide_word_wraps_by_its_columns_rather_than_its_characters() { let lines = wrapped("\u{4f60}\u{597d}\u{4e16}\u{754c}", 4); assert_eq!( lines, vec!["\u{4f60}\u{597d}".to_owned(), "\u{4e16}\u{754c}".to_owned()] ); } #[test] fn a_notice_with_clusters_reache...
rust_dataset_chunk_517330
rust_dataset.txt
517,330
512
Color().colorWithAlphaComponent(0.001); ns_window.setBackgroundColor(Some(&almost_clear)); } } pub(in crate::window) fn ns_window( window: &Window, ) -> Option<objc2::rc::Retained<objc2_app_kit::NSWindow>> { use winit::raw_window_handle::RawWindowHandle; let Ok(RawWindowHandle::AppKit(handle)) ...
rust_dataset_chunk_517331
rust_dataset.txt
517,331
512
None), (OptionAsAlt::Left, Native::OnlyLeft), (OptionAsAlt::Right, Native::OnlyRight), (OptionAsAlt::Both, Native::Both), ] { assert_eq!(native_option_as_alt(side), native, "{:?}", side); } } } --- FILE: zellij/zellij-terminal/src/window/platform/mod...
rust_dataset_chunk_517332
rust_dataset.txt
517,332
512
named(attributes: WindowAttributes) -> WindowAttributes { let _ = application_id(); attributes } pub(in crate::window) struct Activation; impl Activation { pub(in crate::window) fn new() -> Self { Activation } pub(in crate::window) fn ensure<'a>( &mut self, _event_loop: &...
rust_dataset_chunk_517333
rust_dataset.txt
517,333
512
Once() -> WindowState, _windowed_known: bool, ) { } } pub(in crate::window) struct Shell; impl Shell { pub(in crate::window) fn attach( _window: &Window, _memory: &WindowMemory, _detacher: Option<Detacher>, ) -> Self { Shell } } --- FILE: zellij/zellij-ter...
rust_dataset_chunk_517334
rust_dataset.txt
517,334
512
_activation::Activator::for_window) { Some(Ok(activator)) => { self.tried = true; self.activator = Some(activator); }, Some(Err(e)) => { self.tried = true; report!( "windows cannot be brought forward ...
rust_dataset_chunk_517335
rust_dataset.txt
517,335
512
orated_shadow(true) } /// Windows keeps a window the app opens at another program's request behind the active one. /// Focusing it brings it to the front, as the panel already does. pub(in crate::window) fn bring_opened_window_forward(window: &Window) { window.focus_window(); } /// Windows shows a window as soon ...
rust_dataset_chunk_517336
rust_dataset.txt
517,336
512
window) fn square_without_system_border(window: &Window) { use windows_sys::Win32::Graphics::Dwm::{ DwmSetWindowAttribute, DWMWA_BORDER_COLOR, DWMWA_COLOR_NONE, DWMWA_WINDOW_CORNER_PREFERENCE, DWMWCP_DONOTROUND, }; let Some(hwnd) = hwnd_of(window) else { return; }; let corner...
rust_dataset_chunk_517337
rust_dataset.txt
517,337
512
Self { Shell { _taskbar: crate::windows_shell::taskbar::describe(window), _session_end: crate::windows_shell::session_end::watch( window, memory.shared.clone(), detacher, ), } } } --- FILE: zellij/zellij-terminal/...
rust_dataset_chunk_517338
rust_dataset.txt
517,338
512
Desktop, DesktopMode, Hosting, PanelConnector, PreparedWindow, WindowMaker, }; use attributes::{ pick_config, popup_attributes, refresh_millihertz, requires_transparent_configs, transparency_available, window_icon, }; pub(crate) use attributes::{startup_attributes, WindowOptions}; use platform::{ activate...
rust_dataset_chunk_517339
rust_dataset.txt
517,339
512
) -> Option<u64> { if standalone || !reuse_session_windows { return None; } showing.filter(|window| *window != switching) } fn handover_to(window: u64, target: ConnectToSession) -> Handover { Handover { window, tab: target.tab_position, pane: target.pane_id.map(|(id, plu...
rust_dataset_chunk_517340
rust_dataset.txt
517,340
512
shell: Shell, window: Window, surface: Surface<WindowSurface>, context: PossiblyCurrentContext, renderer: Renderer, size: winit::dpi::PhysicalSize<u32>, } pub(crate) type Switching = Box<dyn FnMut(&ConnectToSession, Geometry) -> Result<Connection>>; pub(crate) struct App { state: TerminalState...
rust_dataset_chunk_517341
rust_dataset.txt
517,341
512
crate::emulation::color::Srgb>, transparency_available: bool, warned_opaque: bool, undecorated: bool, } pub(crate) struct Session { client: Client, detacher: Detacher, loop_options: LoopOptions, proxy: EventLoopProxy<Wake>, key: u64, switching: Switching, outcomes: Vec<LoopOutco...
rust_dataset_chunk_517342
rust_dataset.txt
517,342
512
=> modifiers.control_key() && modifiers.shift_key() && !modifiers.alt_key(), }; is_n && wanted } pub(crate) fn wants_to_close(&self, event: &KeyEvent) -> bool { event.state.is_pressed() && !event.repeat && closes_the_panel(Platform::current(), self.modifiers, &e...
rust_dataset_chunk_517343
rust_dataset.txt
517,343
512
.rescale_keeping_cells(scale_factor, &mut inner_size_writer); }, WindowEvent::ModifiersChanged(modifiers) => { self.modifiers_changed(modifiers); self.refresh_pointer(); }, WindowEvent::KeyboardInput { event, ...
rust_dataset_chunk_517344
rust_dataset.txt
517,344
512
bind wl_data_device_manager per seat, accept // `text/uri-list`, read it off the main thread and decode the `file://` // URIs into paths for `dropped_file`. Delete that once on winit 0.31. // Note winit#4729: Hyprland only sends drags to a client's first data // ...
rust_dataset_chunk_517345
rust_dataset.txt
517,345
512
: f64, (width, height): (u32, u32), (left, top): (i32, i32), ) -> [scene::Rect; 4] { let line = (scale.round() as u32).max(1); let rect = |x: u32, y: u32, width: u32, height: u32| scene::Rect { x: x as i32 - left, y: y as i32 - top, width, height, color, }; ...
rust_dataset_chunk_517346
rust_dataset.txt
517,346
512
aturating_sub(size.cols as u32 * cell_width) / 2; y += room_y.saturating_sub(size.rows as u32 * cell_height) / 2; } GridFit { rows: size.rows, cols: size.cols, origin: (x as i32, y as i32), } } // The shadow of a window with a wholly clear background is drawn from what the w...
rust_dataset_chunk_517347
rust_dataset.txt
517,347
512
, Context, Result}; use std::sync::{Arc, Mutex}; use std::time::Instant; use winit::event_loop::{EventLoop, EventLoopProxy}; use winit::keyboard::ModifiersState; use zellij_utils::data::ConnectToSession; use zellij_utils::input::terminal::StartupMode; pub(crate) struct TerminalWindow { pub connection: Connection, ...
rust_dataset_chunk_517348
rust_dataset.txt
517,348
512
.activation_token = token; app } pub fn run( connection: Connection, loop_options: LoopOptions, window: WindowOptions, fonts: FontStack, switching: Switching, listen: bool, ) -> Result<LoopOutcome> { let windowing = Windowing::bring_up()?; let _listening = if listen { crate:...
rust_dataset_chunk_517349
rust_dataset.txt
517,349
512
Desktop::new(windowing.proxy(), DesktopMode::Single); desktop.adopt(app); windowing.drive(&mut desktop) } impl Session { pub(super) fn spawn(&mut self, connection: Connection) { let sink = ProxySink { proxy: self.proxy.clone(), key: self.key, }; self.client ...
rust_dataset_chunk_517350
rust_dataset.txt
517,350
512
fonts: FontStack, startup: Startup, ) -> Self { let cache = GlyphCache::new(fonts); let metrics = cache.metrics(); Self { state, cache, metrics, options: options.clone(), startup, } } pub(super) fn into_app...
rust_dataset_chunk_517351
rust_dataset.txt
517,351
512
: Shown::Windowed, }, appearance: Appearance { look: WindowLook::Terminal, border: None, transparency_available: true, warned_opaque: false, undecorated: false, }, } } } pub(crate) struct Win...
rust_dataset_chunk_517352
rust_dataset.txt
517,352
512
impl FnOnce(String), ) -> Result<T> { match std::panic::catch_unwind(std::panic::AssertUnwindSafe(work)) { Ok(outcome) => outcome, Err(payload) => { let message = format!( "The connection to the session crashed: {}", crate::diagnostics::panic_text(payload...
rust_dataset_chunk_517353
rust_dataset.txt
517,353
512
, String); 2] { [ ("DisplayName", identity.display_name.to_owned()), ("IconUri", icon.display().to_string()), ] } fn set_value(key: &str, name: &str, value: &str) -> Result<()> { let mut handle: HKEY = std::ptr::null_mut(); let created = unsafe { RegCreateKeyExW( HKE...
rust_dataset_chunk_517354
rust_dataset.txt
517,354
512
/zellij-terminal/src/windows_shell/com.rs --- pub use zellij_utils::desktop_integration::com::*; --- FILE: zellij/zellij-terminal/src/windows_shell/console_events.rs --- use std::sync::OnceLock; use std::time::Duration; use windows_sys::Win32::Foundation::BOOL; use windows_sys::Win32::System::Console::{ SetConso...
rust_dataset_chunk_517355
rust_dataset.txt
517,355
512
), Response::End); assert_eq!( response_to(CTRL_CLOSE_EVENT), Response::EndAndWait, "Windows ends the process as soon as a close is handled, so ending needs time" ); assert_eq!( response_to(CTRL_LOGOFF_EVENT), Response::Ignore, ...
rust_dataset_chunk_517356
rust_dataset.txt
517,356
512
list.SetAppID(&HSTRING::from(identity().windows_app_id().as_str()))?; let mut slots = 0u32; let _removed: IObjectArray = list.BeginList(&mut slots)?; let tasks: IObjectCollection = CoCreateInstance(&EnumerableObjectCollection, None, CLSCTX_INPROC_SERVER) .cont...
rust_dataset_chunk_517357
rust_dataset.txt
517,357
512
_ID: usize = 0x7a65_6c6c; #[derive(Debug, Clone, PartialEq, Eq)] pub struct Remembered { pub path: PathBuf, pub state: WindowState, pub windowed_known: bool, } pub type SharedRemembered = Arc<Mutex<Option<Remembered>>>; struct Watch { remembered: SharedRemembered, detacher: Option<Detacher>, } i...
rust_dataset_chunk_517358
rust_dataset.txt
517,358
512
} unsafe extern "system" fn on_message( hwnd: HWND, message: u32, wparam: WPARAM, lparam: LPARAM, _subclass: usize, watch: usize, ) -> LRESULT { match message { WM_QUERYENDSESSION => 1, WM_ENDSESSION if wparam != 0 => { (*(watch as *const Watch)).session_ending()...
rust_dataset_chunk_517359
rust_dataset.txt
517,359
512
path, state, true), detacher: None, }, ) .expect("the window could not be watched"); assert_eq!( unsafe { SendMessageW(window.0, WM_QUERYENDSESSION, 0, 0) }, 1, "the window must never hold up the end of a Windows session" )...
rust_dataset_chunk_517360
rust_dataset.txt
517,360
512
System::Com::StructuredStorage::PROPVARIANT; use windows::Win32::UI::Shell::PropertiesSystem::{IPropertyStore, SHGetPropertyStoreForWindow}; use winit::raw_window_handle::{HasWindowHandle, RawWindowHandle}; use winit::window::Window; use crate::config::identity::identity; use crate::windows_shell::com::{set_string, Co...
rust_dataset_chunk_517361
rust_dataset.txt
517,361
512
format!("{},0", exe.display()), )?; set_string( &entry.store, &PKEY_AppUserModel_ID, &identity.windows_app_id(), )?; Ok(entry) } impl Drop for TaskbarEntry { fn drop(&mut self) { let empty = PROPVARIANT::default(); for key in &PROPERTIES { let _ =...
rust_dataset_chunk_517362
rust_dataset.txt
517,362
512
(&PKEY_AppUserModel_RelaunchIconResource), r"C:\no\such\zellij.exe,0" ); assert_eq!( window.property(&PKEY_AppUserModel_ID), "zellij.terminal", "the relaunch properties only count on a window with its own app id" ); drop(entry); fo...
rust_dataset_chunk_517363
rust_dataset.txt
517,363
512
_console() -> u32 { let mut ids = [0u32; 4]; unsafe { GetConsoleProcessList(ids.as_mut_ptr(), ids.len() as u32) } } fn open_log(path: &Path, limit: u64) -> io::Result<File> { if fs::metadata(path).is_ok_and(|metadata| metadata.len() > limit) { let mut old = path.as_os_str().to_owned(); old....
rust_dataset_chunk_517364
rust_dataset.txt
517,364
512
_ICONERROR | MB_SETFOREGROUND, ); } } #[cfg(test)] mod tests { use super::*; use anyhow::{anyhow, Context}; #[test] fn messages_vanish_without_a_console_window_or_on_a_console_of_our_own() { assert!( messages_vanish(false, 1), "the launcher's hidden console ...
rust_dataset_chunk_517365
rust_dataset.txt
517,365
512
_message(&error, None), "failed to read the configuration: config.kdl:3: unexpected token", "without a log there is nowhere to point to" ); } #[test] fn a_crash_names_the_application_and_the_panic() { let message = crash_message("panicked at src/window.rs:1:1:\nboom"...
rust_dataset_chunk_517366
rust_dataset.txt
517,366
512
self.timing.pacer.schedule(); } pub(in crate::window) fn follow_cursor_area(&mut self) { let (row, col) = self.state.cursor_position(); let area = ( self.origin.0 + (col as u32 * self.metrics.width) as i32, self.origin.1 + (row as u32 * self.metrics.height) as i3...
rust_dataset_chunk_517367
rust_dataset.txt
517,367
512
) = (self.origin.0.max(0) as u32, self.origin.1.max(0) as u32); scene::padding_rects( &self.state, &self.options.paints, self.metrics, self.effective_transparency(), Margins { left...
rust_dataset_chunk_517368
rust_dataset.txt
517,368
512
ime.composition.shown(); self.scroll.build_layer( &mut self.layer, SceneInputs { state: &self.state, phase: self.timing.blink, paints: &self.options.paints, cursor: cursor, hovered_link: None, ...
rust_dataset_chunk_517369
rust_dataset.txt
517,369
512
{ keyboard::Resolution::Key => self.deliver(&press), keyboard::Resolution::Type(text) => self.type_text(text), keyboard::Resolution::TypeThenKey(text) => { self.type_text(text); self.deliver(&press); }, ...
rust_dataset_chunk_517370
rust_dataset.txt
517,370
512
(); if let Err(e) = self.tell(msg) { report!("failed to send typed text: {}", e); } } pub(in crate::window) fn on_ime(&mut self, event: Ime) { let reaction = self.ime.composition.ime(event); let committed = match reaction { Reaction::Commit(text) => Some(...
rust_dataset_chunk_517371
rust_dataset.txt
517,371
512
| clipboard.set(&text)); } } pub(in crate::window) fn with_clipboard<T>( &self, f: impl FnOnce(&mut Clipboard) -> T, ) -> Option<T> { Some(f(&mut clipboard::lock(&self.clipboard))) } } --- FILE: zellij/zellij-terminal/src/window/terminal_app/layout.rs --- use crate::co...
rust_dataset_chunk_517372
rust_dataset.txt
517,372
512
false; }, } true } pub(in crate::window) fn relayout(&mut self, width: u32, height: u32) { self.cancel_scroll_animations(); self.retained.mark_everything(); self.schedule_draw(); self.reflow(width, height); } pub(in crate::window) fn rescale...
rust_dataset_chunk_517373
rust_dataset.txt
517,373
512
&& (col + 1 >= size.cols || blank(col + 1)) } pub(crate) fn pointer_back_to_normal(&mut self) { self.refresh_pointer(); } pub(in crate::window) fn padding_px(&self) -> Margins { let pixels = |logical: f32| (logical as f64 * self.scale).round().max(0.0) as u32; let padding = se...
rust_dataset_chunk_517374
rust_dataset.txt
517,374
512
fn fitted(&self, width: u32, height: u32) -> Geometry { let grid = self.grid(width, height); Geometry { rows: grid.rows, cols: grid.cols, cell_width: self.metrics.width as usize, cell_height: self.metrics.height as usize, } } pub(in crate...
rust_dataset_chunk_517375
rust_dataset.txt
517,375
512
crate::window) fn share_window_state(&self) { self.placement.remembered.share( self.placement.state_path.as_ref(), || self.window_state(), self.placement.windowed_known, ); } pub(in crate::window) fn reflow(&mut self, width: u32, height: u32) { if ha...
rust_dataset_chunk_517376
rust_dataset.txt
517,376
512
(&frame) { report!("the message could not be drawn: {}", e); return; } crate::window::notice::mark_shown(); self.retained.mark_everything(); self.schedule_draw(); } pub(in crate::window) fn scroll_notice( &mut self, scroll: impl FnOnce(&mu...
rust_dataset_chunk_517377
rust_dataset.txt
517,377
512
input::links::{self}; use crate::input::momentum::{self, Touch}; use crate::input::mouse::{self}; use crate::platform::Platform; use crate::render::retained::{self}; use crate::window::desktop::grips::{grip_at, Grip}; use crate::window::desktop::{hover, start_grip, Hover, WindowOps}; use crate::window::App; use std::ti...
rust_dataset_chunk_517378
rust_dataset.txt
517,378
512
resize_edge_at(&self, position: winit::dpi::PhysicalPosition<f64>) -> Option<Grip> { if !self.appearance.undecorated || Platform::current() == Platform::MacOs || self.mouse.selecting || self.mouse.pointer.holding() { return None; } let win...
rust_dataset_chunk_517379
rust_dataset.txt
517,379
512
cell.1))); return true; } if !self.mouse.selecting { return false; } self.mouse.selecting = false; if self .mouse .selection .is_some_and(|selection| !selection.is_empty()) { self.mouse.armed_link = ...
rust_dataset_chunk_517380
rust_dataset.txt
517,380
512
pane_takes_the_click( Some(self.mouse.pointer.cell(self.geometry.get())), self.state.geometry(), ); let enabled = self.options.middle_click_paste; let primary = (enabled && !takes_the_click) .then(|| self.with_clipboard(|clipboard| clip...
rust_dataset_chunk_517381
rust_dataset.txt
517,381
512
(in crate::window) fn refresh_hover(&mut self) -> bool { let hovered = self .mouse .pointer .cell_if_inside(self.geometry.get()) .and_then(|(x, y)| links::run_at(self.state.screen(), y as usize, x as usize)); if hovered == self.mouse.hovered_link { ...
rust_dataset_chunk_517382
rust_dataset.txt
517,382
512
if let Err(e) = self.tell(ClientToServerMsg::HostTerminalFocusChanged { focused: self.focused, }) { report!("failed to report the window focus: {}", e); } } pub(in crate::window) fn toggle_fullscreen(&mut self) { let leaving = self.placement.shown == Shown::Full...
rust_dataset_chunk_517383
rust_dataset.txt
517,383
512
self.options.scroll_momentum } pub(in crate::window) fn momentum_target(&self) -> Option<momentum::Target> { momentum::target_at( self.state.geometry(), self.mouse.pointer.cell_if_inside(self.geometry.get()), ) } pub(in crate::window) fn stop_momentum(&mut self...
rust_dataset_chunk_517384
rust_dataset.txt
517,384
512
} } --- FILE: zellij/zellij-terminal/src/window/terminal_app/session.rs --- use crate::emulation::palette; use crate::emulation::terminal::{FrameError, TerminalState}; use crate::session::client_loop::Ending; use crate::session::connection::{request_detach, request_force_close, send, Geometry}; use crate::window:...
rust_dataset_chunk_517385
rust_dataset.txt
517,385
512
be running a different version of zellij.", e )); return; }, } self.copy(); self.retitle(); self.attend(); self.refresh_hover(); self.refresh_pointer(); } pub(in crate::window) fn tell(&self, msg: C...
rust_dataset_chunk_517386
rust_dataset.txt
517,386
512
} pub(in crate::window) fn renamed(&mut self, name: String) { if name.is_empty() || name == self.session_name { return; } self.title = window_title(&name); self.session_name = name; if self.program_title { return; } if let Some(sur...
rust_dataset_chunk_517387
rust_dataset.txt
517,387
512
) { if let Err(e) = self.tell(msg) { report!("failed to re-declare a color: {}", e); } } if !self.focused { self.report_focus(); } Followed::Kept }, ...
rust_dataset_chunk_517388
rust_dataset.txt
517,388
512
{ return false; } match crate::window::notice::trouble(&ending, &self.session_name) { Some(trouble) if !self.leaving => { self.stranded(anyhow!("{}", crate::window::notice::ended(&trouble))); false }, _ => { ...
rust_dataset_chunk_517389
rust_dataset.txt
517,389
512
self, zoom_reset: bool) { self.cancel_scroll_animations(); self.stop_momentum(); let mut next = crate::config::options::resolve(&self.settings, self.theme_mode); if matches!(self.appearance.look, WindowLook::Popup { .. }) { crate::launch::panel_look(&mut next); } ...
rust_dataset_chunk_517390
rust_dataset.txt
517,390
512
surfaces.window, self.options.option_as_alt); } } } pub(in crate::window) fn effective_transparency(&self) -> Transparency { if self.appearance.transparency_available { self.options.transparency } else { Transparency::OPAQUE } } pub(i...
rust_dataset_chunk_517391
rust_dataset.txt
517,391
512
WindowHandle; use winit::window::{ImePurpose, WindowAttributes}; use zellij_utils::input::terminal::StartupMode; impl App { pub(in crate::window) fn requested_size(&self) -> winit::dpi::Size { let width = (self.metrics.width * self.placement.startup.cols as u32) as f64 / self.scale; let height = (s...
rust_dataset_chunk_517392
rust_dataset.txt
517,392
512
&& !self.options.decorations; let base = match self.appearance.look { WindowLook::Terminal => { startup_attributes(base, self.placement.startup.mode).with_decorations(!undecorated) }, WindowLook::Popup { position } => popup_attributes(base, position), ...
rust_dataset_chunk_517393
rust_dataset.txt
517,393
512
glow::Context::from_loader_function_cstr(|symbol| display.get_proc_address(symbol)) }; let size = window.inner_size(); Ok(Surfaces { _shell: Shell::attach( &window, &self.placement.remembered, self.session ...
rust_dataset_chunk_517394
rust_dataset.txt
517,394
512
cell_height: 20, } } fn test_options(intercept_paste: bool) -> Options { Options { font: FontOptions { family: None, size: DEFAULT_FONT_SIZE, system_fonts: false, ligatures: DEFAULT_LIGATURES, ..FontOptions::default() }, paste...
rust_dataset_chunk_517395
rust_dataset.txt
517,395
512
AKE + expected; let server = FakeServer::spawn(move |side| side.expect(total)); let connection = attach_at( &server.path, "app-test", geometry(), Capabilities::default(), ) .unwrap(); let mut owned = Clipboard::in_memory(); ...
rust_dataset_chunk_517396
rust_dataset.txt
517,396
512
_with_the_display() { let ink = [1, 2, 3]; let rect = |x: i32, y: i32, width: u32, height: u32| scene::Rect { x, y, width, height, color: ink, }; assert_eq!( border_rects(ink, 1.0, (100, 50), (0, 0)), [ rect(0, 0, 100, 1), r...
rust_dataset_chunk_517397
rust_dataset.txt
517,397
512
, 20, (0, 0))); } #[test] fn padding_is_taken_off_the_window_before_the_grid_is_fitted() { let fit = fit_grid((820, 430), (8, 20), margins(10, 5, 10, 5), false); assert_eq!((fit.cols, fit.rows), (100, 21)); assert_eq!(fit.origin, (10, 5)); let fit = fit_grid((819, 430), (8, 20), margins(10, 5, 10, 6), ...
rust_dataset_chunk_517398
rust_dataset.txt
517,398
512
10.0, left: 20.0, }; let mut harness = Harness::with(3, options, ""); harness.app.reflow(350, 420); assert_eq!(harness.app.origin, (20, 10)); let geometry = harness.app.geometry.get(); assert_eq!((geometry.cols, geometry.rows), (40, 20)); harness .app .on_cursor_move...
rust_dataset_chunk_517399
rust_dataset.txt
517,399
512
::PhysicalSize::new(8 * 100 + 32, 20 * 30 + 20), "padding is logical and must double with the display scale" ); let exact = harness.app.exact_size(100, 30); let fitted = harness.app.fitted(exact.width, exact.height); assert_eq!((fitted.cols, fitted.rows), (100, 30)); } #[test] fn a_window_stran...