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_518300 | rust_dataset.txt | 518,300 | 512 | eg. 1), a terminal pane id (eg. terminal_1) or a plugin pane id (eg. plugin_1)"
))?;
Ok(vec![Action::ResizeByPaneId {
pane_id,
resize,
direction,
}])
},
... |
rust_dataset_chunk_518301 | rust_dataset.txt | 518,301 | 512 | BackwardsByPaneId { pane_id }])
},
None => Ok(vec![Action::MovePaneBackwards]),
},
CliAction::MoveTab { direction, tab_id } => match tab_id {
Some(id) => Ok(vec![Action::MoveTabByTabId {
id: id as u64,
direct... |
rust_dataset_chunk_518302 | rust_dataset.txt | 518,302 | 512 | _id_str) => {
let pane_id = PaneId::from_str(&pane_id_str)
.map_err(|_| format!(
"Malformed pane id: {pane_id_str}, expecting either a bare integer (eg. 1), a terminal pane id (eg. terminal_1) or a plugin pane id (eg. plugin_1)"
... |
rust_dataset_chunk_518303 | rust_dataset.txt | 518,303 | 512 | {
Some(pane_id_str) => {
let pane_id = PaneId::from_str(&pane_id_str)
.map_err(|_| format!(
"Malformed pane id: {pane_id_str}, expecting either a bare integer (eg. 1), a terminal pane id (eg. terminal_1) or a plugin pane id (eg. pl... |
rust_dataset_chunk_518304 | rust_dataset.txt | 518,304 | 512 | { pane_id } => match pane_id {
Some(pane_id_str) => {
let pane_id = PaneId::from_str(&pane_id_str)
.map_err(|_| format!(
"Malformed pane id: {pane_id_str}, expecting either a bare integer (eg. 1), a terminal pane id (eg. terminal_1... |
rust_dataset_chunk_518305 | rust_dataset.txt | 518,305 | 512 | PaneId { pane_id }])
},
None => Ok(vec![Action::ToggleStackListOrientation]),
},
CliAction::SetPaneFrameStyle { style } => Ok(vec![Action::SetPaneFrameStyle(style)]),
CliAction::ToggleBars { bars } => Ok(vec![Action::ToggleBars { bars }]),
... |
rust_dataset_chunk_518306 | rust_dataset.txt | 518,306 | 512 | .or_else(|| Some(current_dir.clone()));
let unblock_condition = unblock_condition.or_else(|| {
if block_until_exit_success {
Some(UnblockCondition::OnExitSuccess)
} else if block_until_exit_failure {
Some(UnblockCon... |
rust_dataset_chunk_518307 | rust_dataset.txt | 518,307 | 512 | cwd.clone(),
})
},
Err(_) => {
let mut plugin_alias = PluginAlias::new(
&plugin,
&configuration.map(|c| c.inner().clone()),
... |
rust_dataset_chunk_518308 | rust_dataset.txt | 518,308 | 512 | , y, width, height, pinned, borderless,
),
border_style,
),
near_current_pane,
no_focus,
tab_id,
}])
... |
rust_dataset_chunk_518309 | rust_dataset.txt | 518,309 | 512 | _style,
tab_id,
} => {
let border_style =
BorderStyleOverride::from_optional_cli_string(border_style.as_deref())?;
let mut file = file;
let current_dir = get_current_dir();
let cwd = cwd
.... |
rust_dataset_chunk_518310 | rust_dataset.txt | 518,310 | 512 | FloatingPanesVisible { tab_id }])
},
CliAction::ClosePane { pane_id } => match pane_id {
Some(pane_id_str) => {
let pane_id = PaneId::from_str(&pane_id_str)
.map_err(|_| format!(
"Malformed pane id: {pane_id_... |
rust_dataset_chunk_518311 | rust_dataset.txt | 518,311 | 512 | }]),
CliAction::GoToTabName { name, create } => {
Ok(vec![Action::GoToTabName { name, create }])
},
CliAction::RenameTab { name, tab_id } => match tab_id {
Some(id) => Ok(vec![Action::RenameTabById {
id: id as u64,
... |
rust_dataset_chunk_518312 | rust_dataset.txt | 518,312 | 512 | ();
let swap_layouts: Option<(String, String)> = None;
let should_start_layout_commands_suspended = false;
let raw_layout_for_error = raw_layout.clone();
let mut layout = Layout::from_str(&raw_layout, path_to_raw_layout, swap_layouts.as_ref... |
rust_dataset_chunk_518313 | rust_dataset.txt | 518,313 | 512 | mut has_focused_tab = tabs
.iter()
.any(|(_, layout, _)| layout.focus.unwrap_or(false));
for (tab_name, layout, floating_panes_layout) in tabs.drain(..) {
let name = tab_name.or_else(|| name.clone());
... |
rust_dataset_chunk_518314 | rust_dataset.txt | 518,314 | 512 | ();
(
layout_url.to_owned(),
Layout::stringified_from_url(layout_url)
.map_err(|e| format!("Failed to load layout: {}", e))?,
None,
)
} ... |
rust_dataset_chunk_518315 | rust_dataset.txt | 518,315 | 512 | layout.recursively_add_start_suspended_including_template(Some(true));
}
let mut tabs = layout.tabs();
if !tabs.is_empty() {
let swap_tiled_layouts = Some(layout.swap_tiled_layouts.clone());
... |
rust_dataset_chunk_518316 | rust_dataset.txt | 518,316 | 512 | : name,
should_change_focus_to_new_tab,
cwd,
initial_panes,
first_pane_unblock_condition,
}])
}
},
CliAction::PreviousSwapLayout { tab_id } => match tab_id {
... |
rust_dataset_chunk_518317 | rust_dataset.txt | 518,317 | 512 | }) {
layout_source_name = layout_url.to_owned();
(
layout_url.to_owned(),
Layout::stringified_from_url(layout_url)
.map_err(|e| format!("Failed to load layout from ... |
rust_dataset_chunk_518318 | rust_dataset.txt | 518,318 | 512 | None,
tiled_layout: tiled,
floating_layouts: floating,
swap_tiled_layouts: Some(layout.swap_tiled_layouts),
swap_floating_layouts: Some(layout.swap_floating_layouts),
}]
} else {
... |
rust_dataset_chunk_518319 | rust_dataset.txt | 518,319 | 512 | Some(current_dir),
no_focus,
tab_id,
}])
},
CliAction::RenameSession { name } => Ok(vec![Action::RenameSession { name }]),
CliAction::Pipe {
name,
payload,
args,
p... |
rust_dataset_chunk_518320 | rust_dataset.txt | 518,320 | 512 | _id {
Some(pane_id_str) => Ok(vec![Action::MutePaneByPaneId {
pane_id: parse_cli_pane_id(&pane_id_str)?,
}]),
None => Ok(vec![Action::MutePane]),
},
CliAction::IgnorePaneOutput { pane_id } => match pane_id {
Some... |
rust_dataset_chunk_518321 | rust_dataset.txt | 518,321 | 512 | plugin pane id (eg. plugin_1)"
))?;
Ok(vec![Action::TogglePanePinnedByPaneId { pane_id }])
},
None => Ok(vec![Action::TogglePanePinned]),
},
CliAction::ToggleMirrorResize => Ok(vec![Action::ToggleMirrorResize]),
... |
rust_dataset_chunk_518322 | rust_dataset.txt | 518,322 | 512 | PaneBorderStyle {
pane_id,
border_style,
} => {
let border_style =
BorderStyleOverride::from_optional_cli_string(border_style.as_deref())?
.unwrap_or_default();
let parsed_pane_id = PaneId::from_str(&... |
rust_dataset_chunk_518323 | rust_dataset.txt | 518,323 | 512 | "No --pane-id provided and ZELLIJ_PANE_ID is not set".to_string()
})?,
};
let parsed_pane_id = PaneId::from_str(&pane_id_str);
match parsed_pane_id {
Ok(parsed_pane_id) => {
let (fg, bg) = if reset {
... |
rust_dataset_chunk_518324 | rust_dataset.txt | 518,324 | 512 | Action::Detach => Ok(vec![Action::Detach]),
CliAction::SetDarkTheme => Ok(vec![Action::SetDarkTheme]),
CliAction::SetLightTheme => Ok(vec![Action::SetLightTheme]),
CliAction::ToggleTheme => Ok(vec![Action::ToggleTheme]),
CliAction::DismissInfoPopups => Ok(vec![Action::Dis... |
rust_dataset_chunk_518325 | rust_dataset.txt | 518,325 | 512 | KDL node. \nPossible reasons:\n{}\n{}\n{}\n{}",
"- Missing `;` after a node name, eg. {{ node; another_node; }}",
"- Missing quotations (\") around an argument node eg. {{ first_node \"argument_node\"; }}",
... |
rust_dataset_chunk_518326 | rust_dataset.txt | 518,326 | 512 | "- Found an extraneous equal sign (=) between node child arguments and their values. eg. {{ argument=\"value\" }}")
},
_ => String::from(kdl_error.help.unwrap_or("Kdl Deserialization Error")),
... |
rust_dataset_chunk_518327 | rust_dataset.txt | 518,327 | 512 | Action::LaunchOrFocusPlugin { plugin, .. } => &plugin.location_string() == plugin_url,
_ => false,
}
}
pub fn is_mouse_action(&self) -> bool {
if let Action::MouseEvent { .. } = self {
return true;
}
false
}
}
fn suggest_key_fix(key_str: &... |
rust_dataset_chunk_518328 | rust_dataset.txt | 518,328 | 512 | ,
),
(Action::CloseFocusByPaneId { pane_id }, Action::CloseFocus),
(
Action::TogglePanePinnedByPaneId { pane_id },
Action::TogglePanePinned,
),
(
Action::TogglePaneInGroupByPaneId { pane_id },
Act... |
rust_dataset_chunk_518329 | rust_dataset.txt | 518,329 | 512 | str, should_float: bool| Action::LaunchOrFocusPlugin {
plugin: RunPluginOrAlias::Alias(PluginAlias::new(name, &None, None)),
should_float,
move_to_focused_tab: false,
should_open_in_place: false,
close_replaced_pane: false,
skip_cache: false,
... |
rust_dataset_chunk_518330 | rust_dataset.txt | 518,330 | 512 | actions[0] {
Action::Write {
key_with_modifier,
is_kitty_keyboard_protocol,
..
} => {
assert!(key_with_modifier.is_some());
let key = key_with_modifier.as_ref().unwrap();
assert_eq!(key.bare_key, Bare... |
rust_dataset_chunk_518331 | rust_dataset.txt | 518,331 | 512 | _string()],
pane_id: Some("terminal_1".to_string()),
};
let result = Action::actions_from_cli(cli_action, Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_ok());
let actions = result.unwrap();
assert_eq!(actions.len(), 1);
match &actions[0] {
... |
rust_dataset_chunk_518332 | rust_dataset.txt | 518,332 | 512 |
#[test]
fn test_scroll_down_with_pane_id() {
let cli_action = CliAction::ScrollDown {
pane_id: Some("terminal_2".to_string()),
};
let result = Action::actions_from_cli(cli_action, Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_ok());
let actions... |
rust_dataset_chunk_518333 | rust_dataset.txt | 518,333 | 512 | test]
fn test_scroll_to_bottom_with_pane_id() {
let cli_action = CliAction::ScrollToBottom {
pane_id: Some("terminal_4".to_string()),
};
let result = Action::actions_from_cli(cli_action, Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_ok());
let actio... |
rust_dataset_chunk_518334 | rust_dataset.txt | 518,334 | 512 | Down
#[test]
fn test_page_scroll_down_with_pane_id() {
let cli_action = CliAction::PageScrollDown {
pane_id: Some("terminal_8".to_string()),
};
let result = Action::actions_from_cli(cli_action, Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_ok());
... |
rust_dataset_chunk_518335 | rust_dataset.txt | 518,335 | 512 | ScrollUp));
}
// 8. HalfPageScrollDown
#[test]
fn test_half_page_scroll_down_with_pane_id() {
let cli_action = CliAction::HalfPageScrollDown {
pane_id: Some("terminal_12".to_string()),
};
let result = Action::actions_from_cli(cli_action, Box::new(|| PathBuf::from("/t... |
rust_dataset_chunk_518336 | rust_dataset.txt | 518,336 | 512 | };
let result = Action::actions_from_cli(cli_action, Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_ok());
let actions = result.unwrap();
assert_eq!(actions.len(), 1);
match &actions[0] {
Action::Resize { resize, direction } => {
... |
rust_dataset_chunk_518337 | rust_dataset.txt | 518,337 | 512 | let actions = result.unwrap();
assert_eq!(actions.len(), 1);
match &actions[0] {
Action::MovePaneBackwardsByPaneId { pane_id } => {
assert!(matches!(pane_id, PaneId::Terminal(11)));
},
_ => panic!("Expected MovePaneBackwardsByPaneId action"),
... |
rust_dataset_chunk_518338 | rust_dataset.txt | 518,338 | 512 | _ok());
let actions = result.unwrap();
assert_eq!(actions.len(), 1);
match &actions[0] {
Action::EditScrollbackByPaneId { pane_id, ansi } => {
assert!(matches!(pane_id, PaneId::Terminal(15)));
assert!(!ansi);
},
_ => panic!("Exp... |
rust_dataset_chunk_518339 | rust_dataset.txt | 518,339 | 512 | Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_ok());
let actions = result.unwrap();
assert_eq!(actions.len(), 1);
match &actions[0] {
Action::ToggleFocusNoUiFullscreenByPaneId { pane_id } => {
assert!(matches!(pane_id, PaneId::Terminal(16)));
... |
rust_dataset_chunk_518340 | rust_dataset.txt | 518,340 | 512 | ::ClosePane {
pane_id: Some("terminal_18".to_string()),
};
let result = Action::actions_from_cli(cli_action, Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_ok());
let actions = result.unwrap();
assert_eq!(actions.len(), 1);
match &actions[0] {
... |
rust_dataset_chunk_518341 | rust_dataset.txt | 518,341 | 512 | RenamePaneByPaneId { pane_id, name } => {
assert!(pane_id.is_none());
assert_eq!(name, &"my-pane".as_bytes().to_vec());
},
_ => panic!("Expected RenamePaneByPaneId action"),
}
}
// 18. UndoRenamePane
#[test]
fn test_undo_rename_pane_with_p... |
rust_dataset_chunk_518342 | rust_dataset.txt | 518,342 | 512 | { pane_id: None };
let result = Action::actions_from_cli(cli_action, Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_ok());
let actions = result.unwrap();
assert_eq!(actions.len(), 1);
assert!(matches!(actions[0], Action::TogglePanePinned));
}
#[test]
f... |
rust_dataset_chunk_518343 | rust_dataset.txt | 518,343 | 512 | };
let result = Action::actions_from_cli(cli_action, Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_err());
let err = result.unwrap_err();
assert!(err.contains("Malformed pane id"));
}
// =============================================
// Category 1: Tab-targeti... |
rust_dataset_chunk_518344 | rust_dataset.txt | 518,344 | 512 | (
CliAction::ToggleTheme,
Box::new(|| PathBuf::from("/tmp")),
None,
);
let actions = result.expect("ToggleTheme conversion should succeed");
assert_eq!(actions.len(), 1);
assert!(matches!(actions[0], Action::ToggleTheme));
}
#[test]
fn tes... |
rust_dataset_chunk_518345 | rust_dataset.txt | 518,345 | 512 | _undo_rename_tab_with_tab_id() {
let cli_action = CliAction::UndoRenameTab { tab_id: Some(7) };
let result = Action::actions_from_cli(cli_action, Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_ok());
let actions = result.unwrap();
assert_eq!(actions.len(), 1);
... |
rust_dataset_chunk_518346 | rust_dataset.txt | 518,346 | 512 | _action = CliAction::ToggleFloatingPanes { tab_id: Some(4) };
let result = Action::actions_from_cli(cli_action, Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_ok());
let actions = result.unwrap();
assert_eq!(actions.len(), 1);
match &actions[0] {
Action:... |
rust_dataset_chunk_518347 | rust_dataset.txt | 518,347 | 512 | ) };
let result = Action::actions_from_cli(cli_action, Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_ok());
let actions = result.unwrap();
assert_eq!(actions.len(), 1);
match &actions[0] {
Action::NextSwapLayoutByTabId { id } => {
assert... |
rust_dataset_chunk_518348 | rust_dataset.txt | 518,348 | 512 | test]
fn test_edit_scrollback_with_ansi_flag() {
let cli_action = CliAction::EditScrollback {
pane_id: None,
ansi: true,
};
let result = Action::actions_from_cli(cli_action, Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_ok());
let action... |
rust_dataset_chunk_518349 | rust_dataset.txt | 518,349 | 512 | _cli(cli_action, Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_ok());
let actions = result.unwrap();
assert_eq!(actions.len(), 1);
match &actions[0] {
Action::DumpScreen { pane_id, ansi, .. } => {
assert_eq!(*pane_id, Some(PaneId::Terminal(5)));... |
rust_dataset_chunk_518350 | rust_dataset.txt | 518,350 | 512 | PaneId::Plugin(2)));
},
_ => panic!("Expected FocusPaneByPaneId action"),
}
}
#[test]
fn test_focus_pane_id_malformed() {
let cli_action = CliAction::FocusPaneId {
pane_id: "invalid_id".to_string(),
};
let result = Action::actions_from_cl... |
rust_dataset_chunk_518351 | rust_dataset.txt | 518,351 | 512 | , Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_err());
}
#[test]
fn test_override_layout_with_layout_string() {
let cli_action = CliAction::OverrideLayout {
layout: None,
layout_string: Some("layout {\n pane\n pane\n}\n".into()),
lay... |
rust_dataset_chunk_518352 | rust_dataset.txt | 518,352 | 512 | }
fn new_pane_cli_action(floating: bool, border_style: Option<&str>) -> CliAction {
CliAction::NewPane {
direction: None,
command: vec![],
plugin: None,
cwd: None,
floating,
in_place: false,
close_replaced_pane: false,
... |
rust_dataset_chunk_518353 | rust_dataset.txt | 518,353 | 512 | !("Expected NewFloatingPane action, got {:?}", other),
}
}
#[test]
fn test_new_pane_without_border_style() {
let result = Action::actions_from_cli(
new_pane_cli_action(false, None),
Box::new(|| PathBuf::from("/tmp")),
None,
);
let actions ... |
rust_dataset_chunk_518354 | rust_dataset.txt | 518,354 | 512 | got {:?}", other),
}
}
#[test]
fn test_set_pane_border_style_with_a_malformed_pane_id_is_an_error() {
let cli_action = CliAction::SetPaneBorderStyle {
pane_id: "not_a_pane".to_string(),
border_style: None,
};
assert!(
Action::actions_from... |
rust_dataset_chunk_518355 | rust_dataset.txt | 518,355 | 512 | _id: Some(3),
border_style: None,
notify: Default::default(),
};
let result = Action::actions_from_cli(cli_action, Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_ok());
let actions = result.unwrap();
assert_eq!(actions.len(), 1);
matc... |
rust_dataset_chunk_518356 | rust_dataset.txt | 518,356 | 512 | ("terminal_4".to_string()),
name: None,
close_on_exit: false,
start_suspended: false,
configuration: None,
skip_plugin_cache: false,
x: None,
y: None,
width: None,
height: None,
pinned: None,
... |
rust_dataset_chunk_518357 | rust_dataset.txt | 518,357 | 512 | _err());
assert!(result.unwrap_err().contains("Malformed pane id"));
}
#[test]
fn test_new_pane_floating_with_tab_id() {
let cli_action = CliAction::NewPane {
direction: None,
command: vec![],
plugin: None,
cwd: None,
floating: tru... |
rust_dataset_chunk_518358 | rust_dataset.txt | 518,358 | 512 | : false,
no_focus: false,
borderless: None,
tab_id: Some(1),
border_style: None,
notify: Default::default(),
};
let result = Action::actions_from_cli(cli_action, Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_ok());
... |
rust_dataset_chunk_518359 | rust_dataset.txt | 518,359 | 512 | false,
close_replaced_pane: false,
cwd: None,
x: None,
y: None,
width: None,
height: None,
pinned: None,
near_current_pane: false,
no_focus: false,
borderless: None,
tab_id: Some(4),
... |
rust_dataset_chunk_518360 | rust_dataset.txt | 518,360 | 512 | : false,
x: None,
y: None,
width: None,
height: None,
pinned: None,
stacked: false,
blocking: false,
block_until_exit_success: false,
block_until_exit_failure: false,
block_until_exit: false,
... |
rust_dataset_chunk_518361 | rust_dataset.txt | 518,361 | 512 | !(*tab_id, Some(1));
},
_ => panic!("Expected NewFloatingPluginPane action"),
}
}
fn set_resurrect_command_from_cli(
pane_id: Option<&str>,
cwd: Option<&str>,
clear: bool,
command: Vec<&str>,
) -> Result<Vec<Action>, String> {
let cli_... |
rust_dataset_chunk_518362 | rust_dataset.txt | 518,362 | 512 | _rejects_plugin_pane() {
let result =
set_resurrect_command_from_cli(Some("plugin_2"), None, false, vec!["opencode"]);
assert!(result.is_err());
}
#[test]
fn test_set_resurrect_command_rejects_malformed_pane_id() {
let result = set_resurrect_command_from_cli(Some("nope")... |
rust_dataset_chunk_518363 | rust_dataset.txt | 518,363 | 512 | = [
AttentionStatus::NeedsYou,
AttentionStatus::Failed,
AttentionStatus::Done,
];
pub const BADGE_STATUSES: [AttentionStatus; 6] = [
AttentionStatus::NeedsYou,
AttentionStatus::Failed,
AttentionStatus::Done,
AttentionStatus::Working,
AttentionStatus::Quiet,
AttentionStatus::NewOutp... |
rust_dataset_chunk_518364 | rust_dataset.txt | 518,364 | 512 | AttentionStatus::Done => self.done,
AttentionStatus::Working => self.working,
AttentionStatus::Quiet => self.quiet,
AttentionStatus::NewOutput => self.new_output,
AttentionStatus::Idle => None,
}
}
pub fn set(&mut self, status: AttentionStatus,... |
rust_dataset_chunk_518365 | rust_dataset.txt | 518,365 | 512 | <StatusMap<T>, ConfigError> {
let mut map = StatusMap::default();
let Some(children) = node.children() else {
return Ok(map);
};
for child in children.nodes() {
let name = child.name().value();
let status = AttentionStatus::from_str(name)
.filter(|status| allowed.cont... |
rust_dataset_chunk_518366 | rust_dataset.txt | 518,366 | 512 | >,
pub desktop_notifications: StatusMap<bool>,
pub tray_badge: StatusMap<bool>,
pub tray_badge_colors: StatusMap<[u8; 3]>,
pub notification_details: Option<bool>,
}
fn kdl_error(message: String, node: &KdlNode) -> ConfigError {
ConfigError::new_kdl_error(message, node.span().offset(), node.span().l... |
rust_dataset_chunk_518367 | rust_dataset.txt | 518,367 | 512 | le_silence_secs.unwrap_or(DEFAULT_IDLE_SILENCE_SECS)
}
pub fn startup_card(&self) -> StartupCard {
if self.enabled() {
self.startup_card.unwrap_or_default()
} else {
StartupCard::Never
}
}
pub fn tray_icon(&self) -> bool {
self.tray_icon.unwrap_or(... |
rust_dataset_chunk_518368 | rust_dataset.txt | 518,368 | 512 | _value(node)?),
"track_commands" => config.track_commands = Some(bool_value(node)?),
"idle_activity_secs" => config.idle_activity_secs = Some(secs_value(node)?),
"idle_silence_secs" => config.idle_silence_secs = Some(secs_value(node)?),
"startup_card" => {... |
rust_dataset_chunk_518369 | rust_dataset.txt | 518,369 | 512 | Some(v) = self.idle_rule {
push("idle_rule", KdlValue::String(v.as_str().to_owned()));
}
if let Some(v) = self.done_threshold_secs {
push("done_threshold_secs", KdlValue::Base10(v as i64));
}
if let Some(v) = self.track_commands {
push("track_commands... |
rust_dataset_chunk_518370 | rust_dataset.txt | 518,370 | 512 | ilence_secs),
startup_card: other.startup_card.or(self.startup_card),
tray_icon: other.tray_icon.or(self.tray_icon),
enabled: other.enabled.or(self.enabled),
desktop_notifications: self
.desktop_notifications
.merge(&other.desktop_notificat... |
rust_dataset_chunk_518371 | rust_dataset.txt | 518,371 | 512 | }
tray_badge_colors {
failed "#112233"
}
notification_details false
}
"##,
)
.unwrap();
assert!(!config.frame_markers());
assert!(!config.host_status());
assert!(!config.tab_markers());
... |
rust_dataset_chunk_518372 | rust_dataset.txt | 518,372 | 512 | s_every_attention_feature_off() {
let config = parse(
"attention {\n enabled false\n frame_markers true\n tab_markers true\n host_status true\n track_commands true\n startup_card \"always\"\n}",
)
.unwrap();
assert!(!config.enabled());
assert!(!config.frame_markers())... |
rust_dataset_chunk_518373 | rust_dataset.txt | 518,373 | 512 | parse("attention {\n tray_badge {\n done false\n working false\n }\n}").unwrap();
let other = parse("attention {\n tray_badge {\n done true\n }\n}").unwrap();
let merged = base.merge(other);
assert_eq!(merged.tray_badge.done, Some(true));
assert_eq!(merged.tray_badge.working, Some(false... |
rust_dataset_chunk_518374 | rust_dataset.txt | 518,374 | 512 | if is_web_client {
return Some("through the web server".to_owned());
}
if host_terminal_env.contains_key(DESKTOP_TERMINAL_ENV_KEY) {
return None;
}
if let Some(connection) = host_terminal_env.get("SSH_CONNECTION") {
return Some(match connection.split_whitespace().next() {
... |
rust_dataset_chunk_518375 | rust_dataset.txt | 518,375 | 512 | unwrap_or_else(|_| Default::default())
}
};
let config_dir = self.config_dir.clone().or_else(find_default_config_dir);
let keybinds_dir_override = self
.configuration_options
.as_ref()
.and_then(|options| options.keybinds_dir.clone());
if c... |
rust_dataset_chunk_518376 | rust_dataset.txt | 518,376 | 512 | aptured() {
let env = host_terminal_env_from(|name| match name {
"TERM" => Some("xterm-kitty".to_owned()),
"KITTY_WINDOW_ID" => Some("3".to_owned()),
"SECRET_TOKEN" => Some("hunter2".to_owned()),
_ => None,
});
assert_eq!(
env,
... |
rust_dataset_chunk_518377 | rust_dataset.txt | 518,377 | 512 | }
#[test]
fn only_a_window_that_vouches_for_its_display_env_has_it_adopted() {
let env = |entries: &[(&str, &str)]| -> BTreeMap<String, String> {
entries
.iter()
.map(|(name, value)| (name.to_string(), value.to_string()))
.collect()
... |
rust_dataset_chunk_518378 | rust_dataset.txt | 518,378 | 512 | <PathBuf>,
pub originating_plugin: Option<OriginatingPlugin>,
}
impl Default for OpenFilePayload {
fn default() -> Self {
OpenFilePayload {
path: PathBuf::new(),
line_number: None,
cwd: None,
originating_plugin: None,
}
}
}
impl OpenFilePaylo... |
rust_dataset_chunk_518379 | rust_dataset.txt | 518,379 | 512 | )]
pub use_terminal_title: bool,
#[serde(default)]
pub notify: bool,
}
impl From<RunCommandAction> for RunCommand {
fn from(action: RunCommandAction) -> Self {
RunCommand {
command: action.command,
args: action.args,
cwd: action.cwd,
hold_on_close... |
rust_dataset_chunk_518380 | rust_dataset.txt | 518,380 | 512 | CTIONS};
use super::keybind_presets::MousebindChanges;
use super::layout::{RunPlugin, RunPluginOrAlias};
use super::mousebinds::MouseBinding;
use super::plugins::PluginAliases;
use super::theme::{TerminalColors, Theme, Themes};
use crate::data::{
ConfigBlocks, ContextMenuAction, ContextMenuEntry, EnvVarEntry, Input... |
rust_dataset_chunk_518381 | rust_dataset.txt | 518,381 | 512 | in PLAYER_COLOURS {
slots.push((MULTIPLAYER_COLOURS, player));
}
slots
}
pub fn colour_text(colour: &PaletteColor) -> String {
match colour {
PaletteColor::Rgb((r, g, b)) => format!("#{:02x}{:02x}{:02x}", r, g, b),
PaletteColor::EightBit(index) => index.to_string(),
}
}
fn hex... |
rust_dataset_chunk_518382 | rust_dataset.txt | 518,382 | 512 | 8>().ok().map(PaletteColor::EightBit),
[r, g, b] => Some(PaletteColor::Rgb((
r.parse().ok()?,
g.parse().ok()?,
b.parse().ok()?,
))),
_ => None,
}
}
fn style_ref<'a>(styling: &'a Styling, style: &str) -> Option<&'a StyleDeclaration> {
match style {
... |
rust_dataset_chunk_518383 | rust_dataset.txt | 518,383 | 512 | .get_or_insert(frame_selected)),
"frame_selected" => Some(&mut styling.frame_selected),
"frame_highlight" => Some(&mut styling.frame_highlight),
"exit_code_success" => Some(&mut styling.exit_code_success),
"exit_code_error" => Some(&mut styling.exit_code_error),
_ => None,
}
... |
rust_dataset_chunk_518384 | rust_dataset.txt | 518,384 | 512 | yling: &mut Styling, style: &str, component: &str, colour: PaletteColor) {
let target = if style == MULTIPLAYER_COLOURS {
player_mut(&mut styling.multiplayer_user_colors, component)
} else {
style_mut(styling, style).and_then(|declaration| component_mut(declaration, component))
};
if let... |
rust_dataset_chunk_518385 | rust_dataset.txt | 518,385 | 512 | is_empty() {
None
} else {
Some(children)
}
}
pub fn plugin_alias_node(alias: &PluginAliasEntry) -> KdlNode {
let mut node = KdlNode::new(alias.name.as_str());
node.insert("location", alias.plugin.location.clone());
if let Some(children) = plugin_children(&alias.plugin) {
no... |
rust_dataset_chunk_518386 | rust_dataset.txt | 518,386 | 512 | dl(aliases: &[PluginAliasEntry]) -> String {
block_text("plugins", aliases.iter().map(plugin_alias_node).collect())
}
pub fn load_plugins_kdl(entries: &[PluginEntry]) -> String {
block_text(
"load_plugins",
entries.iter().map(load_plugin_node).collect(),
)
}
pub fn env_kdl(entries: &[EnvVa... |
rust_dataset_chunk_518387 | rust_dataset.txt | 518,387 | 512 | trim()
);
text.parse::<KdlDocument>()
.map_err(|e: kdl::KdlError| e.to_string())?;
Ok(text)
}
pub fn action_text(action: &Action) -> String {
match action.to_kdl() {
Some(node) => bare_node(node).to_string().trim().to_owned(),
None => {
let debug = format!("{:?}", ac... |
rust_dataset_chunk_518388 | rust_dataset.txt | 518,388 | 512 | entries: &[ContextMenuEntry],
shortcuts: Option<(&KeybindsVec, InputMode)>,
) -> Vec<MenuItemEntry> {
entries
.iter()
.map(|entry| match entry {
ContextMenuEntry::Separator => MenuItemEntry::separator(),
ContextMenuEntry::Item { label, actions, .. } => MenuItemEntry {
... |
rust_dataset_chunk_518389 | rust_dataset.txt | 518,389 | 512 | ();
sorted
.into_iter()
.filter(|(_, theme)| include_external || !theme.sourced_from_external_file)
.map(|(name, theme)| {
let source = theme_source(name, theme);
ThemeEntry {
name: name.clone(),
source,
colours: if sour... |
rust_dataset_chunk_518390 | rust_dataset.txt | 518,390 | 512 | Ok(())
}
pub fn create_theme_file(
dir: &Path,
name: &str,
palette: &Styling,
terminal_colors: Option<&TerminalColors>,
) -> Result<PathBuf, String> {
if !is_usable_theme_file_name(name) {
return Err(format!(
"{} cannot be a file name; use only letters, digits, - and _",
... |
rust_dataset_chunk_518391 | rust_dataset.txt | 518,391 | 512 | .parse()
.map_err(|e: kdl::KdlError| format!("Could not read {}: {}", path.display(), e))?;
let missing = || format!("{} does not define the theme {}", path.display(), name);
let themes_node = document
.nodes_mut()
.iter_mut()
.find(|node| node.name().value() == "themes")... |
rust_dataset_chunk_518392 | rust_dataset.txt | 518,392 | 512 | ();
*theme_node = theme_to_kdl(name, palette);
if let Some(terminal_colors) = terminal_colors {
theme_node
.ensure_children()
.nodes_mut()
.push(terminal_colors);
}
document.fmt();
let new_text = document.to_string();
check_theme_text(&new_text, name, ... |
rust_dataset_chunk_518393 | rust_dataset.txt | 518,393 | 512 | plugins" => {
config.plugins = PluginAliases::from_kdl(node).map_err(|e| e.to_string())?;
},
"load_plugins" => {
config.background_plugins =
load_plugins_from_kdl(node).map_err(|e| e.to_string())?;
},
"env" => {
... |
rust_dataset_chunk_518394 | rust_dataset.txt | 518,394 | 512 | " | "unbind"))
.flat_map(|node| string_arguments(node))
.filter_map(|text| KeyWithModifier::from_str(&text).ok())
.collect()
}
pub fn shared_block_names(
file_contents: Option<&str>,
) -> BTreeMap<(InputMode, KeyWithModifier), Option<String>> {
let mut names = BTreeMap::new();
let S... |
rust_dataset_chunk_518395 | rust_dataset.txt | 518,395 | 512 | for key in keys {
let user_state = key_state(user, mode, &key);
let unsaved = key_state(saved_user, mode, &key) != user_state;
let preset_actions = preset_mode
.and_then(|keys| keys.get(&key))
.map(|actions| action_texts(actions));
... |
rust_dataset_chunk_518396 | rust_dataset.txt | 518,396 | 512 | = KdlDocument::new();
let has_children = nodes.iter().any(|node| node.children().is_some());
for node in nodes {
children.nodes_mut().push(node);
}
if !has_children {
for node in children.nodes_mut() {
node.set_trailing... |
rust_dataset_chunk_518397 | rust_dataset.txt | 518,397 | 512 | bindings.keys().cloned().collect())
.unwrap_or_default();
if let Some(mode_changes) = user.modes.get(&mode) {
triggers.extend(mode_changes.unbind.iter().cloned());
}
for trigger in triggers {
let user_state = mouse_state(user, mode, &trigger);
let... |
rust_dataset_chunk_518398 | rust_dataset.txt | 518,398 | 512 | _kdl_values,
setting_node_path, setting_value,
};
use super::context_menu::{
merge_menu_statements, ContextMenuConfig, MenuPlacement, MenuStatement, CONTEXT_MENU_SECTIONS,
};
use super::keybind_presets::{KeybindChanges, KeybindsSelection, LEADER_PLACEHOLDERS};
use super::keybinds::Keybinds;
use super::layout::{... |
rust_dataset_chunk_518399 | rust_dataset.txt | 518,399 | 512 | <MenuItemEntry>,
edits: Vec<ListEdit<MenuItemEntry>>,
},
ContextMenuDefaults {
section: &'static str,
entries: Vec<MenuItemEntry>,
},
Theme {
name: String,
theme: Option<ThemeEntry>,
},
ThemeColours {
name: String,
theme: ThemeEntry,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.