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_519100
rust_dataset.txt
519,100
512
if add_comments { let mut node = create_node(true); node.set_leading(format!("{}\n// ", comment_text)); Some(node) } else { None } } fn theme_to_kdl(&self, add_comments: bool) -> Option<KdlNode> { let comment_text = format!( "{...
rust_dataset_chunk_519101
rust_dataset.txt
519,101
512
color palette.", "// Requires `theme_dark` to also be set; otherwise `theme` is used.", "// ", ); let create_node = |node_value: &str| -> KdlNode { let mut node = KdlNode::new("theme_light"); node.push(node_value.to_owned()); node }; ...
rust_dataset_chunk_519102
rust_dataset.txt
519,102
512
node }; if let Some(default_mode) = &self.default_mode { let mut node = create_node(default_mode); if add_comments { node.set_leading(format!("{}\n", comment_text)); } Some(node) } else if add_comments { let ...
rust_dataset_chunk_519103
rust_dataset.txt
519,103
512
)); Some(node) } else { None } } fn default_layout_to_kdl(&self, add_comments: bool) -> Option<KdlNode> { let comment_text = format!( "{}\n{}\n{}\n{}", " ", "// The name of the default layout to load on startup", "//...
rust_dataset_chunk_519104
rust_dataset.txt
519,104
512
KdlNode { let mut node = KdlNode::new("theme_dir"); node.push(node_value.to_owned()); node }; if let Some(theme_dir) = &self.theme_dir { let mut node = create_node(&theme_dir.display().to_string()); if add_comments { node.set_l...
rust_dataset_chunk_519105
rust_dataset.txt
519,105
512
node.set_leading(format!("{}\n", comment_text)); } Some(node) } else if add_comments { let mut node = create_node(false); node.set_leading(format!("{}\n// ", comment_text)); Some(node) } else { None } } ...
rust_dataset_chunk_519106
rust_dataset.txt
519,106
512
ading(format!("{}\n", comment_text)); } Some(node) } else if add_comments { let mut node = create_node("titles"); node.set_leading(format!("{}\n// ", comment_text)); Some(node) } else { None } } fn mirror_session_to_...
rust_dataset_chunk_519107
rust_dataset.txt
519,107
512
("quit"), }; if add_comments { node.set_leading(format!("{}\n", comment_text)); } Some(node) } else if add_comments { let mut node = create_node("quit"); node.set_leading(format!("{}\n// ", comment_text)); Some(n...
rust_dataset_chunk_519108
rust_dataset.txt
519,108
512
\" // osx", "// ", ); let create_node = |node_value: &str| -> KdlNode { let mut node = KdlNode::new("copy_command"); node.push(node_value.to_owned()); node }; if let Some(copy_command) = &self.copy_command { ...
rust_dataset_chunk_519109
rust_dataset.txt
519,109
512
node = KdlNode::new("copy_on_select"); node.push(KdlValue::Bool(node_value)); node }; if let Some(copy_on_select) = self.copy_on_select { let mut node = create_node(copy_on_select); if add_comments { node.set_leading(format!("{}\n", commen...
rust_dataset_chunk_519110
rust_dataset.txt
519,110
512
_leading(format!("{}\n", comment_text)); } Some(node) } else if add_comments { let mut node = create_node("My singleton session"); node.set_leading(format!("{}\n// ", comment_text)); Some(node) } else { None } } fn a...
rust_dataset_chunk_519111
rust_dataset.txt
519,111
512
} } fn session_serialization_to_kdl(&self, add_comments: bool) -> Option<KdlNode> { let comment_text = format!("{}\n{}\n{}\n{}\n{}\n{}", " ", "// Whether sessions should be serialized to the cache folder (including their tabs/panes, cwds and running commands) so that they can la...
rust_dataset_chunk_519112
rust_dataset.txt
519,112
512
let comment_text = format!("{}\n{}\n{}\n{}\n{}", " ", "// Scrollback lines to serialize along with the pane viewport when serializing sessions, 0", "// defaults to the scrollback size. If this number is higher than the scrollback size, it will", "// also default to the s...
rust_dataset_chunk_519113
rust_dataset.txt
519,113
512
format!( "{}\n{}\n{}", " ", "// How often in seconds sessions are serialized", "// ", ); let create_node = |node_value: u64| -> KdlNode { let mut node = KdlNode::new("serialization_interval"); node.push(KdlValue::Base10(node_value as i64)); n...
rust_dataset_chunk_519114
rust_dataset.txt
519,114
512
let mut node = KdlNode::new("support_kitty_keyboard_protocol"); node.push(KdlValue::Bool(node_value)); node }; if let Some(support_kitty_keyboard_protocol) = self.support_kitty_keyboard_protocol { let mut node = create_node(support_kitty_keyboard_protocol)...
rust_dataset_chunk_519115
rust_dataset.txt
519,115
512
: bool| -> KdlNode { let mut node = KdlNode::new("mirror_resizes_source_pane"); node.push(KdlValue::Bool(node_value)); node }; if let Some(mirror_resizes_source_pane) = self.mirror_resizes_source_pane { let mut node = create_node(mirror_resizes_source_pane...
rust_dataset_chunk_519116
rust_dataset.txt
519,116
512
let mut node = KdlNode::new("support_kitty_graphics_protocol"); node.push(KdlValue::Bool(node_value)); node }; if let Some(support_kitty_graphics_protocol) = self.support_kitty_graphics_protocol { let mut node = create_node(support_kitty_graphics_protocol); ...
rust_dataset_chunk_519117
rust_dataset.txt
519,117
512
{ let comment_text = format!( "{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}", "// Whether to allow sessions started in the terminal to be shared through a local web server, assuming one is", "// running (see the `web_server` option for more details).", "// ...
rust_dataset_chunk_519118
rust_dataset.txt
519,118
512
()); if add_comments { node.set_leading(format!("{}\n", comment_text)); } Some(node) } else if add_comments { let mut node = create_node("/path/to/cert.pem"); node.set_leading(format!("{}\n// ", comment_text)); Some(node) ...
rust_dataset_chunk_519119
rust_dataset.txt
519,119
512
); if add_comments { node.set_leading(format!("{}\n", comment_text)); } Some(node) } else if add_comments { let mut node = create_node(false); node.set_leading(format!("{}\n// ", comment_text)); Some(node) } else { ...
rust_dataset_chunk_519120
rust_dataset.txt
519,120
512
_resize { let mut node = create_node(stacked_resize); if add_comments { node.set_leading(format!("{}\n", comment_text)); } Some(node) } else if add_comments { let mut node = create_node(false); node.set_leading(format!("{}\n...
rust_dataset_chunk_519121
rust_dataset.txt
519,121
512
_node("vertical"); node.set_leading(format!("{}\n// ", comment_text)); Some(node) } else { None } } fn show_startup_tips_to_kdl(&self, add_comments: bool) -> Option<KdlNode> { let comment_text = format!( "{}\n{}\n{}\n{}", " ", "...
rust_dataset_chunk_519122
rust_dataset.txt
519,122
512
); let create_node = |node_value: bool| -> KdlNode { let mut node = KdlNode::new("show_setup_screen"); node.push(KdlValue::Bool(node_value)); node }; if let Some(show_setup_screen) = self.show_setup_screen { let mut node = create_node(show_setup_...
rust_dataset_chunk_519123
rust_dataset.txt
519,123
512
mut node = create_node(false); node.set_leading(format!("{}\n// ", comment_text)); Some(node) } else { None } } fn scroll_mode_sync_to_kdl(&self, add_comments: bool) -> Option<KdlNode> { let comment_text = format!( "{}\n{}\n{}", ...
rust_dataset_chunk_519124
rust_dataset.txt
519,124
512
true", ); let create_node = |node_value: bool| -> KdlNode { let mut node = KdlNode::new("mouse_hover_effects"); node.push(KdlValue::Bool(node_value)); node }; if let Some(mouse_hover_effects) = self.mouse_hover_effects { let mut node = cr...
rust_dataset_chunk_519125
rust_dataset.txt
519,125
512
Some(node) } else if add_comments { let mut node = create_node(false); node.set_leading(format!("{}\n// ", comment_text)); Some(node) } else { None } } fn context_menu_enabled_to_kdl(&self, add_comments: bool) -> Option<KdlNode>...
rust_dataset_chunk_519126
rust_dataset.txt
519,126
512
let comment_text = format!( "{}\n{}\n{}\n{}", " ", "// Whether triple-clicking inside command output marked by the shell (OSC 133) selects", "// the command and its output instead of the logical line", "// default is true", ); let create_node...
rust_dataset_chunk_519127
rust_dataset.txt
519,127
512
"// (Requires restart)", ); let create_node = |node_value: IpAddr| -> KdlNode { let mut node = KdlNode::new("web_server_ip"); node.push(KdlValue::String(node_value.to_string())); node }; if let Some(web_server_ip) = self.web_server_ip { ...
rust_dataset_chunk_519128
rust_dataset.txt
519,128
512
CT_COMMAND", "// can be useful for removing wrappers around commands", "// Note: be sure to escape backslashes and similar characters properly", ); let create_node = |node_value: &str| -> KdlNode { let mut node = KdlNode::new("post_command_discovery_hook"); ...
rust_dataset_chunk_519129
rust_dataset.txt
519,129
512
.set_leading(format!("{}\n// ", comment_text)); Some(node) } else { None } } fn host_notification_protocol_to_kdl(&self, add_comments: bool) -> Option<KdlNode> { use crate::input::options::HostNotificationProtocol; let comment_text = format!( "...
rust_dataset_chunk_519130
rust_dataset.txt
519,130
512
node.push(KdlValue::Bool(node_value)); node }; if let Some(value) = self.dangerously_enable_paste_buffer_read { let mut node = create_node(value); if add_comments { node.set_leading(format!("{}\n", comment_text)); } ...
rust_dataset_chunk_519131
rust_dataset.txt
519,131
512
KdlNode::new(name); node.push(KdlValue::Bool(node_value)); node }; if let Some(value) = value { let mut node = create_node(value); if add_comments { node.set_leading(format!("{}\n", comment_text)); } Some(node) ...
rust_dataset_chunk_519132
rust_dataset.txt
519,132
512
node = create_node(OnQuit::AskQuit); node.set_leading(format!("{}\n// ", comment_text)); Some(node) } else { None } } fn bars_hidden_on_start_to_kdl(&self, add_comments: bool) -> Option<KdlNode> { let comment_text = [ " ", "// ...
rust_dataset_chunk_519133
rust_dataset.txt
519,133
512
to_kdl(&self, add_comments: bool) -> Vec<KdlNode> { let mut nodes = vec![]; if let Some(simplified_ui_node) = self.simplified_ui_to_kdl(add_comments) { nodes.push(simplified_ui_node); } if let Some(osc8_hyperlinks_node) = self.osc8_hyperlinks_to_kdl(add_comments) { ...
rust_dataset_chunk_519134
rust_dataset.txt
519,134
512
.push(mirror_session); } if let Some(on_force_close) = self.on_force_close_to_kdl(add_comments) { nodes.push(on_force_close); } if let Some(scroll_buffer_size) = self.scroll_buffer_size_to_kdl(add_comments) { nodes.push(scroll_buffer_size); } if le...
rust_dataset_chunk_519135
rust_dataset.txt
519,135
512
_protocol_to_kdl(add_comments) { nodes.push(support_kitty_graphics_protocol); } if let Some(grapheme_clusters) = self.grapheme_clusters_to_kdl(add_comments) { nodes.push(grapheme_clusters); } if let Some(mirror_resizes_source_pane) = self.mirro...
rust_dataset_chunk_519136
rust_dataset.txt
519,136
512
dl(add_comments) { nodes.push(show_setup_screen); } if let Some(advanced_mouse_actions) = self.advanced_mouse_actions_to_kdl(add_comments) { nodes.push(advanced_mouse_actions); } if let Some(mouse_scroll_resize) = self.mouse_scroll_resize_to_kdl(add_comments) { ...
rust_dataset_chunk_519137
rust_dataset.txt
519,137
512
) { nodes.push(dangerously_enable_paste_buffer_read); } if let Some(nested_session_handling) = self.nested_session_handling_to_kdl(add_comments) { nodes.push(nested_session_handling); } if let Some(host_notification_protocol) = self.host_notifi...
rust_dataset_chunk_519138
rust_dataset.txt
519,138
512
kdl_layout_parser .parse_external_swap_layouts(raw_swap_layout, layout) .map_err(|e| match e { ConfigError::KdlError(kdl_error) => { ConfigError::KdlError(kdl_error.add_src( String::from(raw_swap...
rust_dataset_chunk_519139
rust_dataset.txt
519,139
512
let env_var_int_value = kdl_first_entry_as_i64!(env_var).map(|s| format!("{}", s.to_string())); let env_var_value = env_var_str_value .or(env_var_int_value) .ok_or(ConfigError::new_kdl_error( format!("Failed to ...
rust_dataset_chunk_519140
rust_dataset.txt
519,140
512
from_str(mode_name).map_err(|_| { ConfigError::new_kdl_error( format!("Invalid mode: '{}'", mode_name), block.name().span().offset(), block.name().span().len(), ) })?); } ...
rust_dataset_chunk_519141
rust_dataset.txt
519,141
512
in kdl_string_arguments!(key_block) { let text = key_text(key).map_err(|e| { ConfigError::new_kdl_error(e, key_block.span().offset(), key_block.span().len()) })?; let key_with_modifier = KeyWithModifier::from_str(&text).map_err(|_| { ConfigError::new_...
rust_dataset_chunk_519142
rust_dataset.txt
519,142
512
_key_text( kdl_keybinds: &KdlNode, config_options: &Options, key_text: &dyn Fn(&str) -> Result<String, String>, ) -> Result<KeybindChanges, ConfigError> { parse_bind_blocks( kdl_keybinds, &|block, input_mode, changes| { KeybindChanges::bind_key...
rust_dataset_chunk_519143
rust_dataset.txt
519,143
512
iter() { let unbound_in_mode = match self.modes.get(&mode) { Some(mode_changes) if !mode_changes.clear_defaults => mode_changes.unbind.clone(), _ => BTreeSet::new(), }; unbound_everywhere = Some(match unbound_everywhere { Some(so_far) =...
rust_dataset_chunk_519144
rust_dataset.txt
519,144
512
.value() .as_string() .ok_or_else(|| error("A mouse trigger must be a string".to_owned()))?; let substituted = key_text(text).map_err(error)?; match MouseTrigger::parse(&substituted, target) { Ok(trigger) => triggers.push(trigger), Err(_) ...
rust_dataset_chunk_519145
rust_dataset.txt
519,145
512
=> arguments.push(number.to_string()), _ => { return Err(ConfigError::new_kdl_error( "Mouse behaviour arguments must be strings or numbers".to_owned(), entry.span().offset(), entry.span().len(), ...
rust_dataset_chunk_519146
rust_dataset.txt
519,146
512
()); for argument in behaviour.arguments() { match argument.parse::<i64>() { Ok(number) => behaviour_node.push(number), Err(_) => behaviour_node.push(argument), } } let configuration = behaviour.plugin_configurat...
rust_dataset_chunk_519147
rust_dataset.txt
519,147
512
| kdl_name!(n) == "bind") { let triggers = mouse_triggers_with_text(key_block, key_text)?; let binding = mouse_binding_from_kdl(key_block, config_options)?; if let Some(behaviour) = binding.as_behaviour() { if let Some(trigger) = triggers .iter() ...
rust_dataset_chunk_519148
rust_dataset.txt
519,148
512
}, &|global_unbind| mouse_triggers_with_text(global_unbind, key_text), ) } pub fn to_kdl_children(&self) -> KdlDocument { let mut document = KdlDocument::new(); let title_maker = Keybinds::default(); let mode_name = |mode: &InputMode| format!("{:?}", mode)...
rust_dataset_chunk_519149
rust_dataset.txt
519,149
512
); document.nodes_mut().push(title); } let mut unbound_everywhere: Option<BTreeSet<MouseTrigger>> = None; for mode in InputMode::iter() { let unbound_in_mode = match self.modes.get(&mode) { Some(mode_changes) if !mode_changes.clear_defaults => mode_changes...
rust_dataset_chunk_519150
rust_dataset.txt
519,150
512
_owned())) .ok_or_else(|| { ConfigError::new_kdl_error( format!("'{}' must be a string", name), entry.span().offset(), entry.span().len(), ) }), ...
rust_dataset_chunk_519151
rust_dataset.txt
519,151
512
not find keybinds node"), document.span().offset(), document.span().len(), )) } } // minimize keybind entries for serialization, so that duplicate entries will appear in // "shared" nodes later rather than once per mode fn minimize_entries( &s...
rust_dataset_chunk_519152
rust_dataset.txt
519,152
512
m| m != input_mode) } for mode in modes { node.push(format!("{:?}", mode).to_lowercase()); } node } } pub(crate) fn serialize_mode_keybinds( &self, keybinds: &BTreeMap<KeyWithModifier, Vec<Action>>, ) -> KdlDocument { ...
rust_dataset_chunk_519153
rust_dataset.txt
519,153
512
Ord in this case encode_single_input_mode!(Normal); encode_single_input_mode!(Locked); encode_single_input_mode!(Pane); encode_single_input_mode!(Tab); encode_single_input_mode!(Resize); encode_single_input_mode!(Move); encode_single_input_mode!(Scroll); ...
rust_dataset_chunk_519154
rust_dataset.txt
519,154
512
"), BareKey::ScrollLock => format!("scrolllock"), BareKey::NumLock => format!("numlock"), BareKey::PrintScreen => format!("printscreen"), BareKey::Pause => format!("pause"), BareKey::Menu => format!("menu"), } } } impl Config { pub fn from_kdl...
rust_dataset_chunk_519155
rust_dataset.txt
519,155
512
if let Some(kdl_themes) = kdl_config.get("themes") { let sourced_from_external_file = false; let config_themes = Themes::from_kdl(kdl_themes, sourced_from_external_file)?; config.themes = config.themes.merge(config_themes); } if let Some(kdl_plugin_aliases) = kdl_con...
rust_dataset_chunk_519156
rust_dataset.txt
519,156
512
config.attention.merge(attention); } Ok(config) } pub fn to_string(&self, add_comments: bool) -> String { let mut document = KdlDocument::new(); if let Some(keybinds) = self.keybinds_layers.user.to_kdl() { document.nodes_mut().push(keybinds); } if l...
rust_dataset_chunk_519157
rust_dataset.txt
519,157
512
let mut context_menu = if clear_all_defaults { ContextMenuConfig::default() } else { base }; if let Some(sections) = kdl_children_nodes!(kdl_context_menu) { for section_node in sections { let section_name = kdl_name!(section_node); ...
rust_dataset_chunk_519158
rust_dataset.txt
519,158
512
.to_owned())) .ok_or_else(|| { ConfigError::new_kdl_error( format!("'{}' must be the label of another context_menu item", name), property.span().offset(), property.span().len(), ...
rust_dataset_chunk_519159
rust_dataset.txt
519,159
512
{ let defaults = &crate::input::config_settings::default_config().context_menu; if self == defaults { return None; } let mut sections = KdlDocument::new(); for section_name in CONTEXT_MENU_SECTIONS { let (Some(entries), Some(default_entries)) = ...
rust_dataset_chunk_519160
rust_dataset.txt
519,160
512
let action_name = kdl_name!(kdl_action); let arguments: Vec<&KdlEntry> = kdl_action .entries() .iter() .filter(|entry| entry.name().is_none()) .collect(); if arguments.is_empty() { if let Some(action) = ClickedPaneAction::from_kdl_name(...
rust_dataset_chunk_519161
rust_dataset.txt
519,161
512
Direction::Right => "right", Direction::Up => "up", Direction::Down => "down", }); }, ClickedTabAction::MoveToPosition(position) => { node.push(tab_position_to_kdl_value(*posi...
rust_dataset_chunk_519162
rust_dataset.txt
519,162
512
)?; let initial_cwd = kdl_get_string_property_or_child_value!(alias_definition, "cwd") .map(|s| PathBuf::from(s)); let run_plugin = RunPlugin::from_url(string_url)? .with_configuration(configuration.inner...
rust_dataset_chunk_519163
rust_dataset.txt
519,163
512
) -> KdlNode { let mut load_plugins = KdlNode::new("load_plugins"); let mut load_plugins_children = KdlDocument::new(); for run_plugin_or_alias in background_plugins.iter() { let mut background_plugin_node = KdlNode::new(run_plugin_or_alias.location_string()); let mut background_plugin_child...
rust_dataset_chunk_519164
rust_dataset.txt
519,164
512
dl_load_plugins: &KdlNode, ) -> Result<Vec<RunPluginOrAlias>, ConfigError> { let mut load_plugins: Vec<RunPluginOrAlias> = Vec::new(); if let Some(kdl_load_plugins) = kdl_children_nodes!(kdl_load_plugins) { for plugin_block in kdl_load_plugins { let url_node = plugin_block.name(); ...
rust_dataset_chunk_519165
rust_dataset.txt
519,165
512
_then(|e| e.value().as_bool()); Ok(BorderStyleOverride { all: line_style_from_kdl(kdl_document, &format!("{}_style", prefix))?, top: line_style_from_kdl(kdl_document, &format!("{}_top", prefix))?, right: line_style_from_kdl(kdl_document, &format!("{}_right", prefix))?, bottom: line_s...
rust_dataset_chunk_519166
rust_dataset.txt
519,166
512
_kdl_over( kdl_ui_config: &KdlNode, base: &UiConfig, ) -> Result<UiConfig, ConfigError> { let mut ui_config = base.clone(); if let Some(pane_frames) = kdl_get_child!(kdl_ui_config, "pane_frames") { let base_frames = base.pane_frames; let rounded_corners = ...
rust_dataset_chunk_519167
rust_dataset.txt
519,167
512
_override_to_kdl_children( &self.pane_frames.floating_border_style, "floating_border", &mut frame_config_children, ) { has_ui_config = true; } if has_ui_config { frame_config.set_children(frame_config_children); ui_config_ch...
rust_dataset_chunk_519168
rust_dataset.txt
519,168
512
.unwrap_or(DEFAULT_STYLES.multiplayer_user_colors.player_4), player_5: PaletteColor::try_from(("player_5", colors)) .unwrap_or(DEFAULT_STYLES.multiplayer_user_colors.player_5), player_6: PaletteColor::try_from(("player_6", colors)) ...
rust_dataset_chunk_519169
rust_dataset.txt
519,169
512
= if looks_like_a_palette { // Older palette based theme definition let palette = Palette { fg: PaletteColor::try_from(("fg", theme_colors))?, bg: PaletteColor::try_from(("bg", theme_colors))?, red: PaletteColor::try_from(("red...
rust_dataset_chunk_519170
rust_dataset.txt
519,170
512
) })?, table_cell_unselected: Themes::style_declaration_from_node( theme_config, "table_cell_unselected", ) .map(|maybe_style| { maybe_style.unwrap_or(DEFAULT_STYLES.ta...
rust_dataset_chunk_519171
rust_dataset.txt
519,171
512
"No theme node found in file".into(), kdl_config.span().offset(), kdl_config.span().len(), ))?; let all_themes_in_file = Themes::from_kdl(kdl_themes, sourced_from_external_file)?; Ok(all_themes_in_file) } pub fn from_path(path_to_theme_file: PathBuf) ...
rust_dataset_chunk_519172
rust_dataset.txt
519,172
512
theme.palette); if let Some(terminal_colors) = theme.terminal_colors { current_theme_node .ensure_children() .nodes_mut() .push(terminal_colors.to_kdl()); } themes.nodes_mut().push(current_theme_node); ...
rust_dataset_chunk_519173
rust_dataset.txt
519,173
512
= kdl_name!(p); PermissionType::from_str(v).ok() }) .collect(); granted_permission.insert(key.into(), permissions); } } Ok(granted_permission) } pub fn to_string(granted: &GrantedPermission) -> String...
rust_dataset_chunk_519174
rust_dataset.txt
519,174
512
tabs")?; let panes: PaneManifest = kdl_document .get("panes") .and_then(|p| p.children()) .map(|p| PaneManifest::decode_from_kdl(p)) .ok_or("Failed to parse panes")?; let available_layouts: Vec<LayoutInfo> = kdl_document .get("available_layout...
rust_dataset_chunk_519175
rust_dataset.txt
519,175
512
_node .children() .and_then(|c| c.get("history")) .map(|h| h.entries()) { for entry in history_entries { if let Some(entry) = entry.value().as_i64() { ...
rust_dataset_chunk_519176
rust_dataset.txt
519,176
512
| e.value().as_i64()) .map(|c| Duration::from_secs(c as u64)) .unwrap_or_default(); let attention_muted = kdl_document .get("attention_muted") .and_then(|n| n.entries().iter().next()) .and_then(|e| e.value().as_bool()) .unwrap_or(false); ...
rust_dataset_chunk_519177
rust_dataset.txt
519,177
512
stringified) => ("stringified-layout".to_owned(), "N/A"), }; let mut layout_node = KdlNode::new(format!("{}", layout_name)); let layout_source = KdlEntry::new_prop("source", layout_source); layout_node.entries_mut().push(layout_source); available_layouts_child...
rust_dataset_chunk_519178
rust_dataset.txt
519,178
512
); client_node.set_children(client_document); pane_history_children.nodes_mut().push(client_node); } pane_history.set_children(pane_history_children); kdl_document.nodes_mut().push(name); kdl_document.nodes_mut().push(tabs); kdl_document.nodes_mut().push(...
rust_dataset_chunk_519179
rust_dataset.txt
519,179
512
macro_rules! optional_int_node { ($name:expr, $type:ident) => {{ kdl_document .get($name) .and_then(|n| n.entries().iter().next()) .and_then(|e| e.value().as_i64()) .map(|e| e as $type) }}; }...
rust_dataset_chunk_519180
rust_dataset.txt
519,180
512
usize).unwrap_or(0); Ok(TabInfo { position, name, active, panes_to_hide, is_fullscreen_active, is_sync_panes_active, are_floating_panes_visible, other_focused_clients, other_focused_client_slots: vec![],...
rust_dataset_chunk_519181
rust_dataset.txt
519,181
512
"); for client_id in &self.other_focused_clients { other_focused_clients.push(*client_id as i64); } kdl_doucment.nodes_mut().push(other_focused_clients); } if let Some(active_swap_layout_name) = self.active_swap_layout_name.as_ref() { let ...
rust_dataset_chunk_519182
rust_dataset.txt
519,182
512
} impl PaneManifest { pub fn decode_from_kdl(kdl_doucment: &KdlDocument) -> Self { let mut panes: HashMap<usize, Vec<PaneInfo>> = HashMap::new(); for node in kdl_doucment.nodes() { if node.name().to_string() == "pane" { if let Some(pane_document) = node.children() { ...
rust_dataset_chunk_519183
rust_dataset.txt
519,183
512
macro_rules! bool_node { ($name:expr) => {{ kdl_document .get($name) .and_then(|n| n.entries().iter().next()) .and_then(|e| e.value().as_bool()) .ok_or(format!("Failed to parse pane {}", $name))? }};...
rust_dataset_chunk_519184
rust_dataset.txt
519,184
512
}) .and_then(|(x, y)| { let x = x.and_then(|x| x.value().as_i64()).map(|x| x as usize); let y = y.and_then(|y| y.value().as_i64()).map(|y| y as usize); match (x, y) { (Some(x), Some(y)) => Some((x, y)), _ => ...
rust_dataset_chunk_519185
rust_dataset.txt
519,185
512
} int_node!("id", self.id); bool_node!("is_plugin", self.is_plugin); bool_node!("is_focused", self.is_focused); bool_node!("is_fullscreen", self.is_fullscreen); bool_node!("is_floating", self.is_floating); bool_node!("is_suppressed", self.is_suppressed); string_...
rust_dataset_chunk_519186
rust_dataset.txt
519,186
512
(name, value.to_string()); } } if let Some(user_config) = kdl_children_nodes!(plugin_block) { for user_configuration_entry in user_config { let config_entry_name = kdl_name!(user_configuration_entry); if KdlLayoutParser::is_a_reserved_plugin_property(&config_entry_name) {...
rust_dataset_chunk_519187
rust_dataset.txt
519,187
512
_content_rows: 4, pane_columns: 22, pane_content_columns: 21, cursor_coordinates_in_pane: Some((0, 0)), terminal_command: Some("foo".to_owned()), plugin_url: None, is_selectable: true, index_in_pane_group: Default::default(), // we don'...
rust_dataset_chunk_519188
rust_dataset.txt
519,188
512
_swap_layout_dirty: true, viewport_rows: 10, viewport_columns: 10, display_area_rows: 10, display_area_columns: 10, selectable_tiled_panes_count: 10, selectable_floating_panes_count: 10, tab_id: 0, ...
rust_dataset_chunk_519189
rust_dataset.txt
519,189
512
} }"#; let document: KdlDocument = fake_config.parse().unwrap(); let deserialized = Keybinds::from_kdl( document.get("keybinds").unwrap(), Default::default(), &Default::default(), ) .unwrap(); let clear_defaults = true; let serialized = Keybinds::to_kdl(&deserial...
rust_dataset_chunk_519190
rust_dataset.txt
519,190
512
::default(), &Default::default(), ) .unwrap(); let clear_defaults = true; let serialized = Keybinds::to_kdl(&deserialized, clear_defaults); let deserialized_from_serialized = Keybinds::from_kdl( serialized .to_string() .parse::<KdlDocument>() .unwr...
rust_dataset_chunk_519191
rust_dataset.txt
519,191
512
.map(|node| node.name().value().to_owned()), Some("ToggleSessionCard".to_owned()) ); } #[test] fn can_bind_the_seen_and_tray_actions_and_write_them_back() { let fake_config = r#" keybinds { normal { bind "Alt 1" { MarkPaneSeen; } bind "Alt 2" { MarkA...
rust_dataset_chunk_519192
rust_dataset.txt
519,192
512
Modifier::new(BareKey::Char('x')).with_alt_modifier(); assert_eq!( deserialized.get_actions_for_key_in_mode(&InputMode::Normal, &alt_x), Some(&vec![Action::DismissInfoPopups]) ); assert_eq!( Action::DismissInfoPopups .to_kdl() .map(|node| node.name().value().t...
rust_dataset_chunk_519193
rust_dataset.txt
519,193
512
WithModifier::new(BareKey::Char('t')).with_ctrl_modifier(); assert_eq!( deserialized.get_actions_for_key_in_mode(&InputMode::Normal, &ctrl_t), Some(&vec![Action::ToggleTheme]) ); let ctrl_d = KeyWithModifier::new(BareKey::Char('d')).with_ctrl_modifier(); assert_eq!( deserialized....
rust_dataset_chunk_519194
rust_dataset.txt
519,194
512
ctrl_f), Some(&vec![Action::ApplyFloatingSwapLayout { name: "staggered".to_owned() }]) ); let serialized = Keybinds::to_kdl(&deserialized, true); let deserialized_from_serialized = Keybinds::from_kdl( serialized .to_string() .parse::<KdlDocument>()...
rust_dataset_chunk_519195
rust_dataset.txt
519,195
512
_string_with_all_actions() { let fake_config = r#" keybinds { normal { bind "Ctrl a" { Quit; } bind "Ctrl b" { Write 102 111 111; } bind "Ctrl c" { WriteChars "hi there!"; } bind "Ctrl d" { SwitchToMode "Locked"; } b...
rust_dataset_chunk_519196
rust_dataset.txt
519,196
512
" { ToggleTab; } bind "Alt n" { TabNameInput 0; } bind "Alt o" { UndoRenameTab; } bind "Alt p" { MoveTab "Right"; } bind "Alt q" { Run "ls" "-l" { hold_on_start true; hold_on_close false; ...
rust_dataset_chunk_519197
rust_dataset.txt
519,197
512
; } bind "Ctrl Alt e" { NextSwapLayout; } bind "Ctrl Alt g" { BreakPane; } bind "Ctrl Alt h" { BreakPaneRight; } bind "Ctrl Alt i" { BreakPaneLeft; } bind "Ctrl Alt i" { BreakPaneLeft; } bind "Ctrl Alt j" { ...
rust_dataset_chunk_519198
rust_dataset.txt
519,198
512
_string_with_shared_modes() { let fake_config = r#" keybinds { normal { bind "Ctrl n" { NewPane; SwitchToMode "Locked"; } } locked { bind "Ctrl n" { NewPane; SwitchToMode "Locked"; } } shared_except "locked" "pane" {...
rust_dataset_chunk_519199
rust_dataset.txt
519,199
512
deserialized_from_serialized = Keybinds::from_kdl( serialized .to_string() .parse::<KdlDocument>() .unwrap() .get("keybinds") .unwrap(), Default::default(), &Default::default(), ) .unwrap(); assert_eq!( deserialized...