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_518500 | rust_dataset.txt | 518,500 | 512 | let close_pane = ContextMenuAction::ClickedPane(ClickedPaneAction::CloseFocus);
let move_tab = ContextMenuAction::ClickedTab(ClickedTabAction::Move(Direction::Left));
let explicit = ContextMenuAction::Action(Action::CloseFocusByPaneId {
pane_id: PaneId::Terminal(9),
});
asse... |
rust_dataset_chunk_518501 | rust_dataset.txt | 518,501 | 512 | item("y"),
],
defaults.clone(),
);
statements_rebuild(
vec![item("b"), item("a"), ContextMenuEntry::Separator, item("c")],
defaults.clone(),
);
statements_rebuild(vec![item("z")], vec![]);
assert_eq!(
con... |
rust_dataset_chunk_518502 | rust_dataset.txt | 518,502 | 512 | ) -> Option<&'static str> {
crate::distribution::builtin_keybind_preset(name)
.map(|preset| preset.preset)
.or_else(|| {
BUILTIN_KEYBIND_PRESETS
.iter()
.find(|(builtin_name, _)| *builtin_name == name)
.map(|(_, text)| *text)
})
}
... |
rust_dataset_chunk_518503 | rust_dataset.txt | 518,503 | 512 | {
pub fn is_empty(&self) -> bool {
!self.clear_defaults && self.modes.values().all(|mode| mode.is_empty())
}
pub fn has_bindings(&self) -> bool {
self.modes.values().any(|mode| !mode.is_empty())
}
pub fn has_keybindings(&self) -> bool {
self.has_bindings()
}
fn mode_... |
rust_dataset_chunk_518504 | rust_dataset.txt | 518,504 | 512 | for key in &mode_changes.unbind {
keys_in_mode.remove(key);
}
for (key, actions) in &mode_changes.bind {
keys_in_mode.insert(key.clone(), actions.clone());
}
} else if let Some(keys_in_mode) = bindings.ge... |
rust_dataset_chunk_518505 | rust_dataset.txt | 518,505 | 512 | ADER_PLACEHOLDERS {
if let Some(value) = other.leader(placeholder).cloned() {
self.set_leader(placeholder, Some(value));
}
}
self.changes.compose(other.changes);
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum KeybindsLayer {
User,
Layout,
}... |
rust_dataset_chunk_518506 | rust_dataset.txt | 518,506 | 512 | let layout_value = if layout_values_apply {
self.layout.leader(placeholder).cloned()
} else {
None
};
let value = layout_value.or_else(|| {
if user_values_apply {
self.user.leader(placeholder).cloned()
... |
rust_dataset_chunk_518507 | rust_dataset.txt | 518,507 | 512 | }
}
return Ok(());
}
if let Some(children) = node.children() {
for child in children.nodes() {
collect_placeholders(child, found)?;
}
}
Ok(())
}
pub fn config_error_text(error: &ConfigError) -> String {
match error {
ConfigError::KdlError(kdl_err... |
rust_dataset_chunk_518508 | rust_dataset.txt | 518,508 | 512 | and_then(|node| node.children()) {
for node in default_values.nodes() {
let name = node.name().value();
if !LEADER_PLACEHOLDERS.contains(&name) {
return Err(format!(
"Unknown default '{}' in the preset header; th... |
rust_dataset_chunk_518509 | rust_dataset.txt | 518,509 | 512 | modifier_set(primary) == modifier_set(secondary) {
return Err(format!(
"The primary and secondary values are both '{}'; they must differ",
primary
));
}
}
Ok(values)
}
pub fn info(
&self,
name: &... |
rust_dataset_chunk_518510 | rust_dataset.txt | 518,510 | 512 | placeholder)
.ok_or_else(|| format!("No value for the placeholder {{{}}}", placeholder))?;
substituted = substituted.replace(&format!("{{{}}}", placeholder), value);
}
Ok(substituted.split_whitespace().collect::<Vec<_>>().join(" "))
}
fn mousebinds_from_node(
node: &KdlNode,
values:... |
rust_dataset_chunk_518511 | rust_dataset.txt | 518,511 | 512 | ::from(value);
let path = if path.is_absolute() {
path
} else {
match config_dir {
Some(config_dir) => config_dir.join(path),
None => path,
}
};
return std::fs::read_to_string(&path)
.map(|text| (text, Keybin... |
rust_dataset_chunk_518512 | rust_dataset.txt | 518,512 | 512 | , config_dir).map_err(|e| {
(
ActiveKeybindPreset {
info: fallback_info(source_for_value),
error: Some(e.clone()),
..Default::default()
},
e,
)
})?;
let preset = KeybindPreset:... |
rust_dataset_chunk_518513 | rust_dataset.txt | 518,513 | 512 | Some(&path)));
true
},
Some((path, Err(error))) => {
errors.push(KeybindPresetWithError {
name: name.to_owned(),
path: path.display().to_string(),
error,
});
false
},
None => false,
}
}
... |
rust_dataset_chunk_518514 | rust_dataset.txt | 518,514 | 512 | format!("{}", e))
.and_then(|text| KeybindPreset::from_kdl(&text))
{
Ok(preset) => presets.push(preset.info(&name, KeybindPresetSource::File, Some(path))),
Err(error) => errors.push(KeybindPresetWithError {
name: name.clone(),
path: name,
... |
rust_dataset_chunk_518515 | rust_dataset.txt | 518,515 | 512 | ; use letters, digits, '-' and '_'",
new_name
));
}
let target = keybinds_dir.join(format!("{}.kdl", new_name));
if target.exists() {
return Err(format!("{} already exists", target.display()));
}
let mut header = format!(
"preset {{\n name {}\n description {... |
rust_dataset_chunk_518516 | rust_dataset.txt | 518,516 | 512 | = document
.get_mut("preset")
.and_then(|header| header.children_mut().as_mut())
.and_then(|header| header.get_mut("name"))
{
name_node.clear_entries();
name_node.push(KdlEntry::new(new_name.to_owned()));
}
std::fs::create_dir_all(keybinds_dir)
.map_err(|e| f... |
rust_dataset_chunk_518517 | rust_dataset.txt | 518,517 | 512 | _line_keybinds(&Options::default());
}
pub fn apply_command_line_keybinds(&mut self, options: &Options) -> bool {
let before = self.command_line_keybinds();
self.set_command_line_keybinds(options);
if self.command_line_keybinds() != before {
self.resolve_keybinds();
... |
rust_dataset_chunk_518518 | rust_dataset.txt | 518,518 | 512 | {
if !(preset_given_on_command_line && changes.clear_defaults) {
changes.apply(&mut keybinds);
}
}
if self.keybinds.as_ref() != &keybinds {
self.keybinds = Arc::new(keybinds);
}
let mut mousebinds = resolved.mousebinds;
for cha... |
rust_dataset_chunk_518519 | rust_dataset.txt | 518,519 | 512 | active_values: layers.active.values.clone(),
error: layers.active.error.clone(),
set_by_layout: layers.layout.preset.is_some() && self.options.keybinds_preset.is_none(),
default_mode: self.options.default_mode,
set_on_command_line: self.has_command_line_keybinds(),
... |
rust_dataset_chunk_518520 | rust_dataset.txt | 518,520 | 512 | mode_keybindings.get(key_with_modifier).cloned()
}
})
.unwrap_or_else(|| {
vec![self.default_action_for_mode(
mode,
Some(key_with_modifier),
raw_bytes,
default_input_mode,
... |
rust_dataset_chunk_518521 | rust_dataset.txt | 518,521 | 512 | .entry(other_input_mode)
.or_insert_with(|| Default::default());
for (other_action, other_action_keybinds) in other_input_mode_keybinds.drain() {
input_mode_keybinds.insert(other_action, other_action_keybinds);
}
}
}
}
const MAX_SHORTCUT_SEARCH_DEPTH... |
rust_dataset_chunk_518522 | rust_dataset.txt | 518,522 | 512 | without a carriage
// return) and ctrl-j - so here, if ctrl-j is bound we return its bound action, and otherwise we
// just write the raw bytes to the terminal and let whichever program is there decide what they are
fn handle_ctrl_j(
mode_keybindings: &HashMap<KeyWithModifier, Vec<Action>>,
raw_bytes: &[u8],
... |
rust_dataset_chunk_518523 | rust_dataset.txt | 518,523 | 512 | use std::vec::Vec;
use std::{
fmt,
ops::Not,
path::{Path, PathBuf},
};
use std::{fs::File, io::prelude::*};
use url::Url;
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone, Copy)]
pub enum SplitDirection {
Horizontal,
Vertical,
}
impl Not for SplitDirection {
type Output = Self;
... |
rust_dataset_chunk_518524 | rust_dataset.txt | 518,524 | 512 | }
}
impl RunPluginOrAlias {
pub fn location_string(&self) -> String {
match self {
RunPluginOrAlias::RunPlugin(run_plugin) => run_plugin.location.display(),
RunPluginOrAlias::Alias(plugin_alias) => plugin_alias.name.clone(),
}
}
pub fn populate_run_plugin_if_needed(... |
rust_dataset_chunk_518525 | rust_dataset.txt | 518,525 | 512 | UserConfiguration::new(c.clone()))
.unwrap_or_default(),
..Default::default()
})),
Err(PluginsConfigError::InvalidUrlScheme(_))
| Err(PluginsConfigError::InvalidUrl(..)) => {
let mut plugin_alias = PluginAlias::new(&url, configurati... |
rust_dataset_chunk_518526 | rust_dataset.txt | 518,526 | 512 | pub fn is_builtin_plugin(&self) -> bool {
self.get_run_plugin()
.map(|r| matches!(r.location, RunPluginLocation::Zellij(_)))
.unwrap_or(false)
}
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
pub enum Run {
#[serde(rename = "plugin")]
Plugin(RunPluginOr... |
rust_dataset_chunk_518527 | rust_dataset.txt | 518,527 | 512 | _to_edit.clone(),
*line_number,
edit_cwd.clone(),
)),
},
(Some(Run::Cwd(cwd)), Some(Run::EditFile(file_to_edit, line_number, edit_cwd))) => {
let cwd = edit_cwd.clone().unwrap_or(cwd.clone());
Some(Run::EditF... |
rust_dataset_chunk_518528 | rust_dataset.txt | 518,528 | 512 | _close = !close_on_exit;
}
}
}
pub fn add_start_suspended(&mut self, start_suspended: Option<bool>) {
// overrides the hold_on_start of a Run::Command if they are Some
// and not empty
if let Some(start_suspended) = start_suspended {
if let Run::Command(ru... |
rust_dataset_chunk_518529 | rust_dataset.txt | 518,529 | 512 | ) = self.get_run_plugin() {
let canonical = canonical_run_plugin(&run_plugin);
if canonical.location
== RunPluginLocation::Zellij(PluginTag::new(super::plugins::BARS_PLUGIN_NAME))
{
let role = canonical
.configuration
... |
rust_dataset_chunk_518530 | rust_dataset.txt | 518,530 | 512 | -> Self {
if let Some(configuration) = configuration {
self.configuration.merge(configuration);
}
self
}
}
#[derive(Debug, Serialize, Deserialize, Clone, Default, Eq)]
pub struct PluginAlias {
pub name: String,
pub configuration: Option<PluginUserConfiguration>,
pub... |
rust_dataset_chunk_518531 | rust_dataset.txt | 518,531 | 512 | .as_ref()
.map(|c| c.inner().get("caller_cwd").is_none())
.unwrap_or(true)
{
let configuration = self
.configuration
.get_or_insert_with(|| PluginUserConfiguration::new(BTreeMap::new()));
configuration.i... |
rust_dataset_chunk_518532 | rust_dataset.txt | 518,532 | 512 | ")?.to_owned();
let value = config.map(|c| c.to_owned()).collect::<Vec<_>>().join("=");
ret.insert(key, value);
}
Ok(PluginUserConfiguration(ret))
}
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
pub enum RunPluginLocation {
File(PathBuf),
Zel... |
rust_dataset_chunk_518533 | rust_dataset.txt | 518,533 | 512 | ) -> String {
match self {
RunPluginLocation::File(pathbuf) => format!("file:{}", pathbuf.display()),
RunPluginLocation::Zellij(plugin_tag) => format!("zellij:{}", plugin_tag),
RunPluginLocation::Remote(url) => String::from(url),
}
}
}
impl From<&RunPluginLocatio... |
rust_dataset_chunk_518534 | rust_dataset.txt | 518,534 | 512 | Option<String> is the swap layout name
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Default)]
pub struct Layout {
pub tabs: Vec<(Option<String>, TiledPaneLayout, Vec<FloatingPaneLayout>)>,
pub focused_tab_index: Option<usize>,
pub template: Option<(TiledPaneLayout, Vec<FloatingPaneLayout>)>,
... |
rust_dataset_chunk_518535 | rust_dataset.txt | 518,535 | 512 | Fixed(fixed_size),
}
}
}
impl PercentOrFixed {
pub fn to_position(&self, whole: usize) -> usize {
match self {
PercentOrFixed::Percent(percent) => {
(whole as f64 / 100.0 * *percent as f64).ceil() as usize
},
PercentOrFixed::Fixed(fixed) => {
... |
rust_dataset_chunk_518536 | rust_dataset.txt | 518,536 | 512 | pub already_running: bool,
pub pane_initial_contents: Option<String>,
pub logical_position: Option<usize>,
pub default_fg: Option<String>,
pub default_bg: Option<String>,
#[serde(default)]
pub attention_muted: Option<bool>,
#[serde(default)]
pub ignore_output: Option<bool>,
}
impl Floa... |
rust_dataset_chunk_518537 | rust_dataset.txt | 518,537 | 512 | anded_in_stack: bool,
pub stack_orientation: Option<StackListOrientation>,
pub exclude_from_sync: Option<bool>,
pub run_instructions_to_ignore: Vec<Option<Run>>,
pub hide_floating_panes: bool, // only relevant if this is the base layout
pub pane_initial_contents: Option<String>,
pub default_fg: ... |
rust_dataset_chunk_518538 | rust_dataset.txt | 518,538 | 512 | ane_count();
}
pane_count
}
}
pub fn position_panes_in_space(
&self,
space: &PaneGeom,
max_panes: Option<usize>,
ignore_percent_split_sizes: bool,
focus_layout_if_not_focused: bool,
stack_orientations: &mut HashMap<usize, StackListO... |
rust_dataset_chunk_518539 | rust_dataset.txt | 518,539 | 512 | <Run>> {
// the order of these run instructions is significant and needs to be the same
// as the order of the "flattened" layout panes received from eg. position_panes_in_space
let mut run_instructions = vec![];
if self.children.is_empty() {
run_instructions.push(self.run.cl... |
rust_dataset_chunk_518540 | rust_dataset.txt | 518,540 | 512 | (&mut self, run_to_insert: Run) -> bool {
// Replaces the first empty slot (None or Run::Cwd) with the given Run instruction.
// Returns true if a replacement was made, false if no empty slot was found.
// Traversal order matches extract_run_instructions (breadth-first).
if self.childre... |
rust_dataset_chunk_518541 | rust_dataset.txt | 518,541 | 512 | 0;
for child in self.children.iter() {
let child_deepest_depth = child.deepest_depth();
if child_deepest_depth > deepest_child_depth {
deepest_child_depth = child_deepest_depth;
}
}
deepest_child_depth + 1
}
pub fn focus_deepest_pane(&... |
rust_dataset_chunk_518542 | rust_dataset.txt | 518,542 | 512 | 1 && child.children.len() > 0 {
remaining_panes =
remaining_panes.saturating_sub(child.truncate(remaining_panes));
} else {
child.children.clear();
}
}
}
self.pane_count()
}
pub fn has_foc... |
rust_dataset_chunk_518543 | rust_dataset.txt | 518,543 | 512 | Some((layout_files, layout_dir)),
Err(_) => None,
})
.map(|(layout_files, layout_dir)| {
let mut available_layouts = vec![];
let mut layouts_with_errors = vec![];
for file in layout_files {
if let Ok(file) = fil... |
rust_dataset_chunk_518544 | rust_dataset.txt | 518,544 | 512 | In("classic".to_owned()));
available_layouts.sort_by(|a, b| {
let a_name = a.name();
let b_name = b.name();
if a_name == default_layout_name {
return Ordering::Less;
} else if b_name == default_layout_name {
return Ordering::Greater... |
rust_dataset_chunk_518545 | rust_dataset.txt | 518,545 | 512 | Config>,
) -> Result<(Layout, Config), ConfigError> {
let mut should_start_layout_commands_suspended = false;
let (path_to_raw_layout, raw_layout, raw_swap_layouts) = match layout_info {
LayoutInfo::File(layout_name_without_extension, _layout_metadata) => {
let layout_dir... |
rust_dataset_chunk_518546 | rust_dataset.txt | 518,546 | 512 | .
// See the gh issue for more: https://github.com/zellij-org/zellij/issues/1412#issuecomment-1131559720
if layout_path.extension().is_some() || layout_path.components().count() > 1 {
// We look locally!
Layout::stringified_from_path(layout_path)
... |
rust_dataset_chunk_518547 | rust_dataset.txt | 518,547 | 512 | _str())),
None,
)?;
let config = Config::from_layout_kdl(&raw_layout, Some(config))?; // this merges the two config, with
Ok((layout, config))
}
#[cfg(not(target_family = "wasm"))]
pub fn from_url(url: &str, config: Config) -> Result<(Layout, Config), ConfigError> {
... |
rust_dataset_chunk_518548 | rust_dataset.txt | 518,548 | 512 | let (path_to_raw_layout, raw_layout, raw_swap_layouts) =
Layout::stringified_from_default_assets(layout_name)?;
let layout = Layout::from_kdl(
&raw_layout,
Some(path_to_raw_layout),
raw_swap_layouts
.as_ref()
.map(|(r, f)| (... |
rust_dataset_chunk_518549 | rust_dataset.txt | 518,549 | 512 | , stringified_layout, Option<path_to_swap_layout as String, stringified_swap_layout>)
let mut layout_file = File::open(&layout_path)
.or_else(|_| File::open(&layout_path.with_extension("kdl")))
.map_err(|e| ConfigError::IoPath(e, layout_path.into()))?;
let swap_layout_and_path =... |
rust_dataset_chunk_518550 | rust_dataset.txt | 518,550 | 512 | stringified_compact_from_assets()?,
Some((
"Compact layout swap".into(),
Self::stringified_compact_swap_from_assets()?,
)),
)),
Some("classic") => Ok((
"Classic layout".into(),
Self::stringifi... |
rust_dataset_chunk_518551 | rust_dataset.txt | 518,551 | 512 | elcome_from_assets() -> Result<String, ConfigError> {
Ok(String::from_utf8(setup::WELCOME_LAYOUT.to_vec())?)
}
pub fn new_tab(&self) -> (TiledPaneLayout, Vec<FloatingPaneLayout>) {
self.template.clone().unwrap_or_default()
}
pub fn is_empty(&self) -> bool {
!self.tabs.is_empty(... |
rust_dataset_chunk_518552 | rust_dataset.txt | 518,552 | 512 | new();
match stringified_swap_layout_file.read_to_string(&mut swap_kdl_layout) {
Ok(..) => Some((
swap_layout_path.as_os_str().to_string_lossy().into(),
swap_kdl_layout,
)),
Err(_e) => None,
... |
rust_dataset_chunk_518553 | rust_dataset.txt | 518,553 | 512 | _mut() {
tiled_pane_layout.add_cwd_to_layout(&cwd);
for floating_pane in floating_panes {
floating_pane.add_cwd_to_layout(&cwd);
}
}
}
pub fn pane_count(&self) -> usize {
let mut pane_count = 0;
if let Some((tiled_pane_layout, floating_... |
rust_dataset_chunk_518554 | rust_dataset.txt | 518,554 | 512 | _size => split_size,
})
.collect()
} else {
layout.children.iter().map(|part| part.split_size).collect()
};
let mut split_geom = Vec::new();
let (
mut current_position,
split_dimension_space,
inherited_dimension,
total_split_dimension_spac... |
rust_dataset_chunk_518555 | rust_dataset.txt | 518,555 | 512 | ,
_ => 0.0,
})
.sum::<f64>()
} else {
panic!("Implicit sizing within fixed-size panes is not supported");
};
Dimension::percent(free_percent / flex_parts as f64)
},... |
rust_dataset_chunk_518556 | rust_dataset.txt | 518,556 | 512 | (pane_positions)
}
fn adjust_geoms_for_rounding_errors(
total_pane_size: usize,
split_geoms: &mut Vec<PaneGeom>,
split_dimension_space: Dimension,
children_split_direction: SplitDirection,
) {
if total_pane_size < split_dimension_space.as_usize() {
// add extra space from rounding errors to... |
rust_dataset_chunk_518557 | rust_dataset.txt | 518,557 | 512 | {
following_geom.x = following_geom.x.saturating_sub(decrease_by)
},
SplitDirection::Horizontal => {
following_geom.y = following_geom.y.saturating_sub(decrease_by)
},
}
... |
rust_dataset_chunk_518558 | rust_dataset.txt | 518,558 | 512 | crate::{
data::{BareKey, InputMode, KeyModifier, KeyWithModifier, ModeInfo, PluginCapabilities},
envs,
ipc::ClientAttributes,
vendored::termwiz::input::{InputEvent, InputParser, KeyCode, KeyEvent, Modifiers},
};
use super::keybinds::Keybinds;
use std::collections::BTreeSet;... |
rust_dataset_chunk_518559 | rust_dataset.txt | 518,559 | 512 | mode: &InputMode) -> bool {
keybinds
.get_actions_for_key_in_mode(mode, key)
.map_or(false, |actions| !actions.is_empty())
}
// FIXME: This is an absolutely cursed function that should be destroyed as soon
// as an alternative that doesn't touch zellij-tile can be developed... |
rust_dataset_chunk_518560 | rust_dataset.txt | 518,560 | 512 | | KeyCode::ApplicationUpArrow => {
KeyWithModifier::new_with_modifiers(BareKey::Up, modifiers)
},
KeyCode::DownArrow | KeyCode::ApplicationDownArrow => {
KeyWithModifier::new_with_modifiers(BareKey::Down, modifiers)
},
KeyCode::Home => Key... |
rust_dataset_chunk_518561 | rust_dataset.txt | 518,561 | 512 | (
mouse::MouseEventType::Press,
true,
false,
false,
false,
false,
false,
false,
),
MouseEventKind::Down(CButton::Right) => (
... |
rust_dataset_chunk_518562 | rust_dataset.txt | 518,562 | 512 | false,
false,
false,
false,
true,
false,
),
MouseEventKind::ScrollRight => (
mouse::MouseEventType::Press,
false,
false,
... |
rust_dataset_chunk_518563 | rust_dataset.txt | 518,563 | 512 | for Char events
// - Ctrl+Alt together indicates AltGr; strip both when the
// character is printable (not a control code)
modifiers.remove(&KeyModifier::Shift);
let is_altgr = has_ctrl && has_alt && !c.is_ascii_control();
if is_altg... |
rust_dataset_chunk_518564 | rust_dataset.txt | 518,564 | 512 | ![0x1b, b'[', b'B']),
CKeyCode::Home => (BareKey::Home, vec![0x1b, b'[', b'H']),
CKeyCode::End => (BareKey::End, vec![0x1b, b'[', b'F']),
CKeyCode::PageUp => (BareKey::PageUp, b"\x1b[5~".to_vec()),
CKeyCode::PageDown => (BareKey::PageDown, b"\x1b[6~".to_vec()),
... |
rust_dataset_chunk_518565 | rust_dataset.txt | 518,565 | 512 |
return Some((
KeyWithModifier::new(BareKey::Char(' ')).with_ctrl_modifier(),
vec![0x00],
));
},
// Media keys, bare modifier presses, KeypadBegin — skip
_ => return None,
};
// Encode modifiers ... |
rust_dataset_chunk_518566 | rust_dataset.txt | 518,566 | 512 | as char).into_bytes()
},
// CSI tilde (\x1b[5~, \x1b[3~, \x1b[15~):
// → \x1b[5;{mod}~
(Some(0x1b), Some(b'['), _, Some(b'~')) if raw_bytes.len() >= 4 => {
let num_part = &raw_bytes[2..raw_bytes.len() - 1];
let num_... |
rust_dataset_chunk_518567 | rust_dataset.txt | 518,567 | 512 | sterm_key(event).unwrap();
assert_eq!(
bytes,
vec![23],
"Ctrl+W should produce raw byte 0x17, not CSI u encoding"
);
}
#[test]
fn cast_crossterm_key_ctrl_enter_gets_csi_u_encoding() {
let event = make_key_event(KeyCode::Enter, KeyModifiers::CONTRO... |
rust_dataset_chunk_518568 | rust_dataset.txt | 518,568 | 512 | MouseBehaviour::Click => "Click",
MouseBehaviour::Select => "Select",
MouseBehaviour::FocusPane => "FocusPane",
MouseBehaviour::MovePane => "MovePane",
MouseBehaviour::ResizePane => "ResizePane",
MouseBehaviour::ToggleFullscreen => "ToggleFullscreen",
... |
rust_dataset_chunk_518569 | rust_dataset.txt | 518,569 | 512 | {
[] => Ok(default),
[value] => value
.parse::<usize>()
.ok()
.filter(|value| *value > 0)
.ok_or_else(|| format!("{} needs a positive whole number", name)),
_ => Err(format!("{} takes one num... |
rust_dataset_chunk_518570 | rust_dataset.txt | 518,570 | 512 | ("DrawFloatingPane takes one plugin".to_owned()),
},
_ => Err(format!("Unknown mouse behaviour '{}'", name)),
}
}
pub fn arguments(&self) -> Vec<String> {
match self {
MouseBehaviour::Scroll(lines) => vec![lines.to_string()],
MouseBehaviour::Scroll... |
rust_dataset_chunk_518571 | rust_dataset.txt | 518,571 | 512 | }
}
impl fmt::Display for MouseBehaviour {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.kdl_text())
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum MouseBindingKind {
Behaviour(MouseBehaviour),
Actions(Vec<Action>),
}
#[derive(Debug,... |
rust_dataset_chunk_518572 | rust_dataset.txt | 518,572 | 512 | {
Some(MouseButton::Right)
} else if event.middle {
Some(MouseButton::Middle)
} else {
None
}
}
pub fn mouse_modifiers_of_event(event: &MouseEvent) -> BTreeSet<KeyModifier> {
let mut modifiers = BTreeSet::new();
if event.ctrl {
modifiers.insert(KeyModifier::Ctrl);
... |
rust_dataset_chunk_518573 | rust_dataset.txt | 518,573 | 512 | }
let click_count = if button.is_wheel() {
1
} else {
click_count.clamp(1, 3)
};
for modifiers in modifier_sets {
for count in (1..=click_count).rev() {
for target in [place, MouseTarget::Any] {
let trigger = MouseT... |
rust_dataset_chunk_518574 | rust_dataset.txt | 518,574 | 512 | , PartialEq, Eq, Deserialize, Serialize)]
pub enum MouseEventType {
/// A mouse button was pressed.
Press,
/// A mouse button was released.
Release,
/// A mouse button is held over the given coordinates.
Motion,
}
impl MouseEvent {
pub fn new() -> Self {
let event = MouseEvent {
... |
rust_dataset_chunk_518575 | rust_dataset.txt | 518,575 | 512 | false,
wheel_left: false,
wheel_right: false,
wheel_lines: 0,
shift: false,
alt: false,
ctrl: false,
position,
};
event
}
pub fn new_middle_release_event(position: Position) -> Self {
let event = MouseEv... |
rust_dataset_chunk_518576 | rust_dataset.txt | 518,576 | 512 | false,
wheel_lines: 0,
shift: false,
alt: false,
ctrl: false,
position,
};
event
}
pub fn new_middle_motion_event(position: Position) -> Self {
let event = MouseEvent {
event_type: MouseEventType::Motion,
... |
rust_dataset_chunk_518577 | rust_dataset.txt | 518,577 | 512 | _lines: 0,
shift: false,
alt: false,
ctrl: true,
position,
};
event
}
pub fn new_left_release_with_ctrl_event(position: Position) -> Self {
let event = MouseEvent {
event_type: MouseEventType::Release,
left: true,
... |
rust_dataset_chunk_518578 | rust_dataset.txt | 518,578 | 512 | false,
alt: false,
ctrl: false,
position,
};
event
}
pub fn new_scroll_right_event(position: Position) -> Self {
let event = MouseEvent {
event_type: MouseEventType::Press,
left: false,
right: false,
mid... |
rust_dataset_chunk_518579 | rust_dataset.txt | 518,579 | 512 | ctrl: true,
position,
};
event
}
}
impl Default for MouseEvent {
fn default() -> Self {
MouseEvent::new()
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::client_server_contract::client_server_contract::MouseEvent as ProtoMouseEvent;
use crate::plugin_... |
rust_dataset_chunk_518580 | rust_dataset.txt | 518,580 | 512 | () {
for lines in [0, 3, u16::MAX] {
let event = touchpad_scroll(lines);
let payload = ProtobufMouseEventPayload::try_from(event).unwrap();
let back = MouseEvent::try_from(payload).unwrap();
assert_eq!(back, event);
}
}
}
--- FILE: zellij/zellij-util... |
rust_dataset_chunk_518581 | rust_dataset.txt | 518,581 | 512 | "detach")]
Detach,
}
impl Default for OnQuit {
fn default() -> Self {
Self::AskQuit
}
}
impl OnQuit {
pub fn as_str(&self) -> &'static str {
match self {
OnQuit::AskQuit => "ask_quit",
OnQuit::AskDetach => "ask_detach",
OnQuit::Quit => "quit",
... |
rust_dataset_chunk_518582 | rust_dataset.txt | 518,582 | 512 | Full,
_ => PaneFrameStyle::Titles,
}
}
}
impl FromStr for PaneFrameStyle {
type Err = Box<dyn std::error::Error>;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.trim().to_lowercase().as_str() {
"full" => Ok(PaneFrameStyle::Full),
"titles" => Ok... |
rust_dataset_chunk_518583 | rust_dataset.txt | 518,583 | 512 | #[serde(default)]
pub simplified_ui: Option<bool>,
/// Set the default theme
#[clap(long, value_parser)]
pub theme: Option<String>,
/// Theme name to apply when the host terminal reports a dark color palette
/// (CSI 2031 / DSR 997). Requires `theme_light` to also be set; if either
/// is m... |
rust_dataset_chunk_518584 | rust_dataset.txt | 518,584 | 512 | help = "Use this keybinding preset for this session: a name from the keybinds folder, a built-in preset, or a path to a preset file"
)]
#[serde(default)]
pub keybinds_preset: Option<String>,
#[clap(
long,
value_parser,
help = "The primary leader key for the keybinding preset (fo... |
rust_dataset_chunk_518585 | rust_dataset.txt | 518,585 | 512 | copy when selecting text (true or false)
#[clap(long, value_parser)]
#[serde(default)]
pub copy_on_select: Option<bool>,
/// Enable OSC8 hyperlink output (true or false)
#[clap(long, value_parser)]
#[serde(default)]
pub osc8_hyperlinks: Option<bool>,
/// Explicit full path to open the... |
rust_dataset_chunk_518586 | rust_dataset.txt | 518,586 | 512 | (must also be supported by the
/// host terminal), defaults to true if the terminal supports it
#[clap(long, value_parser)]
#[serde(default)]
pub support_kitty_keyboard_protocol: Option<bool>,
/// Whether to enable support for the Kitty graphics (image) protocol (must also be supported
/// by ... |
rust_dataset_chunk_518587 | rust_dataset.txt | 518,587 | 512 | Option<bool>,
/// Whether to allow new sessions to be shared through a local web server, assuming one is
/// running (see the `web_server` option for more details).
///
/// Note: if Zellij was compiled without web_server_capability, this option will be locked to
/// "disabled"
///
/// Poss... |
rust_dataset_chunk_518588 | rust_dataset.txt | 518,588 | 512 | ap(long, value_parser)]
#[serde(default)]
pub mouse_scroll_resize: Option<bool>,
/// Whether scrolling a pane implicitly enters (and leaving the scroll implicitly exits) Scroll mode
/// default is true
#[clap(long, value_parser)]
#[serde(default)]
pub scroll_mode_sync: Option<bool>,
//... |
rust_dataset_chunk_518589 | rust_dataset.txt | 518,589 | 512 | >,
// these are intentionally excluded from the CLI options as they must be specified in the
// configuration file
pub web_server_ip: Option<IpAddr>,
pub web_server_port: Option<u16>,
pub web_server_cert: Option<PathBuf>,
pub web_server_key: Option<PathBuf>,
pub enforce_https_for_localhost:... |
rust_dataset_chunk_518590 | rust_dataset.txt | 518,590 | 512 | )]
#[serde(default)]
pub on_quit: Option<OnQuit>,
#[clap(
long,
value_parser,
help = "Which bars a new session starts with hidden: bar names separated by commas (eg. tab-bar,status-bar), all or none. Default is none"
)]
#[serde(default)]
pub bars_hidden_on_start: Option... |
rust_dataset_chunk_518591 | rust_dataset.txt | 518,591 | 512 | osc9" => Ok(Self::Osc9),
"Osc99" | "osc99" => Ok(Self::Osc99),
"Bell" | "bell" => Ok(Self::Bell),
"Off" | "off" => Ok(Self::Off),
_ => Err(format!("No such host_notification_protocol: {}", s)),
}
}
}
impl FromStr for Clipboard {
type Err = String;
fn ... |
rust_dataset_chunk_518592 | rust_dataset.txt | 518,592 | 512 | _primary
.or_else(|| self.keybinds_primary.clone());
let keybinds_secondary = other
.keybinds_secondary
.or_else(|| self.keybinds_secondary.clone());
let keybinds_unlock = other
.keybinds_unlock
.or_else(|| self.keybinds_unlock.clone());
... |
rust_dataset_chunk_518593 | rust_dataset.txt | 518,593 | 512 | .mirror_resizes_source_pane
.or(self.mirror_resizes_source_pane);
let live_view_release_key = other
.live_view_release_key
.or_else(|| self.live_view_release_key.clone());
let web_server = other.web_server.or(self.web_server);
let web_sharing = other.web_shar... |
rust_dataset_chunk_518594 | rust_dataset.txt | 518,594 | 512 | _https_for_localhost
.or(self.enforce_https_for_localhost);
let dangerously_allow_web_serving_without_a_certificate = other
.dangerously_allow_web_serving_without_a_certificate
.or(self.dangerously_allow_web_serving_without_a_certificate);
let post_command_discovery_h... |
rust_dataset_chunk_518595 | rust_dataset.txt | 518,595 | 512 | ,
live_view_release_key,
web_server,
web_sharing,
stacked_resize,
stacked_pane_list,
show_startup_tips,
show_release_notes,
show_setup_screen,
advanced_mouse_actions,
mouse_scroll_resize,
... |
rust_dataset_chunk_518596 | rust_dataset.txt | 518,596 | 512 | default_mode = other.default_mode.or(self.default_mode);
let default_shell = other.default_shell.or_else(|| self.default_shell.clone());
let default_cwd = other.default_cwd.or_else(|| self.default_cwd.clone());
let default_layout = other.default_layout.or_else(|| self.default_layout.clone());
... |
rust_dataset_chunk_518597 | rust_dataset.txt | 518,597 | 512 | );
let serialization_interval = other.serialization_interval.or(self.serialization_interval);
let disable_session_metadata = other
.disable_session_metadata
.or(self.disable_session_metadata);
let support_kitty_keyboard_protocol = other
.support_kitty_keyboard... |
rust_dataset_chunk_518598 | rust_dataset.txt | 518,598 | 512 | .or_else(|| self.word_separators.clone());
let host_notification_protocol = other
.host_notification_protocol
.or(self.host_notification_protocol);
let web_server_ip = other.web_server_ip.or(self.web_server_ip);
let web_server_port = other.web_server_port.or(s... |
rust_dataset_chunk_518599 | rust_dataset.txt | 518,599 | 512 | ,
keybinds_unlock,
mouse_mode,
pane_frames,
pane_frame_style,
mirror_session,
on_force_close,
scroll_buffer_size,
copy_command,
copy_clipboard,
copy_on_select,
osc8_hyperlinks,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.