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_518700 | rust_dataset.txt | 518,700 | 512 | _back() {
let ids: BTreeSet<String> = SettingKey::all().iter().map(|key| key.id()).collect();
assert_eq!(ids.len(), SettingKey::all().len());
for key in SettingKey::all() {
assert_eq!(SettingKey::from_id(&key.id()), Some(key));
}
}
#[test]
fn every_setting_has_a_value_when_set_and_reads_back_fr... |
rust_dataset_chunk_518701 | rust_dataset.txt | 518,701 | 512 | _values = setting_values(&target);
for other in SettingKey::all() {
if other != key {
assert_eq!(
target_values[&other], default_values[&other],
"copying {} changed {}",
key, other
);
}
}
... |
rust_dataset_chunk_518702 | rust_dataset.txt | 518,702 | 512 | ")
);
assert_eq!(
setting_value(&config, SettingKey::TerminalColorForeground).as_deref(),
Some("#c8c9ca")
);
assert_eq!(
setting_value(&config, SettingKey::TerminalColorRed).as_deref(),
Some("#ff0000")
);
assert_eq!(
setting_value(&config, SettingKey::Term... |
rust_dataset_chunk_518703 | rust_dataset.txt | 518,703 | 512 | .unwrap()
}
fn today_default_keybinds() -> Keybinds {
keybinds_from_fixture(EXPECTED_DEFAULT_KEYBINDS)
}
fn user_config(text: &str) -> Config {
Config::from_kdl(text, Some(Config::from_default_assets().unwrap())).unwrap()
}
fn kdl_string(text: &str) -> String {
kdl::KdlValue::String(text.to_owned()).... |
rust_dataset_chunk_518704 | rust_dataset.txt | 518,704 | 512 | .keybinds_layers.active.info.name, "default");
assert_eq!(config.keybinds_layers.active.error, None);
}
#[test]
fn the_builtin_unlock_first_preset_with_its_default_values_equals_todays_unlock_first_keybindings()
{
let config = user_config("keybinds preset=\"unlock-first\"");
assert_eq!(
*config.key... |
rust_dataset_chunk_518705 | rust_dataset.txt | 518,705 | 512 | .0.get(&InputMode::Pane).unwrap();
assert_eq!(pane.len(), 1);
assert_eq!(pane.get(&key("r")), Some(&switch_to(InputMode::Resize)));
assert_eq!(
config.keybinds.0.get(&InputMode::Tab),
today_default_keybinds().0.get(&InputMode::Tab)
);
}
#[test]
fn a_layout_keybinds_block_is_applied_on_t... |
rust_dataset_chunk_518706 | rust_dataset.txt | 518,706 | 512 | preset and are not used"
);
assert_eq!(
actions_for(&config, InputMode::Locked, "Alt u"),
Some(switch_to(InputMode::Normal))
);
assert_eq!(
config.keybinds_layers.user.preset.as_deref(),
Some("default")
);
}
#[test]
fn a_bare_name_is_looked_up_in_the_keybinds_folder... |
rust_dataset_chunk_518707 | rust_dataset.txt | 518,707 | 512 | _to(InputMode::Locked))
);
}
#[test]
fn a_value_with_an_extension_or_a_slash_is_a_path_relative_to_the_config_dir() {
let config_dir = tempfile::tempdir().unwrap();
write_preset(
&config_dir.path().join("presets"),
"fixed",
HARD_CODED_PRESET,
);
let absolute = config_dir.pat... |
rust_dataset_chunk_518708 | rust_dataset.txt | 518,708 | 512 | unwrap();
let mut requested = BTreeMap::new();
requested.insert("primary".to_owned(), "Super".to_owned());
let values = preset.leader_values(&requested).unwrap();
assert_eq!(values.get("primary").map(|s| s.as_str()), Some("Super"));
assert_eq!(values.get("secondary").map(|s| s.as_str()), Some("Alt")... |
rust_dataset_chunk_518709 | rust_dataset.txt | 518,709 | 512 | }
}
"#,
)
.unwrap_err();
assert!(error.contains("tertiary"), "{}", error);
}
#[test]
fn a_hard_coded_preset_ignores_leader_values() {
let config_dir = tempfile::tempdir().unwrap();
write_preset(
&config_dir.path().join("keybinds"),
"fixed",
HARD_CODED_PRESET... |
rust_dataset_chunk_518710 | rust_dataset.txt | 518,710 | 512 | the preset's default mode is not written: {}",
text
);
let reloaded = Config::from_kdl(&text, None).unwrap();
assert_eq!(reloaded.keybinds, config.keybinds);
assert_eq!(reloaded.keybinds_layers.user, config.keybinds_layers.user);
assert_eq!(reloaded.options.default_mode, Some(InputMode::Lock... |
rust_dataset_chunk_518711 | rust_dataset.txt | 518,711 | 512 | 1, "{}", text);
}
#[test]
fn listing_presets_shows_folder_and_builtin_presets_and_broken_files() {
let dir = tempfile::tempdir().unwrap();
write_preset(dir.path(), "fixed", HARD_CODED_PRESET);
write_preset(dir.path(), "leaders", PLACEHOLDER_PRESET);
write_preset(dir.path(), "broken", "keybinds {");
... |
rust_dataset_chunk_518712 | rust_dataset.txt | 518,712 | 512 | _prints_the_builtin_presets() {
assert_eq!(
crate::setup::specified_keybinds_text("default").as_deref(),
Some(DEFAULT_KEYBIND_PRESET_ASSET)
);
assert_eq!(
crate::setup::specified_keybinds_text("unlock-first").as_deref(),
Some(UNLOCK_FIRST_KEYBIND_PRESET_ASSET)
);
asse... |
rust_dataset_chunk_518713 | rust_dataset.txt | 518,713 | 512 | ")
.map(|v| v.as_str()),
Some("Ctrl")
);
}
#[test]
fn config_leader_values_are_not_used_for_a_different_command_line_preset() {
let mut config = user_config("keybinds primary=\"Super\" secondary=\"Ctrl\"");
config.apply_command_line_keybinds(&command_line_options(Some("unlock-first"), N... |
rust_dataset_chunk_518714 | rust_dataset.txt | 518,714 | 512 | work"));
assert_eq!(
options.keybinds_preset,
Some(
Path::new("/work")
.join("presets/mine.kdl")
.display()
.to_string()
)
);
let mut options = command_line_options(Some("unlock-first"), None);
command_line_preset_relati... |
rust_dataset_chunk_518715 | rust_dataset.txt | 518,715 | 512 | &[]);
let unlock_first = presets.iter().find(|p| p.name == "unlock-first").unwrap();
assert_eq!(
unlock_first.examples,
vec![
("{unlock} + p".to_owned(), "to enter PANE mode".to_owned()),
("{unlock} + t".to_owned(), "to enter TAB mode".to_owned()),
]
);
l... |
rust_dataset_chunk_518716 | rust_dataset.txt | 518,716 | 512 | _string(false);
assert!(text.contains("default_mode \"locked\""), "{}", text);
assert_eq!(
crate::input::config_settings::setting_value(&config, crate::data::SettingKey::DefaultMode),
Some("locked".to_owned())
);
config.clear_command_line_keybinds();
config.resolve_keybinds();
as... |
rust_dataset_chunk_518717 | rust_dataset.txt | 518,717 | 512 | (config_contents, None).unwrap();
let alt_h_normal_mode_action = config.keybinds.get_actions_for_key_in_mode(
&InputMode::Normal,
&KeyWithModifier::new(BareKey::Left).with_alt_modifier(),
);
let alt_left_normal_mode_action = config.keybinds.get_actions_for_key_in_mode(
&InputMode::No... |
rust_dataset_chunk_518718 | rust_dataset.txt | 518,718 | 512 | ::Resize
}]),
"Second keybinding was applied"
);
}
#[test]
fn uppercase_and_lowercase_keybindings_are_distinct() {
let config_contents = r#"
keybinds {
pane {
bind "z" { TogglePaneFrames; SwitchToMode "Normal"; }
bind "Z" { SwitchToMode "Resiz... |
rust_dataset_chunk_518719 | rust_dataset.txt | 518,719 | 512 | fn can_add_to_default_keybindings() {
// this test just makes sure keybindings defined in a custom config are added to different
// keybindings defined in the default config
let default_config_contents = r#"
keybinds {
pane {
bind "z" { TogglePaneFrames; SwitchToMode "Nor... |
rust_dataset_chunk_518720 | rust_dataset.txt | 518,720 | 512 | _mode_action = config.keybinds.get_actions_for_key_in_mode(
&InputMode::Normal,
&KeyWithModifier::new(BareKey::Char('g')).with_ctrl_modifier(),
);
let z_in_pane_mode = config
.keybinds
.get_actions_for_key_in_mode(&InputMode::Pane, &KeyWithModifier::new(BareKey::Char('z')));
... |
rust_dataset_chunk_518721 | rust_dataset.txt | 518,721 | 512 | new(BareKey::Char('g')).with_ctrl_modifier(),
);
let z_in_pane_mode = config
.keybinds
.get_actions_for_key_in_mode(&InputMode::Pane, &KeyWithModifier::new(BareKey::Char('z')));
let r_in_pane_mode = config
.keybinds
.get_actions_for_key_in_mode(&InputMode::Pane, &KeyWithModif... |
rust_dataset_chunk_518722 | rust_dataset.txt | 518,722 | 512 | config
.keybinds
.get_actions_for_key_in_mode(&InputMode::Pane, &KeyWithModifier::new(BareKey::Char('r')));
let z_in_pane_mode = config
.keybinds
.get_actions_for_key_in_mode(&InputMode::Pane, &KeyWithModifier::new(BareKey::Char('z')));
let t_in_pane_mode = config
.keybi... |
rust_dataset_chunk_518723 | rust_dataset.txt | 518,723 | 512 | _pane_mode_action = config.keybinds.get_actions_for_key_in_mode(
&InputMode::Pane,
&KeyWithModifier::new(BareKey::Char('g')).with_ctrl_modifier(),
);
let r_in_pane_mode = config
.keybinds
.get_actions_for_key_in_mode(&InputMode::Pane, &KeyWithModifier::new(BareKey::Char('r')));
... |
rust_dataset_chunk_518724 | rust_dataset.txt | 518,724 | 512 | Keybind bound in mode"
);
}
}
#[test]
fn can_define_shared_keybinds_with_exclusion() {
let config_contents = r#"
keybinds clear-defaults=true {
shared_except "locked" {
bind "Ctrl g" { SwitchToMode "Locked"; }
}
}
"#;
let config = Config::... |
rust_dataset_chunk_518725 | rust_dataset.txt | 518,725 | 512 | _kdl(config_contents, None).unwrap();
let z_in_pane_mode = config
.keybinds
.get_actions_for_key_in_mode(&InputMode::Pane, &KeyWithModifier::new(BareKey::Char('z')));
assert_eq!(z_in_pane_mode, None, "Key was ultimately unbound");
}
#[test]
fn error_received_on_unknown_input_mode() {
let co... |
rust_dataset_chunk_518726 | rust_dataset.txt | 518,726 | 512 | , None).unwrap();
let expected_layout = Layout {
template: Some((
TiledPaneLayout {
children: vec![TiledPaneLayout::default()],
..Default::default()
},
vec![],
)),
..Default::default()
};
assert_eq!(layout, expected_... |
rust_dataset_chunk_518727 | rust_dataset.txt | 518,727 | 512 | heavy" rounded_corners=true
floating_panes {
pane border_style="dashed"
}
}
"#;
let layout = Layout::from_kdl(kdl_layout, Some("layout_file_name".into()), None, None).unwrap();
let (tiled, floating) = layout.template.clone().unwrap();
assert_eq!(
t... |
rust_dataset_chunk_518728 | rust_dataset.txt | 518,728 | 512 | ..Default::default()
},
TiledPaneLayout {
children: vec![TiledPaneLayout::default(), TiledPaneLayout::default()],
..Default::default()
},
],
..Default::default()
},
... |
rust_dataset_chunk_518729 | rust_dataset.txt | 518,729 | 512 | ![FloatingPaneLayout::default()],
)),
..Default::default()
};
assert_eq!(layout, expected_layout);
}
#[test]
fn layout_with_hidden_floating_panes() {
let kdl_layout = r#"
layout {
tab hide_floating_panes=true {
pane
pane
fl... |
rust_dataset_chunk_518730 | rust_dataset.txt | 518,730 | 512 | ()), None, None).unwrap();
let expected_layout = Layout {
template: Some((
TiledPaneLayout {
children: vec![TiledPaneLayout {
run: Some(Run::Command(RunCommand {
command: PathBuf::from("htop"),
hold_on_close: tru... |
rust_dataset_chunk_518731 | rust_dataset.txt | 518,731 | 512 | ,
children: vec![
TiledPaneLayout::default(),
TiledPaneLayout::default(),
TiledPaneLayout::default(),
],
..Default::default()
},
vec![], // floating panes
... |
rust_dataset_chunk_518732 | rust_dataset.txt | 518,732 | 512 | })),
..Default::default()
}],
..Default::default()
},
vec![],
)),
..Default::default()
};
assert_eq!(layout, expected_layout);
}
#[test]
fn layout_with_command_panes_and_cwd() {
let kdl_layout = r#"
layout ... |
rust_dataset_chunk_518733 | rust_dataset.txt | 518,733 | 512 | Layout::from_kdl(kdl_layout, Some("layout_file_name".into()), None, None).unwrap();
assert_snapshot!(normalize_layout_debug(format!("{:#?}", layout)));
}
#[test]
fn layout_with_command_panes_and_start_suspended() {
let kdl_layout = r#"
layout {
pane command="htop" {
start_s... |
rust_dataset_chunk_518734 | rust_dataset.txt | 518,734 | 512 | location: RunPluginLocation::Zellij(PluginTag::new("status-bar")),
_allow_exec_host_cmd: false,
configuration: PluginUserConfiguration(expected_plugin_configuration),
..Default::default()
}))),
... |
rust_dataset_chunk_518735 | rust_dataset.txt | 518,735 | 512 | let kdl_layout = r#"
layout {
tab name="my cool tab name 1"
tab name="my cool tab name 2"
}
"#;
let layout = Layout::from_kdl(kdl_layout, Some("layout_file_name".into()), None, None).unwrap();
let expected_layout = Layout {
tabs: vec![
(
... |
rust_dataset_chunk_518736 | rust_dataset.txt | 518,736 | 512 | {
tabs: vec![
(
Some("my first tab".into()),
TiledPaneLayout {
children_split_direction: SplitDirection::Horizontal,
children: vec![
TiledPaneLayout::default(),
TiledPaneLayout {
... |
rust_dataset_chunk_518737 | rust_dataset.txt | 518,737 | 512 | name="my first tab" split_direction="Vertical" {
pane
pane
}
tab name="my second tab" {
pane
pane
}
tab
}
"#;
let layout = Layout::from_kdl(kdl_layout, Some("layout_file_name".into()), None, ... |
rust_dataset_chunk_518738 | rust_dataset.txt | 518,738 | 512 | #"
layout {
pane_template name="left-and-right" split_direction="Vertical" {
pane
children
up-and-down
three-horizontal-panes
}
pane_template name="three-horizontal-panes" split_direction="Horizontal" {
... |
rust_dataset_chunk_518739 | rust_dataset.txt | 518,739 | 512 | _layout, Some("layout_file_name".into()), None, None);
assert!(
layout.is_err(),
"error provided for more than one children block"
);
}
#[test]
fn children_not_as_first_child_of_pane_template() {
let kdl_layout = r#"
layout {
pane_template name="horizontal-with-vertical-... |
rust_dataset_chunk_518740 | rust_dataset.txt | 518,740 | 512 | , Some("layout_file_name".into()), None, None).unwrap();
assert_snapshot!(normalize_layout_debug(format!("{:#?}", layout)));
}
#[test]
fn cannot_define_tab_template_name_with_space() {
let kdl_layout = r#"
layout {
tab_template name="with space" {
pane
childr... |
rust_dataset_chunk_518741 | rust_dataset.txt | 518,741 | 512 | layout",
"pane_template",
"tab_template",
"command",
"plugin",
"children",
"tab",
];
for keyword in keywords {
let kdl_layout = format!(
"
layout {{
pane_template name=\"{}\" {{
pane
... |
rust_dataset_chunk_518742 | rust_dataset.txt | 518,742 | 512 | "
layout {{
tab spit_size=1
}}
"
);
let layout_error =
Layout::from_kdl(&kdl_layout, Some("layout_file_name".into()), None, None).unwrap_err();
assert_snapshot!(normalize_layout_debug(format!("{:?}", layout_error)));
}
#[test]
fn error_on_unknown_layout_tab_t... |
rust_dataset_chunk_518743 | rust_dataset.txt | 518,743 | 512 | dl_layout, Some("layout_file_name".into()), None, None).unwrap();
assert_snapshot!(normalize_layout_debug(format!("{:#?}", layout)));
}
#[test]
fn close_on_exit_overrides_close_on_exit_in_template() {
let kdl_layout = r#"
layout {
pane_template name="tail" {
command "tail"
... |
rust_dataset_chunk_518744 | rust_dataset.txt | 518,744 | 512 | dl(kdl_layout, Some("layout_file_name".into()), None, None).unwrap();
assert_snapshot!(normalize_layout_debug(format!("{:#?}", layout)));
}
#[test]
fn error_on_mixed_command_and_child_panes() {
let kdl_layout = r#"
layout {
pane command="tail" {
pane
}
}
... |
rust_dataset_chunk_518745 | rust_dataset.txt | 518,745 | 512 | ("layout_file_name".into()), None, None);
assert!(layout.is_err(), "error provided");
}
#[test]
fn pane_template_command_with_cwd_overriden_by_its_consumers_command_cwd() {
let kdl_layout = r#"
layout {
cwd "/tmp"
pane_template name="tail" {
command "tail"
... |
rust_dataset_chunk_518746 | rust_dataset.txt | 518,746 | 512 | ;
let layout = Layout::from_kdl(kdl_layout, Some("layout_file_name".into()), None, None).unwrap();
assert_snapshot!(normalize_layout_debug(format!("{:#?}", layout)));
}
#[test]
fn pane_template_command_without_cwd_receives_its_consumers_bare_cwd() {
let kdl_layout = r#"
layout {
cwd "/t... |
rust_dataset_chunk_518747 | rust_dataset.txt | 518,747 | 512 | Some("layout_file_name".into()), None, None).unwrap();
assert_snapshot!(normalize_layout_debug(format!("{:#?}", layout)));
}
#[test]
fn pane_template_with_bare_propagated_to_its_consumer_edit() {
let kdl_layout = r#"
layout {
cwd "/tmp"
pane_template name="tail" {
... |
rust_dataset_chunk_518748 | rust_dataset.txt | 518,748 | 512 | let kdl_layout = r#"
layout {
pane
pane command="tail"
// both should have the /tmp cwd
}
"#;
let layout = Layout::from_kdl(
kdl_layout,
Some("layout_file_name".into()),
None,
Some(PathBuf::from("/tmp")),
)
.unwrap();
... |
rust_dataset_chunk_518749 | rust_dataset.txt | 518,749 | 512 | Layout::from_kdl(kdl_layout, Some("layout_file_name".into()), None, None).unwrap();
assert_snapshot!(normalize_layout_debug(format!("{:#?}", layout)));
}
#[test]
fn global_cwd_and_tab_cwd_prepended_to_panes_with_and_without_cwd() {
let kdl_layout = r#"
layout {
cwd "/tmp"
tab c... |
rust_dataset_chunk_518750 | rust_dataset.txt | 518,750 | 512 | we can sue it
// in the swap layouts
tab_template name="ui" {
pane size=1 borderless=true {
plugin location="zellij:tab-bar"
}
children
pane size=2 borderless=true {
plugin location="zellij:status-... |
rust_dataset_chunk_518751 | rust_dataset.txt | 518,751 | 512 | "#;
let layout = Layout::from_kdl(kdl_layout, Some("layout_file_name".into()), None, None).unwrap();
assert_snapshot!(normalize_layout_debug(format!("{:#?}", layout)));
}
#[test]
fn cannot_define_a_stack_orientation_for_a_non_stacked_pane() {
let kdl_layout = r#"
layout {
pane stack_... |
rust_dataset_chunk_518752 | rust_dataset.txt | 518,752 | 512 | _outside_of_a_stack() {
let kdl_layout = r#"
layout {
pane {
pane
pane expanded=true
}
}
"#;
let layout = Layout::from_kdl(kdl_layout, Some("layout_file_name".into()), None, None);
assert!(layout.is_err(), "error provided for tab na... |
rust_dataset_chunk_518753 | rust_dataset.txt | 518,753 | 512 | location="filepicker"
}
pane {
plugin location="https://example.com/plugin.wasm"
}
}
"#;
let layout = Layout::from_kdl(kdl_layout, Some("layout_file_name".into()), None, None).unwrap();
let expected_layout = Layout {
template: Some((
... |
rust_dataset_chunk_518754 | rust_dataset.txt | 518,754 | 512 | _exec_host_cmd: false,
location: RunPluginLocation::File(PathBuf::from(
"c:/absolute/windows/plugin.wasm",
)),
configuration: Default::default(),
..Default::default()
... |
rust_dataset_chunk_518755 | rust_dataset.txt | 518,755 | 512 | /aram"),
];
let mut old_vars = Vec::new();
// set environment variables for test, keeping track of existing values.
for (key, value) in env_vars {
old_vars.push((key, std::env::var(key).ok()));
std::env::set_var(key, value);
}
let layout = Layout::from_kdl(raw_layout, Some("layou... |
rust_dataset_chunk_518756 | rust_dataset.txt | 518,756 | 512 | assert_eq!(layout.tabs[0].1.hide_floating_panes, true);
}
#[test]
fn layout_node_with_cwd() {
let kdl_layout = r#"
layout cwd="/tmp" {
pane
}
"#;
let layout = Layout::from_kdl(kdl_layout, Some("layout_file_name".into()), None, None).unwrap();
// Verify cwd was applied - c... |
rust_dataset_chunk_518757 | rust_dataset.txt | 518,757 | 512 | let error_message = format!("{:?}", layout.unwrap_err());
assert!(error_message.contains(
"split_direction' property on the layout node is treated as a tab property and cannot be used when there are explicit tab nodes"
));
}
#[test]
fn layout_node_with_hide_floating_panes_and_explicit_tabs_errors() {
... |
rust_dataset_chunk_518758 | rust_dataset.txt | 518,758 | 512 | OrFixed;
let coords = FloatingPaneCoordinates::new(
Some("10%".to_string()),
Some("10%".to_string()),
Some("0%".to_string()),
Some("50%".to_string()),
None,
Some(false),
);
// Should have coords but width will be None due to rejection
assert!(coords.is_s... |
rust_dataset_chunk_518759 | rust_dataset.txt | 518,759 | 512 | None,
Some(false),
);
assert!(coords.is_some());
let coords = coords.unwrap();
assert_eq!(coords.x, Some(PercentOrFixed::Percent(1)));
assert_eq!(coords.y, Some(PercentOrFixed::Percent(1)));
assert_eq!(coords.width, Some(PercentOrFixed::Percent(50)));
assert_eq!(coords.heigh... |
rust_dataset_chunk_518760 | rust_dataset.txt | 518,760 | 512 | _with_only_caller_cwd() {
let requested = RunPluginOrAlias::Alias(PluginAlias::new("session-manager", &None, None));
let running = running_plugin_alias("session-manager", &[("caller_cwd", "/some/folder")]);
assert!(requested.is_equivalent_to_run(&running));
}
#[test]
fn plugin_alias_with_its_own_caller_cwd... |
rust_dataset_chunk_518761 | rust_dataset.txt | 518,761 | 512 | config: &Config,
mode: InputMode,
button: MouseButton,
held: &[KeyModifier],
click_count: u8,
on_frame: bool,
) -> Option<MouseBinding> {
config
.mousebinds
.resolve(mode, button, &modifiers(held), click_count, on_frame)
.map(|(_, binding)| binding.clone())
}
fn beha... |
rust_dataset_chunk_518762 | rust_dataset.txt | 518,762 | 512 | unwrap_err()
.contains("Double"));
assert!(MouseTrigger::parse("Ctrl Button4", MouseTarget::Any)
.unwrap_err()
.contains("Unknown mouse button"));
assert!(
parse_error("mousebinds {\n normal {\n bind \"Left\" on=\"edge\" { Click; }\n }\n}")
.contains("'on' must be")
... |
rust_dataset_chunk_518763 | rust_dataset.txt | 518,763 | 512 | (MouseBehaviour::ContextMenu)
);
assert_eq!(b(MouseButton::Middle, &[], 1, false), None);
assert_eq!(
b(MouseButton::ScrollUp, &[], 1, false),
Some(MouseBehaviour::Scroll(3))
);
assert_eq!(
b(MouseButton::ScrollUp, &[KeyModifier::Ctrl], 1, fals... |
rust_dataset_chunk_518764 | rust_dataset.txt | 518,764 | 512 | bind \"Left\" { Click; }\n }\n}\n",
);
assert_eq!(
behaviour(&config, InputMode::Normal, MouseButton::Left, &[], 1, false),
Some(MouseBehaviour::Click)
);
assert_eq!(
behaviour(
&config,
InputMode::Normal,
MouseButton::ScrollUp,
... |
rust_dataset_chunk_518765 | rust_dataset.txt | 518,765 | 512 | s preset=\"fixed\"", Some(base)).unwrap();
assert_eq!(config.keybinds_layers.active.error, None);
assert_eq!(config.mousebinds, defaults().mousebinds);
}
#[test]
fn a_preset_with_its_own_mouse_bindings_replaces_the_defaults() {
let dir = tempfile::tempdir().unwrap();
let keybinds_dir = dir.path().join(... |
rust_dataset_chunk_518766 | rust_dataset.txt | 518,766 | 512 | ; }\n }\n}\n",
);
let b = |count, on_frame| {
behaviour(
&config,
InputMode::Normal,
MouseButton::Middle,
&[],
count,
on_frame,
)
};
assert_eq!(b(3, true), Some(MouseBehaviour::ToggleFullscreen));
assert_eq!(b... |
rust_dataset_chunk_518767 | rust_dataset.txt | 518,767 | 512 | changes(text);
let written = parsed.to_kdl().unwrap().to_string();
assert_eq!(changes(&written), parsed);
}
#[test]
fn a_mouse_binding_change_is_written_as_a_mousebinds_block() {
let trigger = MouseTrigger::parse("Alt Middle", MouseTarget::Frame).unwrap();
let text = mousebind_change_kdl(
Inpu... |
rust_dataset_chunk_518768 | rust_dataset.txt | 518,768 | 512 | let saved = defaults();
let current = user_config(
"mousebinds {\n normal {\n bind \"Alt Middle\" { NewTab; }\n unbind \"Right\"\n }\n}\n",
);
let entries = mousebinding_entries(&saved, ¤t);
let normal: Vec<_> = entries
.iter()
.filter(|entry| entry.... |
rust_dataset_chunk_518769 | rust_dataset.txt | 518,769 | 512 | _as_preset_keeps_the_users_mouse_bindings() {
let dir = tempfile::tempdir().unwrap();
let config = user_config(
"mousebinds {\n normal {\n bind \"Alt Middle\" { NewTab; }\n }\n}\n",
);
let path = save_keybinds_as_preset(
None,
&config.keybinds_layers.user,
&c... |
rust_dataset_chunk_518770 | rust_dataset.txt | 518,770 | 512 | _user_and_layout_additions() {
let user = user_config(
"mousebinds {\n normal {\n bind \"Alt Middle\" { NewTab; }\n }\n}\n",
);
let config = Config::from_layout_kdl(
"mousebinds {\n normal {\n bind \"Middle\" { Ignore; }\n }\n}\n",
Some(user),
)
.unw... |
rust_dataset_chunk_518771 | rust_dataset.txt | 518,771 | 512 | &config,
InputMode::Normal,
MouseButton::Left,
&[KeyModifier::Ctrl, KeyModifier::Alt],
1,
false,
)
.unwrap();
let MouseBehaviour::DrawFloatingPane(Some(plugin)) = &drawn else {
panic!("expected a plugin, got {:?}", drawn);
};
assert_eq!(plugin.locatio... |
rust_dataset_chunk_518772 | rust_dataset.txt | 518,772 | 512 | needs a plugin"));
}
--- FILE: zellij/zellij-utils/src/input/unit/theme_test.rs ---
use super::super::theme::*;
use crate::consts::{DEFAULT_LIGHT_THEME_NAME, DEFAULT_THEME_NAME, ZELLIJ_DEFAULT_THEMES};
use crate::data::{PaletteColor, DEFAULT_STYLES};
use insta::assert_snapshot;
use std::path::{Path, PathBuf};
const ... |
rust_dataset_chunk_518773 | rust_dataset.txt | 518,773 | 512 | ))),
"{} declares {:?} in terminal color {}, which must be an rgb or hex value",
name,
table.get(slot),
TERMINAL_COLOR_NAMES[slot]
);
}
}
}
#[test]
fn the_bundled_themes_carrying_no_terminal_colors_are_the_ones_with_no_canonical_ta... |
rust_dataset_chunk_518774 | rust_dataset.txt | 518,774 | 512 | "{}: {} has a contrast ratio of {:.2}, below the required {:.1}",
theme,
what,
ratio,
least
);
}
#[test]
fn the_bundled_default_themes_are_readable() {
let themes = bundled_themes();
for name in [DEFAULT_THEME_NAME, DEFAULT_LIGHT_THEME_NAME] {
let theme = the... |
rust_dataset_chunk_518775 | rust_dataset.txt | 518,775 | 512 | ", part),
color,
hover.background,
4.5,
);
}
let ribbon = styling.ribbon_selected;
for (part, color) in [
("base", ribbon.base),
("emphasis_0", ribbon.emphasis_0),
("emphasis_2", ribbon.emphasis_2),
... |
rust_dataset_chunk_518776 | rust_dataset.txt | 518,776 | 512 | }
let terminal_colors = theme
.terminal_colors
.expect("the default themes declare terminal colors");
for slot in [1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14] {
let color = terminal_colors
.get(slot)
.expect("the default themes declare e... |
rust_dataset_chunk_518777 | rust_dataset.txt | 518,777 | 512 | theme.is_err());
}
fn theme_with_fg(fg: &str) -> Result<Themes, crate::input::config::ConfigError> {
let text = format!(
"themes {{ t {{ fg {}; bg 2; red 3; green 4; blue 5; yellow 6; magenta 7; orange 8; cyan 9; black 10; white 11; }}; }}",
fg
);
Themes::from_string(&text, false)
}
#[test... |
rust_dataset_chunk_518778 | rust_dataset.txt | 518,778 | 512 | 0.0193 * r + 0.1192 * g + 0.9505 * b) / 1.08883;
let f = |t: f64| {
if t > 0.008856 {
t.cbrt()
} else {
7.787 * t + 16.0 / 116.0
}
};
(
116.0 * f(y) - 16.0,
500.0 * (f(x) - f(y)),
200.0 * (f(y) - f(z)),
)
}
fn color_difference(a: P... |
rust_dataset_chunk_518779 | rust_dataset.txt | 518,779 | 512 | use kdl::{KdlDocument, KdlNode, KdlValue};
use serde::{Deserialize, Serialize};
use crate::{
data::PaletteColor, kdl_children_or_error, kdl_first_entry_as_string, kdl_get_child,
kdl_get_child_entry_bool_value, kdl_get_child_entry_string_value,
};
use super::config::ConfigError;
#[derive(Debug, Default, Clone... |
rust_dataset_chunk_518780 | rust_dataset.txt | 518,780 | 512 | theme.bright_red = extract_color("bright_red")?;
theme.bright_white = extract_color("bright_white")?;
theme.bright_yellow = extract_color("bright_yellow")?;
theme.cursor = extract_color("cursor")?;
theme.cursor_accent = extract_color("cursor_accent")?;
theme.cyan = extract_color... |
rust_dataset_chunk_518781 | rust_dataset.txt | 518,781 | 512 | "bar"),
CursorInactiveStyle::Underline => write!(f, "underline"),
CursorInactiveStyle::Outline => write!(f, "outline"),
CursorInactiveStyle::NoStyle => write!(f, "none"),
}
}
}
impl CursorInactiveStyle {
pub fn from_kdl(kdl: &KdlNode) -> Result<Self, ConfigError> {
... |
rust_dataset_chunk_518782 | rust_dataset.txt | 518,782 | 512 | }
}
}
impl CursorStyle {
pub fn from_kdl(kdl: &KdlNode) -> Result<Self, ConfigError> {
match kdl_first_entry_as_string!(kdl) {
Some("block") => Ok(CursorStyle::Block),
Some("bar") => Ok(CursorStyle::Bar),
Some("underline") => Ok(CursorStyle::Underline),
... |
rust_dataset_chunk_518783 | rust_dataset.txt | 518,783 | 512 | if let Some(font) = kdl_get_child_entry_string_value!(kdl, "font") {
web_client_config.font = font.to_owned();
}
if let Some(theme_node) = kdl_get_child!(kdl, "theme") {
web_client_config.theme = Some(WebClientTheme::from_kdl(theme_node)?);
}
if let Some... |
rust_dataset_chunk_518784 | rust_dataset.txt | 518,784 | 512 | String(self.font.clone()));
web_client_children.nodes_mut().push(font_node);
if let Some(theme_node) = self.theme.as_ref().map(|t| t.to_kdl()) {
web_client_children.nodes_mut().push(theme_node);
}
if self.cursor_blink {
// this defaults to false, so we only need... |
rust_dataset_chunk_518785 | rust_dataset.txt | 518,785 | 512 | _url = other.base_url;
merged.font_size = other.font_size;
merged
}
}
--- FILE: zellij/zellij-utils/src/ipc/attention_conversion.rs ---
use crate::{
attention::{
AttentionCounts, AttentionDetail, AttentionItem, AttentionSource, AttentionStatus,
BlockedKind, CommandText, Command... |
rust_dataset_chunk_518786 | rust_dataset.txt | 518,786 | 512 | {
Ok(
match ProtoAttentionStatus::try_from(value)
.map_err(|_| anyhow!("Unknown AttentionStatus: {}", value))?
{
ProtoAttentionStatus::Idle => AttentionStatus::Idle,
ProtoAttentionStatus::Working => AttentionStatus::Working,
ProtoAttentionStatus::NewO... |
rust_dataset_chunk_518787 | rust_dataset.txt | 518,787 | 512 | proto as i32
}
fn blocked_kind_from_proto(value: i32) -> Result<BlockedKind> {
Ok(
match ProtoBlockedKind::try_from(value)
.map_err(|_| anyhow!("Unknown BlockedKind: {}", value))?
{
ProtoBlockedKind::Permission => BlockedKind::Permission,
ProtoBlockedKind::Quest... |
rust_dataset_chunk_518788 | rust_dataset.txt | 518,788 | 512 | (value: i32) -> Result<StartupCard> {
Ok(
match ProtoStartupCard::try_from(value)
.map_err(|_| anyhow!("Unknown StartupCard: {}", value))?
{
ProtoStartupCard::Attention => StartupCard::Attention,
ProtoStartupCard::Always => StartupCard::Always,
ProtoSt... |
rust_dataset_chunk_518789 | rust_dataset.txt | 518,789 | 512 | seen: attention.seen,
muted: attention.muted.map(mute_scope_to_proto),
ignore_output: attention.ignore_output,
watched: attention.watched,
from_watch: attention.from_watch,
remembered: attention.remembered.map(|r| ProtoRememberedStatus {
... |
rust_dataset_chunk_518790 | rust_dataset.txt | 518,790 | 512 | iet as usize,
new_output: counts.new_output as usize,
muted: counts.muted as usize,
}
}
}
impl From<AttentionItem> for ProtoAttentionItem {
fn from(item: AttentionItem) -> Self {
ProtoAttentionItem {
pane_id: Some(item.pane_id.into()),
tab_id: ite... |
rust_dataset_chunk_518791 | rust_dataset.txt | 518,791 | 512 | }
}
impl From<ProtoSessionHistory> for SessionHistory {
fn from(history: ProtoSessionHistory) -> Self {
SessionHistory {
back: history.back,
forward: history.forward,
last: history.last,
}
}
}
impl From<SessionArrival> for ProtoSessionArrival {
fn fr... |
rust_dataset_chunk_518792 | rust_dataset.txt | 518,792 | 512 | -> Result<Self> {
Ok(SwitchContext {
history: context.history.map(|h| h.into()).unwrap_or_default(),
arrival: context.arrival.map(|a| a.try_into()).transpose()?,
from_session: context.from_session,
startup_card: context
.startup_card
... |
rust_dataset_chunk_518793 | rust_dataset.txt | 518,793 | 512 | tab.active,
panes: tab.panes.into_iter().map(|p| p.into()).collect(),
}
}
}
impl From<SessionPreview> for ProtoSessionPreview {
fn from(preview: SessionPreview) -> Self {
ProtoSessionPreview {
session_name: preview.session_name,
tab_index: preview.tab_index.... |
rust_dataset_chunk_518794 | rust_dataset.txt | 518,794 | 512 | => ProtoBareKey::Left,
BareKey::Down => ProtoBareKey::Down,
BareKey::Up => ProtoBareKey::Up,
BareKey::Right => ProtoBareKey::Right,
BareKey::Home => ProtoBareKey::Home,
BareKey::End => ProtoBareKey::End,
BareKey::Backspace => ProtoBareKey::Backspa... |
rust_dataset_chunk_518795 | rust_dataset.txt | 518,795 | 512 | _from(key: ProtoBareKey) -> Result<Self> {
match key {
ProtoBareKey::PageDown => Ok(BareKey::PageDown),
ProtoBareKey::PageUp => Ok(BareKey::PageUp),
ProtoBareKey::Left => Ok(BareKey::Left),
ProtoBareKey::Down => Ok(BareKey::Down),
ProtoBareKey::Up => O... |
rust_dataset_chunk_518796 | rust_dataset.txt | 518,796 | 512 | areKey::NumLock),
ProtoBareKey::PrintScreen => Ok(BareKey::PrintScreen),
ProtoBareKey::Pause => Ok(BareKey::Pause),
ProtoBareKey::Menu => Ok(BareKey::Menu),
ProtoBareKey::Unspecified => Err(anyhow!("Unspecified bare key")),
}
}
}
// KeyModifier conversions
im... |
rust_dataset_chunk_518797 | rust_dataset.txt | 518,797 | 512 | _server_contract::{
client_to_server_msg, server_to_client_msg, ActionMsg, AdoptSessionHistoryMsg,
AttachClientMsg, AttachWatcherClientMsg, BackgroundColorMsg, CliPipeOutputMsg,
ClientExitedMsg, ClientPaneMirrorMsg, ClientToServerMsg as ProtoClientToServerMsg,
ClipboardPasteSupportMsg, C... |
rust_dataset_chunk_518798 | rust_dataset.txt | 518,798 | 512 | MobilePanePayload,
MobileRenderPrefsPayload, MobileSessionPayload, MobileSizePayload, MobileStatePayload,
MobileTabPayload, PaneReference, PixelDimensions, ServerToClientMsg,
},
session_events::{CliEventFilter, CliEventType},
};
use std::collections::BTreeMap;
use std::path::PathBuf;
// Conver... |
rust_dataset_chunk_518799 | rust_dataset.txt | 518,799 | 512 | ,
}),
ClientToServerMsg::AttachWatcherClient {
terminal_size,
is_web_client,
} => client_to_server_msg::Message::AttachWatcherClient(AttachWatcherClientMsg {
terminal_size: Some(terminal_size.into()),
is_web_client,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.