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_518400 | rust_dataset.txt | 518,400 | 512 | ).rev() {
for j in (0..m).rev() {
common[i][j] = if old[i] == new[j] {
common[i + 1][j + 1] + 1
} else {
common[i + 1][j].max(common[i][j + 1])
};
}
}
let mut edits = vec![];
let (mut i, mut j, mut index) = (0, 0, 0);
wh... |
rust_dataset_chunk_518401 | rust_dataset.txt | 518,401 | 512 | index > 0 {
if let Some(position) = locate_in_slots(list, index - 1, slots, key_of) {
return position + 1;
}
}
if let Some(position) = locate_in_slots(list, index, slots, key_of) {
return position;
}
if index == 0 {
0
} else {
slots.len()
}
}
... |
rust_dataset_chunk_518402 | rust_dataset.txt | 518,402 | 512 | its(&mut working, std::slice::from_ref(edit));
}
rebased
}
pub fn rebased_list<T: Clone, K: PartialEq>(
base: &[T],
edits: &[ListEdit<T>],
current: &[T],
key_of: impl Fn(&T) -> K,
) -> Vec<T> {
let slots: Vec<Option<T>> = current.iter().cloned().map(Some).collect();
let rebased = rebase... |
rust_dataset_chunk_518403 | rust_dataset.txt | 518,403 | 512 | anges.modes.keys())
.copied()
.collect();
for mode in modes {
let saved_mode = saved.changes.modes.get(&mode).cloned().unwrap_or_default();
let runtime_mode = runtime
.changes
.modes
.get(&mode)
.cloned()
.unwrap_or_default(... |
rust_dataset_chunk_518404 | rust_dataset.txt | 518,404 | 512 |
.iter()
.map(|entry| (name_of(entry).to_owned(), entry.clone()))
.collect()
}
fn plugin_alias_edits(saved: &ConfigBlocks, runtime: &ConfigBlocks) -> Vec<ConfigEdit> {
let defaults = named(
&config_blocks(default_config(), false, None).plugin_aliases,
|alias: &PluginAliasEnt... |
rust_dataset_chunk_518405 | rust_dataset.txt | 518,405 | 512 | Vec<(&'static str, &'static str)> = slots
.iter()
.enumerate()
.filter(|(index, _)| {
saved_theme.colours.get(*index) != runtime_theme.colours.get(*index)
})
.map(|(_, slot)| *slot)
... |
rust_dataset_chunk_518406 | rust_dataset.txt | 518,406 | 512 | _between(saved: &Config, runtime: &Config) -> Vec<ConfigEdit> {
let mut edits = vec![];
for key in differing_settings(saved, runtime) {
if key.is_block() {
edits.extend(block_edits(key, saved, runtime));
continue;
}
if setting_is_default(runtime, key) {
... |
rust_dataset_chunk_518407 | rust_dataset.txt | 518,407 | 512 | (node.leading()))
.unwrap_or_else(|| match owner_indent {
None => String::new(),
Some(owner_indent) => format!("{} ", owner_indent),
})
}
fn whitespace_kept_before_first_node(text: &str, inside_block: bool) -> String {
let (head, tail) = match text.rfind('\n') {
S... |
rust_dataset_chunk_518408 | rust_dataset.txt | 518,408 | 512 | find('\n') {
Some(newline) => leading[..=newline].to_owned(),
None => String::new(),
};
if kept.is_empty() {
return;
}
match document.nodes_mut().get_mut(position) {
Some(next) => {
let next_leading = format!("{}{}", kept, next.leading().unwrap_or(""));
... |
rust_dataset_chunk_518409 | rust_dataset.txt | 518,409 | 512 | path {
let (next, indent) = open_block(current, owner_indent.as_deref(), name, create)?;
current = next;
owner_indent = Some(indent);
}
Some((current, owner_indent))
}
fn replace_entry_keeping_format(node: &mut KdlNode, position: usize, mut entry: KdlEntry) {
let old = &node.entrie... |
rust_dataset_chunk_518410 | rust_dataset.txt | 518,410 | 512 | positions.iter().enumerate().rev() {
if index >= values.len() {
node.entries_mut().remove(*position);
}
}
let mut insert_at = 0;
for (index, value) in values.into_iter().enumerate() {
match positions.get(index) {
Some(&position) => {
replace_e... |
rust_dataset_chunk_518411 | rust_dataset.txt | 518,411 | 512 | fn statement_has_key(node: &KdlNode, key: &KeyWithModifier) -> bool {
string_arguments(node)
.into_iter()
.any(|text| key_matches(text, key))
}
fn remove_key_from_statements(block: &mut KdlDocument, kind: &str, key: &KeyWithModifier) -> bool {
let mut removed_any = false;
let mut position =... |
rust_dataset_chunk_518412 | rust_dataset.txt | 518,412 | 512 | );
keybinds.nodes().len() - 1
},
};
append_to_block_at(keybinds, keybinds_indent, position, statement);
}
fn append_to_block_at(
keybinds: &mut KdlDocument,
keybinds_indent: Option<&str>,
position: usize,
statement: KdlNode,
) {
let block_indent = node_indent(keybinds, p... |
rust_dataset_chunk_518413 | rust_dataset.txt | 518,413 | 512 | <KeybindChanges> {
KeybindChanges::from_kdl(keybinds, &Options::default()).ok()
}
fn remove_own_statements(keybinds: &mut KdlDocument, mode: InputMode, key: &KeyWithModifier) {
for node in keybinds.nodes_mut() {
if node_mode(node) != Some(mode) {
continue;
}
if let Some(chil... |
rust_dataset_chunk_518414 | rust_dataset.txt | 518,414 | 512 | );
}
fn settle_other_modes(
node: &mut KdlNode,
keybinds_indent: Option<&str>,
mode: InputMode,
key: &KeyWithModifier,
targets: &KeyTargets,
) {
for other in InputMode::iter().filter(|other| *other != mode) {
let Some(file) = parsed_keybind_changes(node) else {
return;
... |
rust_dataset_chunk_518415 | rust_dataset.txt | 518,415 | 512 | >(document: &'a mut KdlDocument) -> (&'a mut KdlNode, Option<String>) {
let position = match document
.nodes()
.iter()
.position(|node| node_name(node) == KEYBINDS)
{
Some(position) => position,
None => {
let indent = child_indent(document, None);
... |
rust_dataset_chunk_518416 | rust_dataset.txt | 518,416 | 512 | (|block| node_mode(block) == Some(*mode));
let position = match position {
Some(position) => position,
None => {
let child_indent_text = child_indent(children, indent.as_deref());
let mut block = KdlNode::new(mode_name(*mode));
... |
rust_dataset_chunk_518417 | rust_dataset.txt | 518,417 | 512 | ().unwrap_or("").to_owned();
let (head, body) = split_leading(&leading);
if !head.is_empty() {
match document.nodes_mut().get_mut(position) {
Some(next) => {
let next_leading = format!("{}{}", head, next.leading().unwrap_or(""));
next.set_leading(next_leading)... |
rust_dataset_chunk_518418 | rust_dataset.txt | 518,418 | 512 | }
},
ListEdit::Remove { index } => {
if *index < block.nodes().len() {
remove_node_at(block, *index);
}
},
ListEdit::Move { from, to } => {
if *from < block.nodes().len() {
let (node,... |
rust_dataset_chunk_518419 | rust_dataset.txt | 518,419 | 512 | () - 1
},
};
let indent = node_indent(document, position, None);
let node = &mut document.nodes_mut()[position];
if node.children().is_none() {
node.set_children(KdlDocument::new());
}
node.children_mut()
.as_mut()
.map(|children| (children, indent))
}
fn remove_... |
rust_dataset_chunk_518420 | rust_dataset.txt | 518,420 | 512 | _level_block(document, block_name, true) {
let child_indent_text = child_indent(block, Some(&indent));
push_node(block, node, &child_indent_text, Some(&indent));
}
}
}
fn first_position(document: &KdlDocument, name: &str) -> usize {
document
.nodes()
.iter()
... |
rust_dataset_chunk_518421 | rust_dataset.txt | 518,421 | 512 | let mut wanted: BTreeMap<String, String> = plugin.configuration.iter().cloned().collect();
if let Some(cwd) = &plugin.cwd {
wanted.insert("cwd".to_owned(), cwd.clone());
}
let names: BTreeSet<String> = current.keys().chain(wanted.keys()).cloned().collect();
let indent = child_indent(&children, ... |
rust_dataset_chunk_518422 | rust_dataset.txt | 518,422 | 512 | false;
}
if location_changed {
set_property(
node,
"location",
Some(KdlValue::String(alias.plugin.location.clone())),
);
}
true
}
fn node_plugin_entry(node: &KdlNode, name_is_location: bool) -> PluginEntry {
let location = if name_is_location {
... |
rust_dataset_chunk_518423 | rust_dataset.txt | 518,423 | 512 | (&indent),
&rebased,
|entry| Some(load_plugin_node(entry)),
|node, entry, indent| {
same_plugin_location(node_name(node), &entry.location)
&& edit_plugin_children(node, entry, indent)
},
);
}
fn apply_env_edit(document: &mut KdlDocument, name: &str, value... |
rust_dataset_chunk_518424 | rust_dataset.txt | 518,424 | 512 | } => {
let mut node = menu_item_node(entry).ok()?;
match placement {
Some(MenuPlacement::After(label)) => {
node.push(KdlEntry::new_prop("after", KdlValue::String(label.clone())))
},
Some(MenuPlacement::Before(label)) => node.p... |
rust_dataset_chunk_518425 | rust_dataset.txt | 518,425 | 512 | TreeSet<&str> = base.iter().filter_map(|e| e.label.as_deref()).collect();
let target_labels: BTreeSet<&str> = target.iter().filter_map(|e| e.label.as_deref()).collect();
let mut free: Vec<MenuItemStatement> = base
.iter()
.filter_map(|entry| entry.label.as_deref())
.filter(|label| !targe... |
rust_dataset_chunk_518426 | rust_dataset.txt | 518,426 | 512 | done) {
let mut progressed = false;
for j in 0..m {
if placed[j] {
continue;
}
let is_new = target[j]
.label
.as_deref()
.map(|label| !base_labels.contains(label))
.unwrap_or(true);
... |
rust_dataset_chunk_518427 | rust_dataset.txt | 518,427 | 512 | <'a>(
document: &'a mut KdlDocument,
section: &str,
) -> Option<(&'a mut KdlNode, String, Vec<KdlNode>)> {
let (block, owner_indent) = top_level_block(document, CONTEXT_MENU, true)?;
let position = match block
.nodes()
.iter()
.rposition(|node| node_name(node) == section)
{
... |
rust_dataset_chunk_518428 | rust_dataset.txt | 518,428 | 512 | let statement_edits = list_edits(&existing, &desired);
if let Some(children) = node.children_mut().as_mut() {
apply_node_list_edits(
children,
Some(indent),
&statement_edits,
menu_statement_node,
);
}
Ok(())
}
fn replace_section_items(node: &... |
rust_dataset_chunk_518429 | rust_dataset.txt | 518,429 | 512 | &rebased, |entry| {
menu_item_node(entry).ok()
});
}
fn apply_context_menu_defaults(
document: &mut KdlDocument,
section: &str,
entries: &[MenuItemEntry],
) {
if context_menu_clears_everything(document) {
if let Some((node, indent, _)) = context_menu_section_node(document, section)... |
rust_dataset_chunk_518430 | rust_dataset.txt | 518,430 | 512 | found {
Some(node) if !is_palette_theme(node) && node.children().is_some() => node,
_ => {
set_named_node(document, THEMES, name, Some(theme_node(theme)));
return;
},
};
let theme_indent = indent_of_leading(theme_node_in_file.leading()).unwrap_or_default();
l... |
rust_dataset_chunk_518431 | rust_dataset.txt | 518,431 | 512 | ,
new_colour,
&component_indent,
Some(&style_indent),
);
},
}
},
(None, None) => {},
}
}
}
fn apply_theme_edit(document: &mut KdlDocument, ... |
rust_dataset_chunk_518432 | rust_dataset.txt | 518,432 | 512 | , value.as_deref()),
ConfigEdit::ContextMenuItems {
section,
base,
edits,
} => apply_context_menu_items(document, section, base, edits),
ConfigEdit::ContextMenuDefaults { section, entries } => {
apply_context_menu_defaults(document, section, entrie... |
rust_dataset_chunk_518433 | rust_dataset.txt | 518,433 | 512 | {
Some(node) => {
let text = node.to_string();
text.parse::<KdlDocument>()
.ok()
.and_then(|document| document.get(KEYBINDS).cloned())
.and_then(|node| KeybindsSelection::from_kdl(&node, options).ok())
.unwrap_or_else(|| se... |
rust_dataset_chunk_518434 | rust_dataset.txt | 518,434 | 512 | mode, key)
== effective_key_actions(expected, preset, mode, key)
})
})
}
pub fn written_file_matches(
file_contents: &str,
runtime: &Config,
edits: &[ConfigEdit],
) -> Result<(), String> {
let parsed = parse_saved_file(file_contents, runtime)?;
for edit in edits {
... |
rust_dataset_chunk_518435 | rust_dataset.txt | 518,435 | 512 | Edit::Theme { name, .. } | ConfigEdit::ThemeColours { name, .. } => {
config_file_theme(parsed, name).map(styling_colours)
== config_file_theme(runtime, name).map(styling_colours)
},
ConfigEdit::MousebindsBlock(_) => {
parsed.keybinds_layers.user_mouse == runtime.... |
rust_dataset_chunk_518436 | rust_dataset.txt | 518,436 | 512 | Config, runtime: &Config, edits: &[ConfigEdit]) -> Config {
let mut new_saved = saved.clone();
for key in edited_settings(edits) {
if !key.is_block() || key == SettingKey::Keybinds {
copy_setting(&mut new_saved, runtime, key);
}
}
for edit in edits {
copy_block_edit(&... |
rust_dataset_chunk_518437 | rust_dataset.txt | 518,437 | 512 | _string(&backup_path) {
Ok(backed_up) if backed_up == contents => Ok(()),
_ => Err(backup_path),
}
}
const LEGACY_BACKUP_HEADER: &str = "THE PREVIOUS FILE AT THIS LOCATION WAS COPIED TO: ";
fn legacy_header_line(contents: &str, backup_path: &Path) -> Option<String> {
let backup = backup_path.d... |
rust_dataset_chunk_518438 | rust_dataset.txt | 518,438 | 512 | log::error!("Failed to restore {}: {}", moved_to.display(), e);
}
}
}
fn plugin_from_entry(
entry: &PluginEntry,
sources: &[&Config],
) -> Option<crate::input::layout::RunPluginOrAlias> {
sources
.iter()
.flat_map(|config| config.background_plugins.iter())
.f... |
rust_dataset_chunk_518439 | rust_dataset.txt | 518,439 | 512 | edits } => {
let current_entries = config_blocks(current, false, None).load_plugins;
let entries = rebased_list(base, edits, ¤t_entries, |entry: &PluginEntry| {
entry.location.clone()
});
expected.background_plugins = entries
... |
rust_dataset_chunk_518440 | rust_dataset.txt | 518,440 | 512 | &edits),
Err(e) => {
log::error!(
"The config file changed outside and could not be read: {}",
e
);
target.clone()
},
}
} else {
target.clone()
};
let mut legacy_backup = None;
... |
rust_dataset_chunk_518441 | rust_dataset.txt | 518,441 | 512 | dracula\"\n").unwrap();
set_keybinding_preset_in(&path, "unlock-first").unwrap();
let written = std::fs::read_to_string(&path).unwrap();
assert!(written.contains("// my notes"), "{}", written);
assert!(written.contains("theme \"dracula\""), "{}", written);
assert!(
wr... |
rust_dataset_chunk_518442 | rust_dataset.txt | 518,442 | 512 | _keybinds")]
pub keybinds: Arc<Keybinds>,
pub options: Options,
pub themes: Themes,
pub plugins: PluginAliases,
pub ui: UiConfig,
pub env: EnvironmentVariables,
pub background_plugins: Vec<RunPluginOrAlias>,
pub web_client: WebClientConfig,
#[serde(default)]
pub context_menu: Con... |
rust_dataset_chunk_518443 | rust_dataset.txt | 518,443 | 512 | KdlError {
error_message: self.error_message.clone(),
src: None, // NamedSource doesn't implement Clone, so we skip it
offset: self.offset,
len: self.len,
help_message: self.help_message.clone(),
}
}
}
impl PartialEq for KdlError {
fn ... |
rust_dataset_chunk_518444 | rust_dataset.txt | 518,444 | 512 | Error(KdlError), // TODO: consolidate these
#[error("Config error: {0}")]
Std(#[from] Box<dyn std::error::Error>),
// Io error with path context
#[error("IoError: {0}, File: {1}")]
IoPath(io::Error, PathBuf),
// Internal Deserialization Error
#[error("FromUtf8Error: {0}")]
FromUtf8(#[fro... |
rust_dataset_chunk_518445 | rust_dataset.txt | 518,445 | 512 | ) -> ConfigResult {
if let Some(ref path) = opts.config {
let default_config = Config::from_default_assets()?;
return Config::from_path(path, Some(default_config));
}
if let Some(Command::Setup(ref setup)) = opts.command {
if setup.clean {
ret... |
rust_dataset_chunk_518446 | rust_dataset.txt | 518,446 | 512 | ::KdlError(
kdl_error.add_src("Default built-in-configuration".into(), cfg),
))
},
Err(e) => return Err(e),
};
let distribution = crate::distribution::distribution();
match distribution.config {
Some(distribution_config) => ... |
rust_dataset_chunk_518447 | rust_dataset.txt | 518,447 | 512 | };
Err(ConfigError::KdlError(kdl_error))
},
Err(ConfigError::KdlError(kdl_error)) => {
Err(ConfigError::KdlError(kdl_error.add_src(
path.as_path().as_os_str().to_string_lossy().to_string(),
... |
rust_dataset_chunk_518448 | rust_dataset.txt | 518,448 | 512 | _dir().map(|config_dir| config_dir.join(DEFAULT_CONFIG_FILE_NAME))
}
// returns true if the config was not previously written to disk and we successfully wrote it
pub fn write_config_to_disk_if_it_does_not_exist(
config: String,
config_file_path: &Option<PathBuf>,
) -> bool {
let... |
rust_dataset_chunk_518449 | rust_dataset.txt | 518,449 | 512 | read a path, still watching: {}",
watcher_name,
error
);
}
}
}
#[cfg(not(target_family = "wasm"))]
pub async fn watch_config_file_changes<F, Fut>(
config_file_path: PathBuf,
config_dir: Option<&Path>,
on_config_change: F,
) where
F: Fn(Config) ->... |
rust_dataset_chunk_518450 | rust_dataset.txt | 518,450 | 512 | .or_else(home::find_default_config_dir);
home::get_theme_dir(config_dir)
});
let missing_theme_dir = theme_dir.clone().filter(|dir| !dir.exists());
watched_paths.extend(theme_dir.filter(|dir| dir.exists()));
let ... |
rust_dataset_chunk_518451 | rust_dataset.txt | 518,451 | 512 | .exists() {
let (watched_paths, missing_theme_dir) =
load_config_and_watched_paths(config_file_path.as_path(), config_dir)
.map(|(_, watched_paths, missing_theme_dir)| (watched_paths, missing_theme_dir))
.unwrap_or_default();
let (tx, mut r... |
rust_dataset_chunk_518452 | rust_dataset.txt | 518,452 | 512 | event.kind.is_create() || event.kind.is_modify() {
if reload_config_after_change(
config_file_path.as_path(),
config_dir,
&watched_paths,
&on_config_change,
)
... |
rust_dataset_chunk_518453 | rust_dataset.txt | 518,453 | 512 | event.kind.is_modify()
{
tokio::time::sleep(Duration::from_millis(100)).await;
if !layout_dir.exists() {
break;
}
let (layouts, layout_errors) = Layo... |
rust_dataset_chunk_518454 | rust_dataset.txt | 518,454 | 512 | ;
loop {
if stopped() {
return;
}
let event_result =
match tokio::time::timeout(Duration::from_millis(250), rx.recv()).await {
Err(_) => continue,
Ok(None) => break,
... |
rust_dataset_chunk_518455 | rust_dataset.txt | 518,455 | 512 | _args_with_option_clean() {
// makes sure --clean works... TODO: how can this actually fail now?
use crate::setup::Setup;
let opts = CliArgs {
command: Some(Command::Setup(Setup {
clean: true,
..Setup::default()
})),
..Default::... |
rust_dataset_chunk_518456 | rust_dataset.txt | 518,456 | 512 | ;
let config = Config::from_kdl(config_contents, None).unwrap();
assert_eq!(
config.options.simplified_ui,
Some(true),
"Option set in config"
);
assert_eq!(
config.options.theme,
Some(String::from("my cool theme")),
... |
rust_dataset_chunk_518457 | rust_dataset.txt | 518,457 | 512 | from("my awesome session")),
"Option set in config"
);
assert_eq!(
config.options.attach_to_session,
Some(true),
"Option set in config"
);
}
#[test]
fn can_define_themes_in_configfile() {
let config_contents = r#"
t... |
rust_dataset_chunk_518458 | rust_dataset.txt | 518,458 | 512 | bg 40 42 54
red 255 85 85
green 80 250 123
yellow 241 250 140
blue 98 114 164
magenta 255 121 198
orange 255 184 108
cyan 139 233 253
black ... |
rust_dataset_chunk_518459 | rust_dataset.txt | 518,459 | 512 | Rgb((59, 66, 82)),
red: PaletteColor::Rgb((191, 97, 106)),
green: PaletteColor::Rgb((163, 190, 140)),
yellow: PaletteColor::Rgb((235, 203, 139)),
blue: PaletteColor::Rgb((129, 161, 193)),
magenta: PaletteColor::Rgb((180,... |
rust_dataset_chunk_518460 | rust_dataset.txt | 518,460 | 512 | assert_eq!(config.themes, expected_themes, "Theme defined in config");
}
#[test]
fn can_define_style_for_theme_with_hex() {
let config_contents = r##"
themes {
named_theme {
text_unselected {
base "#DCD7BA"
... |
rust_dataset_chunk_518461 | rust_dataset.txt | 518,461 | 512 | DD"
emphasis_2 "#DCD899"
emphasis_3 "#ACD7CD"
background "#1F1F28"
}
list_selected {
base "#16161D"
emphasis_0 "#181820"
emphasis_1 "#... |
rust_dataset_chunk_518462 | rust_dataset.txt | 518,462 | 512 | PaletteColor::Rgb((22, 22, 29)),
emphasis_1: PaletteColor::Rgb((22, 22, 29)),
emphasis_2: PaletteColor::Rgb((22, 22, 29)),
emphasis_3: PaletteColor::Rgb((22, 22, 29)),
background: PaletteColor::Rgb((156, 171, 202)),
... |
rust_dataset_chunk_518463 | rust_dataset.txt | 518,463 | 512 | _3: PaletteColor::Rgb((172, 215, 205)),
background: PaletteColor::Rgb((31, 31, 40)),
},
table_cell_selected: StyleDeclaration {
base: PaletteColor::Rgb((22, 22, 29)),
emphasis_0: PaletteColor::Rgb((24, 24, 32... |
rust_dataset_chunk_518464 | rust_dataset.txt | 518,464 | 512 | Rgb((195, 64, 67)),
emphasis_1: PaletteColor::Rgb((200, 192, 147)),
emphasis_2: PaletteColor::Rgb((172, 215, 205)),
emphasis_3: PaletteColor::Rgb((220, 216, 25)),
..Default::default()
},
... |
rust_dataset_chunk_518465 | rust_dataset.txt | 518,465 | 512 | _styles_defaults_omitted() {
let config_contents = r##"
themes {
named_theme {
text_unselected {
base "#DCD7BA"
emphasis_0 "#DCD7CD"
emphasis_1 "#DCD8DD"
emphasis_2 "#D... |
rust_dataset_chunk_518466 | rust_dataset.txt | 518,466 | 512 | 10
bright_green 11 11 11
bright_yellow 12 12 12
bright_blue 13 13 13
bright_magenta 14 14 14
bright_cyan 15 15 15
bright_white 16 16 16
}
}... |
rust_dataset_chunk_518467 | rust_dataset.txt | 518,467 | 512 | BA"
emphasis_0 "#DCD7CD"
emphasis_1 "#DCD8DD"
emphasis_2 "#DCD899"
emphasis_3 "#ACD7CD"
background "#1F1F28"
}
}
}
"##;
let confi... |
rust_dataset_chunk_518468 | rust_dataset.txt | 518,468 | 512 | Color::Rgb((12, 12, 12)))
);
}
#[test]
fn can_define_plugin_configuration_in_configfile() {
let config_contents = r#"
plugins {
tab-bar location="zellij:tab-bar"
status-bar location="zellij:status-bar"
strider location="zellij:stri... |
rust_dataset_chunk_518469 | rust_dataset.txt | 518,469 | 512 | _ui_config = UiConfig {
pane_frames: FrameConfig {
rounded_corners: true,
hide_session_name: true,
..Default::default()
},
};
assert_eq!(config.ui, expected_ui_config, "Ui config defined in config");
}
#[test]
fn can_de... |
rust_dataset_chunk_518470 | rust_dataset.txt | 518,470 | 512 | _layout_dir_changes(
watched_dir,
None,
move |layouts, _errors| {
let tx = tx.clone();
async move {
let _ = tx.send(layouts);
}
},
));
tokio::time::sleep(std::time::Duration::from_secs(3)... |
rust_dataset_chunk_518471 | rust_dataset.txt | 518,471 | 512 | from_secs(3)).await;
let idle_callbacks = callback_count.load(Ordering::SeqCst);
std::fs::write(keybinds_dir.join("second.kdl"), "keybinds {\n}\n").unwrap();
let reported = wait_for(&mut rx, |names: &Vec<String>| {
names.iter().any(|name| name == "second")
})
.await;... |
rust_dataset_chunk_518472 | rust_dataset.txt | 518,472 | 512 | {
*scroll_buffer_size == Some(1234)
})
.await;
watcher.abort();
assert!(
reported,
"a config change should be reported while a dangling symlink is in the theme dir"
);
}
}
--- FILE: zellij/zellij-utils/src/input/config_settings.rs ---
us... |
rust_dataset_chunk_518473 | rust_dataset.txt | 518,473 | 512 | WebSharing::On => "on",
WebSharing::Off => "off",
WebSharing::Disabled => "disabled",
}
.to_owned()
}
fn host_notification_protocol_text(value: &HostNotificationProtocol) -> String {
value.as_str().to_owned()
}
fn nested_session_handling_text(value: &NestedSessionHandling) -> Strin... |
rust_dataset_chunk_518474 | rust_dataset.txt | 518,474 | 512 | _source_pane,
live_view_release_key,
web_server,
web_sharing,
stacked_resize,
stacked_pane_list,
stacked_pane_list_orientation,
show_startup_tips,
show_release_notes,
show_setup_screen,
advanced_mouse_actions,
mouse_scroll_resize,
... |
rust_dataset_chunk_518475 | rust_dataset.txt | 518,475 | 512 | ),
),
(SettingKey::CopyCommand, copy_command.clone()),
(
SettingKey::CopyClipboard,
copy_clipboard.as_ref().map(clipboard_text),
),
(SettingKey::CopyOnSelect, display_text(copy_on_select)),
(SettingKey::Osc8Hyperlinks, display_text(osc8_hyperlinks)... |
rust_dataset_chunk_518476 | rust_dataset.txt | 518,476 | 512 | MouseActions,
display_text(advanced_mouse_actions),
),
(
SettingKey::MouseScrollResize,
display_text(mouse_scroll_resize),
),
(SettingKey::ScrollModeSync, display_text(scroll_mode_sync)),
(
SettingKey::MouseHoverEffects,
... |
rust_dataset_chunk_518477 | rust_dataset.txt | 518,477 | 512 | HiddenOnStart,
bars_hidden_on_start.as_ref().map(|hidden_bars| {
let names = hidden_bars.names();
if names.is_empty() {
"none".to_owned()
} else {
names.join(",")
}
}),
),
(
... |
rust_dataset_chunk_518478 | rust_dataset.txt | 518,478 | 512 | Some(rounded_corners.to_string()),
);
values.insert(
SettingKey::FrameHideSessionName,
Some(hide_session_name.to_string()),
);
border_override_values(border_style, BORDER_KEYS, values);
border_override_values(floating_border_style, FLOATING_BORDER_KEYS, values);
}
fn web_client_val... |
rust_dataset_chunk_518479 | rust_dataset.txt | 518,479 | 512 | dlNode) -> Option<String> {
let arguments: Vec<&KdlValue> = node
.entries()
.iter()
.filter(|entry| entry.name().is_none())
.map(|entry| entry.value())
.collect();
match key.value_shape() {
SettingValueShape::List => {
let items: Vec<String> = argument... |
rust_dataset_chunk_518480 | rust_dataset.txt | 518,480 | 512 | block = match node.children_mut().as_mut() {
Some(children) => children,
None => return,
};
}
block.nodes_mut().retain(|node| node.name().value() != name);
if let Some(node) = setting_node_in_document(&source_document, key) {
block.nodes_mut().push(node.clone());
... |
rust_dataset_chunk_518481 | rust_dataset.txt | 518,481 | 512 | .unwrap_or_default(),
),
);
values.insert(
SettingKey::Themes,
Some(
themes
.to_kdl()
.map(|node| node.to_string())
.unwrap_or_default(),
),
);
values.insert(
SettingKey::ContextMenu,
Some(
... |
rust_dataset_chunk_518482 | rust_dataset.txt | 518,482 | 512 | values: &mut BTreeMap<SettingKey, Option<String>>,
) {
values.insert(
SettingKey::AttentionFrameMarkers,
attention.frame_markers.map(|v| v.to_string()),
);
values.insert(
SettingKey::AttentionHostStatus,
attention.host_status.map(|v| v.to_string()),
);
values.inse... |
rust_dataset_chunk_518483 | rust_dataset.txt | 518,483 | 512 | crate::attention::AttentionStatus) -> Option<SettingKey> {
use crate::attention::AttentionStatus;
match status {
AttentionStatus::NeedsYou => Some(SettingKey::AttentionPopupNeedsYou),
AttentionStatus::Failed => Some(SettingKey::AttentionPopupFailed),
AttentionStatus::Done => Some(Settin... |
rust_dataset_chunk_518484 | rust_dataset.txt | 518,484 | 512 | .tray_badge_colors
.set(status, source.tray_badge_colors.get(status));
return true;
}
}
false
}
pub fn copy_setting(target: &mut Config, source: &Config, key: SettingKey) {
let options = &mut target.options;
let from = &source.options;
let frames ... |
rust_dataset_chunk_518485 | rust_dataset.txt | 518,485 | 512 | .simplified_ui = from.simplified_ui,
SettingKey::Theme => options.theme = from.theme.clone(),
SettingKey::ThemeDark => options.theme_dark = from.theme_dark.clone(),
SettingKey::ThemeLight => options.theme_light = from.theme_light.clone(),
SettingKey::ExplicitThemeHue => options.explicit_... |
rust_dataset_chunk_518486 | rust_dataset.txt | 518,486 | 512 | Key::SerializePaneViewport => {
options.serialize_pane_viewport = from.serialize_pane_viewport
},
SettingKey::ScrollbackLinesToSerialize => {
options.scrollback_lines_to_serialize = from.scrollback_lines_to_serialize
},
SettingKey::StyledUnderlines => options.styl... |
rust_dataset_chunk_518487 | rust_dataset.txt | 518,487 | 512 | ell = from.visual_bell,
SettingKey::FocusFollowsMouse => options.focus_follows_mouse = from.focus_follows_mouse,
SettingKey::MouseClickThrough => options.mouse_click_through = from.mouse_click_through,
SettingKey::ContextMenuEnabled => options.context_menu_enabled = from.context_menu_enabled,
... |
rust_dataset_chunk_518488 | rust_dataset.txt | 518,488 | 512 | _hints_when_bars_hidden = from.mode_hints_when_bars_hidden
},
SettingKey::FrameRoundedCorners => frames.rounded_corners = from_frames.rounded_corners,
SettingKey::FrameHideSessionName => {
frames.hide_session_name = from_frames.hide_session_name
},
SettingKey::FrameBo... |
rust_dataset_chunk_518489 | rust_dataset.txt | 518,489 | 512 | web.cursor_blink = from_web.cursor_blink,
SettingKey::WebClientCursorStyle => web.cursor_style = from_web.cursor_style.clone(),
SettingKey::WebClientCursorInactiveStyle => {
web.cursor_inactive_style = from_web.cursor_inactive_style.clone()
},
SettingKey::WebClientMacOptionI... |
rust_dataset_chunk_518490 | rust_dataset.txt | 518,490 | 512 | : SettingKey) -> Option<Vec<KdlValue>> {
setting_value(config, key).and_then(|value| key.kdl_values(&value))
}
pub fn setting_is_default(config: &Config, key: SettingKey) -> bool {
if key == SettingKey::Keybinds {
return config.keybinds_layers.user.is_empty();
}
if key == SettingKey::Mousebinds... |
rust_dataset_chunk_518491 | rust_dataset.txt | 518,491 | 512 | {
saved_values.get(&key) != current_values.get(&key)
};
let saved_marker = Some("saved".to_owned());
let current_marker = if changed {
Some("changed".to_owned())
} else {
saved_marker.clone()
... |
rust_dataset_chunk_518492 | rust_dataset.txt | 518,492 | 512 | .common),
];
sections
.iter()
.flat_map(|(section, entries)| {
entries.iter().filter_map(move |entry| match entry {
ContextMenuEntry::Item { label, .. } => Some(format!("{}: {}", section, label)),
ContextMenuEntry::Separator => None,
})
... |
rust_dataset_chunk_518493 | rust_dataset.txt | 518,493 | 512 | vec![base_mode];
let mut queue: Vec<(InputMode, Vec<KeyWithModifier>)> = vec![(base_mode, vec![])];
for _ in 0..MAX_SHORTCUT_DEPTH {
for (mode, path) in &queue {
for (key, bound) in mode_binds(*mode) {
if binding_matches(&bound, &wanted, base_mode) {
let ... |
rust_dataset_chunk_518494 | rust_dataset.txt | 518,494 | 512 | ),
"bar" => Some(&mut self.bar),
"common" => Some(&mut self.common),
_ => None,
}
}
pub fn merge(&self, other: ContextMenuConfig) -> ContextMenuConfig {
let pick = |own: &Vec<ContextMenuEntry>, theirs: Vec<ContextMenuEntry>| {
if theirs.is_empty() ... |
rust_dataset_chunk_518495 | rust_dataset.txt | 518,495 | 512 | {
merged.remove(position);
}
},
MenuStatement::Entry {
entry,
placement: None,
} => {
let existing = if replace_by_label {
label_of(&entry).and_then(|label| label_position(&merged... |
rust_dataset_chunk_518496 | rust_dataset.txt | 518,496 | 512 | ())
.map(|label| MenuPlacement::Before(label.to_owned()))
};
match after.or_else(before) {
Some(placement) => Some(MenuStatement::Entry {
entry,
placement: Some(placement),
}),
None if index == working.len() && entry.label().is_some() => {
... |
rust_dataset_chunk_518497 | rust_dataset.txt | 518,497 | 512 | )
}
pub fn entries_without_attention(entries: Vec<ContextMenuEntry>) -> Vec<ContextMenuEntry> {
entries
.into_iter()
.filter(|entry| match entry {
ContextMenuEntry::Item { actions, .. } => !actions.iter().any(is_attention_action),
ContextMenuEntry::Separator => true,
... |
rust_dataset_chunk_518498 | rust_dataset.txt | 518,498 | 512 | ContextMenuEntry::Separator => None,
})
.collect();
assert_eq!(
labels,
vec![Some("Rename".to_owned()), None, Some("Close".to_owned())]
);
}
#[test]
fn showing_and_hiding_every_bar_show_the_bar_toggle_key() {
let config = crate::input... |
rust_dataset_chunk_518499 | rust_dataset.txt | 518,499 | 512 | _eq!(
config.entries_for(ContextMenuKind::Pane),
vec![item("a"), ContextMenuEntry::Separator, item("b")]
);
assert!(config.entries_for(ContextMenuKind::Tab).is_empty());
}
#[test]
fn merging_entries_replaces_by_label_and_appends_new_ones() {
let merged = merg... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.