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_510300 | rust_dataset.txt | 510,300 | 512 | + offset, end + offset));
} else {
plain_ranges.push((start + offset, end + offset));
}
}
if hovered_ranges.is_empty() {
return (Text::from(text).color_all(3), false);
}
let mut styled = Text::from(text);
for (start, end) in plain_ranges {
styled = styled... |
rust_dataset_chunk_510301 | rust_dataset.txt | 510,301 | 512 | format!("- {}", entry.description)));
}
(key_width, action_width)
}
pub fn regions(&self, rows: usize, cols: usize) -> Vec<TooltipRegion> {
let current_mode = self.mode_info.mode;
let mut regions = vec![];
if current_mode == InputMode::Normal {
let (component... |
rust_dataset_chunk_510302 | rust_dataset.txt | 510,302 | 512 | row,
region: ClickRegion::new(
base_x + chunk_start,
base_x + chunk_end,
actions.clone(),
),
});
}
}
... |
rust_dataset_chunk_510303 | rust_dataset.txt | 510,303 | 512 | ,
None,
);
}
} else {
let (table, tooltip_rows, tooltip_columns) =
self.other_mode_tooltip(current_mode, hovered);
let base_x = cols.saturating_sub(tooltip_columns) / 2;
let base_y = rows.saturating_sub(tooltip_r... |
rust_dataset_chunk_510304 | rust_dataset.txt | 510,304 | 512 | _key_text(entry.key_text(), entry, 0, hovered);
table = table.add_styled_row(vec![key, description]);
row_count += 1;
}
let total_width = key_width + action_width + 1;
(table, row_count, total_width)
}
}
}
#[cfg(test)]
mod tests {
use... |
rust_dataset_chunk_510305 | rust_dataset.txt | 510,305 | 512 | &r.region.actions == actions)
.cloned()
.unwrap_or_else(|| panic!("{:?} not in {:?}", actions, regions))
};
let increase = find(&resize(Resize::Increase, None));
let decrease = find(&resize(Resize::Decrease, None));
assert_eq!(increase.row, decrease.row);... |
rust_dataset_chunk_510306 | rust_dataset.txt | 510,306 | 512 | .filter(|r| r.region.actions == lock)
.collect();
assert_eq!(lock_regions.len(), 2);
assert_eq!(lock_regions[0].region.end, lock_regions[1].region.start - 1);
assert!(regions.iter().any(|r| r.region.actions
== vec![Action::SwitchToMode {
input_mode: Input... |
rust_dataset_chunk_510307 | rust_dataset.txt | 510,307 | 512 | , 3), (3, 4), (4, 5)]);
let characters: Vec<(usize, usize)> = entry
.chunk_ranges()
.into_iter()
.map(|(start, end, _)| (start, end))
.collect();
assert_eq!(characters, vec![(0, 1), (1, 2), (2, 3), (3, 4)]);
let (_, is_hovered) = styled_key_text(en... |
rust_dataset_chunk_510308 | rust_dataset.txt | 510,308 | 512 | )>,
in_reserved_range: bool,
) -> ClickTarget {
if in_reserved_range {
return ClickTarget::Other;
}
match clicked_part {
None => ClickTarget::Empty,
Some((Some(tab_index), _)) => ClickTarget::Tab(tab_index),
Some((None, text)) if is_blank(text) => ClickTarget::Empty,
... |
rust_dataset_chunk_510309 | rust_dataset.txt | 510,309 | 512 | peekable();
while let Some(c) = chars.next() {
if c == '\u{1b}' {
if chars.peek() == Some(&'[') {
chars.next();
while let Some(next) = chars.next() {
if ('\u{40}'..='\u{7e}').contains(&next) {
break;
... |
rust_dataset_chunk_510310 | rust_dataset.txt | 510,310 | 512 | outcome = double_click_outcome(
&DoubleClickConfig::default(),
Some(ClickTarget::Empty),
ClickTarget::Empty,
);
assert_eq!(outcome, DoubleClickOutcome::NewTab);
}
#[test]
fn double_click_on_empty_space_does_nothing_when_disabled() {
let outcome =... |
rust_dataset_chunk_510311 | rust_dataset.txt | 510,311 | 512 | (Default)]
pub struct KeybindStore {
tables: BTreeMap<TableId, KeybindsVec>,
clients: BTreeMap<ClientId, TableId>,
next_table_id: TableId,
}
impl KeybindStore {
pub fn set(&mut self, client_id: ClientId, keybinds: KeybindsVec) {
let existing = self
.tables
.iter()
... |
rust_dataset_chunk_510312 | rust_dataset.txt | 510,312 | 512 | s))
},
_ => None,
}
}
#[cfg(test)]
mod tests {
use super::*;
use zellij_tile::prelude::actions::Action;
fn table(c: char) -> KeybindsVec {
vec![(
InputMode::Normal,
vec![(KeyWithModifier::new(BareKey::Char(c)), vec![Action::Quit])],
)]
}
... |
rust_dataset_chunk_510313 | rust_dataset.txt | 510,313 | 512 | |\s)((?:(?:\./|\.\./|/)[A-Za-z0-9_./\-+@%,#=~!\$\{\}\[\]]+|~/[A-Za-z0-9_./\-+@%,#=~!\$\{\}\[\]]+|\$\{?[A-Za-z_][A-Za-z0-9_]*\}?/[A-Za-z0-9_./\-+@%,#=~!\$\{\}\[\]]+)(?::\d+(?::\d+)?)?)(?::|\s|$)"#;
const CWD_CONTEXT_KEY: &str = "cwd";
#[derive(Default)]
pub struct Link {
slots: BTreeSet<SlotId>,
initialized: b... |
rust_dataset_chunk_510314 | rust_dataset.txt | 510,314 | 512 | ) in &pane_manifest.panes {
for pane_info in panes {
if !pane_info.is_plugin {
let pane_id = PaneId::Terminal(pane_info.id);
current_panes.insert(pane_id);
}
}
}
for &pane_id in ¤t_panes {
... |
rust_dataset_chunk_510315 | rust_dataset.txt | 510,315 | 512 | m,
Err(_) => return,
};
if metadata.is_dir() {
let mut args = BTreeMap::new();
let mut configuration = BTreeMap::new();
args.insert("open_directly".to_owned(), "true".to_owned());
configuration.insert("caller_cwd".to_owned(), absolute_path.di... |
rust_dataset_chunk_510316 | rust_dataset.txt | 510,316 | 512 | _CHARS: &str = r#"[A-Za-z0-9_./\-+@%,#=~!\$\{\}\[\]]"#;
fn link_highlight(pattern: String, context: BTreeMap<String, String>) -> RegexHighlight {
RegexHighlight {
pattern,
style: HighlightStyle::None,
layer: HighlightLayer::Hint,
context,
on_hover: true,
bold: false,... |
rust_dataset_chunk_510317 | rust_dataset.txt | 510,317 | 512 | String {
let after_tilde = if path == "~" {
match env_vars.get("HOME") {
Some(home) => home.clone(),
None => path.to_owned(),
}
} else if let Some(rest) = path.strip_prefix("~/") {
match env_vars.get("HOME") {
Some(home) => format!("{}/{}", home, rest... |
rust_dataset_chunk_510318 | rust_dataset.txt | 510,318 | 512 | let Some(colon_pos) = search_region.rfind(':') {
let segment = &matched_string[colon_pos + 1..end];
if !segment.is_empty() && segment.chars().all(|c| c.is_ascii_digit()) {
numeric_segments.push((colon_pos, segment));
end = colon_pos;
} else {
... |
rust_dataset_chunk_510319 | rust_dataset.txt | 510,319 | 512 | env = BTreeMap::new();
env.insert("HOME".into(), "/home/user".into());
assert_eq!(expand_path("${HOME}/foo", &env), "/home/user/foo");
}
#[test]
fn expand_path_unknown_var_preserved() {
let env = BTreeMap::new();
assert_eq!(expand_path("$UNKNOWN/foo", &env), "$UNKNOWN/foo")... |
rust_dataset_chunk_510320 | rust_dataset.txt | 510,320 | 512 | else {
break;
};
let m = captures.get(1).unwrap();
found.push(m.as_str().to_owned());
pos = m.end().max(pos + 1);
}
assert_eq!(found, vec!["Cargo.toml", "src", "src/main.rs:12"]);
}
#[test]
fn scan_directory_returns_entries() ... |
rust_dataset_chunk_510321 | rust_dataset.txt | 510,321 | 512 | return match mode_info.session_name.as_deref() {
Some(name) if !name.is_empty() => Some(name.to_owned()),
_ => Some("Enter name...".to_owned()),
};
}
mode_info.session_name.clone()
}
pub fn session_name_hidden(mode_info: &ModeInfo) -> bool {
mode_info.style.hide_session_nam... |
rust_dataset_chunk_510322 | rust_dataset.txt | 510,322 | 512 | }
fn store_keybinds(&mut self, event: &mut Event, client_id: Option<ClientId>) {
let Some(keybinds) = take_keybinds(event) else {
return;
};
match client_id {
Some(client_id) => self.keybinds.set(client_id, keybinds),
None => {
let mut... |
rust_dataset_chunk_510323 | rust_dataset.txt | 510,323 | 512 | },
_ => RenderResponse::Nothing,
}
},
_ => {
let mut render = RenderResponse::Nothing;
if !self.any_bar_has_slots() {
if let Some(client_id) = context.client_id {
if matches!(
... |
rust_dataset_chunk_510324 | rust_dataset.txt | 510,324 | 512 | self.link.slot_added(&slot),
Role::ModeHints => self.mode_hints.slot_added(&slot),
}
if self.any_bar_has_slots() {
self.pending.clear();
}
}
fn slot_removed(&mut self, slot_id: SlotId) {
let Some(role) = self.slots.remove(&slot_id) else {
ret... |
rust_dataset_chunk_510325 | rust_dataset.txt | 510,325 | 512 | s(context.client_id);
if pipe_message.name == session_indicator::PANEL_SIZE_PIPE {
let mut render = RenderResponse::Nothing;
if self.tab_bar.has_slots() {
render = render.merge(self.tab_bar.pipe(&pipe_message));
}
if self.compact_bar.has_slots() {
... |
rust_dataset_chunk_510326 | rust_dataset.txt | 510,326 | 512 | mode_info.mode == InputMode::Normal {
rows
} else {
rows.saturating_sub(2)
};
(cols, rows.max(1))
}
pub fn wanted_size(mode_info: &ModeInfo) -> (usize, usize) {
let (content_cols, content_rows) = content_size(mode_info);
let title_cols = display_width(&mode_label(mode_info.mode)) +... |
rust_dataset_chunk_510327 | rust_dataset.txt | 510,327 | 512 | ) {
self.mode_infos.remove(&client_id);
}
fn all_slots(&self) -> RenderResponse {
if self.slots.is_empty() {
RenderResponse::Nothing
} else {
RenderResponse::Slots(self.slots.iter().copied().collect())
}
}
pub fn update(&mut self, event: &Event, ... |
rust_dataset_chunk_510328 | rust_dataset.txt | 510,328 | 512 | fn mode_info_with_keys(mode: InputMode) -> ModeInfo {
ModeInfo {
mode,
base_mode: Some(InputMode::Normal),
keybinds: vec![(
InputMode::Pane,
vec![(
KeyWithModifier::new(BareKey::Char('x')),
vec![actions:... |
rust_dataset_chunk_510329 | rust_dataset.txt | 510,329 | 512 | ,
pub emphasis: Option<(IndicatorColor, std::ops::Range<usize>)>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ClickAction {
Toggle,
}
fn plain(text: String) -> IndicatorText {
IndicatorText {
text,
emphasis: None,
}
}
fn status_color(status: AttentionStatus) -> IndicatorColor {
... |
rust_dataset_chunk_510330 | rust_dataset.txt | 510,330 | 512 | return watch_variants(watch_results, running, simplified_ui);
}
match top {
None => vec![
plain(format!("{} running", running)),
plain(format!("{}", running)),
],
Some((status, count)) => {
let symbol = status.marker(simplified_ui);
... |
rust_dataset_chunk_510331 | rust_dataset.txt | 510,331 | 512 | (&self) -> bool {
self.enabled && self.global.is_some()
}
#[cfg(test)]
pub fn variants(&self) -> Vec<IndicatorText> {
self.variants_for(false)
}
pub fn variants_for(&self, simplified_ui: bool) -> Vec<IndicatorText> {
if !self.enabled {
return vec![];
}
... |
rust_dataset_chunk_510332 | rust_dataset.txt | 510,332 | 512 | pub fn plain_render(&self, text: &IndicatorText, simplified_ui: bool) -> String {
format!("[ {} {} ]", text.text, self.arrow(simplified_ui))
}
pub fn click_action(&self) -> Option<ClickAction> {
if self.panel_size != PanelSize::Closed || self.is_visible() {
Some(ClickAction::Toggle... |
rust_dataset_chunk_510333 | rust_dataset.txt | 510,333 | 512 | vec!["5 running", "5"]);
}
#[test]
fn attention_shortens_step_by_step() {
assert_eq!(
texts(indicator(Some((AttentionStatus::NeedsYou, 2)), 5).variants()),
vec!["● 2 need you · 5 running", "● 2 · 5", "● 2", "●"]
);
assert_eq!(
texts(indicator(Som... |
rust_dataset_chunk_510334 | rust_dataset.txt | 510,334 | 512 | 5 running v ]"
);
}
#[test]
fn shortening_steps_by_width() {
let indicator = indicator(Some((AttentionStatus::NeedsYou, 2)), 5);
let rendered: Vec<String> = [40, 20, 11, 8, 6]
.iter()
.map(|width| {
indicator
.fitting_varia... |
rust_dataset_chunk_510335 | rust_dataset.txt | 510,335 | 512 | PipeSource::Plugin(7),
name: PANEL_SIZE_PIPE.to_owned(),
payload: Some("manager".to_owned()),
args,
is_private: false,
};
assert!(indicator.handle_pipe(&message));
assert_eq!(indicator.panel_size, PanelSize::Manager);
assert_eq!(indicator.... |
rust_dataset_chunk_510336 | rust_dataset.txt | 510,336 | 512 | Move,
Tmux,
}
#[derive(Debug, Copy, Clone)]
pub enum KeyMode {
Unselected,
UnselectedAlternate,
Selected,
Disabled,
}
impl KeyShortcut {
pub fn new(mode: KeyMode, action: KeyAction, key: Option<KeyWithModifier>) -> Self {
KeyShortcut { mode, action, key }
}
pub fn full_tex... |
rust_dataset_chunk_510337 | rust_dataset.txt | 510,337 | 512 | pub fn is_selected(&self) -> bool {
match self.mode {
KeyMode::Selected => true,
_ => false,
}
}
pub fn short_text(&self) -> String {
match self.action {
KeyAction::Lock => String::from("Lo"),
KeyAction::Unlock => String::from("Un"),
... |
rust_dataset_chunk_510338 | rust_dataset.txt | 510,338 | 512 | .to_string(),
len: display_width(&start_separator)
+ 2
+ display_width(&key_binding)
+ 2
+ display_width(&key_hint)
+ 1
+ display_width(&separator),
..Default::default()
}
}
fn shortened_modifier_shortcut(
key: &Key... |
rust_dataset_chunk_510339 | rust_dataset.txt | 510,339 | 512 | = !common_modifiers.is_empty();
let key_binding = match (&key.mode, &key.key) {
(KeyMode::Disabled, None) => "".to_string(),
(_, None) => return LinePart::default(),
(_, Some(_)) => key.letter_shortcut(common_modifiers),
};
let colors = match key.mode {
KeyMode::Unselected ... |
rust_dataset_chunk_510340 | rust_dataset.txt | 510,340 | 512 | ).1;
for key in keys {
let line_empty = line_part.len == 0;
let key = short_mode_shortcut(key, palette, separator, &shared_modifiers, line_empty);
line_part.part = format!("{}{}", line_part.part, key.part);
line_part.len += key.len;
}
if line_part.len < max_len {
retu... |
rust_dataset_chunk_510341 | rust_dataset.txt | 510,341 | 512 | _swap_layout_indicator!(unselected)
} else {
style_swap_layout_indicator!(selected)
};
let swap_layout_indicator = format!(
"{}{}{}",
prefix_separator, swap_layout_name, suffix_separator
);
let (part,... |
rust_dataset_chunk_510342 | rust_dataset.txt | 510,342 | 512 | Elements,
separator: &str,
mode_info: &ModeInfo,
) -> (Vec<KeyModifier>, LinePart) {
let common_modifiers = get_common_modifiers(mode_switch_keys(mode_info).iter().collect());
if common_modifiers.is_empty() {
return (common_modifiers, LinePart::default());
}
let prefix_text = if mode_in... |
rust_dataset_chunk_510343 | rust_dataset.txt | 510,343 | 512 | => KeyAction::Resize,
InputMode::Move => KeyAction::Move,
InputMode::Scroll | InputMode::Search | InputMode::EnterSearch => KeyAction::Search,
InputMode::Session | InputMode::RenameSession => KeyAction::Session,
};
for shortcut in shortcuts.iter_mut() {
if shortcut.action == key... |
rust_dataset_chunk_510344 | rust_dataset.txt | 510,344 | 512 | binds,
&[Action::SwitchToMode {
input_mode: InputMode::Session,
}],
)),
),
KeyShortcut::new(
KeyMode::UnselectedAlternate,
KeyAction::Quit,
to_char(action_key(binds, &[Action::Quit])),
... |
rust_dataset_chunk_510345 | rust_dataset.txt | 510,345 | 512 | _mode_shortcut_selected_with_binding() {
let key = KeyShortcut::new(
KeyMode::Selected,
KeyAction::Session,
Some(KeyWithModifier::new(BareKey::Char('0'))),
);
let color = colored_elements();
let ret = long_mode_shortcut(&key, color, "+", &vec![], fals... |
rust_dataset_chunk_510346 | rust_dataset.txt | 510,346 | 512 | to_string());
}
#[test]
fn long_mode_shortcut_selected_with_ctrl_binding_shared_superkey() {
let key = KeyShortcut::new(
KeyMode::Selected,
KeyAction::Session,
Some(KeyWithModifier::new(BareKey::Char('0')).with_ctrl_modifier()),
);
let color = col... |
rust_dataset_chunk_510347 | rust_dataset.txt | 510,347 | 512 | long_mode_shortcut(&key, color, "+", &vec![KeyModifier::Ctrl], true);
let ret = unstyle(ret);
assert_eq!(ret, "+ <0> SESSION +".to_string());
}
#[test]
fn short_mode_shortcut_selected_with_binding() {
let key = KeyShortcut::new(
KeyMode::Selected,
KeyAction... |
rust_dataset_chunk_510348 | rust_dataset.txt | 510,348 | 512 | Shortcut::new(
KeyMode::Unselected,
KeyAction::Session,
Some(KeyWithModifier::new(BareKey::Char('0'))),
);
let color = colored_elements();
let ret = short_mode_shortcut(&key, color, "+", &vec![], false);
let ret = unstyle(ret);
assert_eq!(ret... |
rust_dataset_chunk_510349 | rust_dataset.txt | 510,349 | 512 | let color = colored_elements();
let ret = short_mode_shortcut(&key, color, "+", &vec![], false);
let ret = unstyle(ret);
assert_eq!(ret, "".to_string());
}
#[test]
fn short_mode_shortcut_disabled_without_binding() {
let key = KeyShortcut::new(KeyMode::Selected, Key... |
rust_dataset_chunk_510350 | rust_dataset.txt | 510,350 | 512 | SwitchToMode{input_mode: InputMode::Move}]),
]),
],
..ModeInfo::default()
};
let ret = first_line(&mode_info, None, 500, ">");
let ret = unstyle(ret);
assert_eq!(
ret,
" <Ctrl a> PANE >> <Ctrl b> RESIZE >> <c> MOVE >".to_s... |
rust_dataset_chunk_510351 | rust_dataset.txt | 510,351 | 512 | WithModifier::new(BareKey::Char('c')).with_ctrl_modifier(), vec![Action::SwitchToMode{input_mode: InputMode::Tab}]),
(KeyWithModifier::new(BareKey::Char('d')).with_ctrl_modifier(), vec![Action::SwitchToMode{input_mode: InputMode::Resize}]),
(KeyWithModifier::new(BareKey::Char('e'... |
rust_dataset_chunk_510352 | rust_dataset.txt | 510,352 | 512 | = None);
result
}
pub fn is_hovered(actions: &[Action]) -> bool {
HOVERED.with(|h| h.borrow().as_deref() == Some(actions))
}
--- FILE: zellij/default-plugins/bars/src/status_bar/mod.rs ---
mod first_line;
mod hover;
mod one_line_ui;
mod second_line;
mod session_hints;
mod tip;
use ansi_term::{
unstyle,... |
rust_dataset_chunk_510353 | rust_dataset.txt | 510,353 | 512 | ClientState {
fn session_hints(&self) -> session_hints::SessionHints {
let back_keys = session_hints::back_keys_text(&self.mode_info);
session_hints::compute_session_hints(
self.history.as_ref(),
self.global.as_ref(),
self.focused_pane.as_ref(),
back_... |
rust_dataset_chunk_510354 | rust_dataset.txt | 510,354 | 512 | desktop_integration::IntegrationState>,
requested: bool,
decided: bool,
until_ms: Option<u64>,
}
impl DesktopOffer {
fn active(&self, now_ms: u64) -> bool {
self.until_ms.map(|until| now_ms < until).unwrap_or(false)
}
}
fn pane_is_out_of_view(client: &ClientState, pane_id: &PaneId) -> bool... |
rust_dataset_chunk_510355 | rust_dataset.txt | 510,355 | 512 | += padding_len;
for click in self.clicks.iter_mut() {
*click = click.shifted(padding_len);
}
}
}
impl Display for LinePart {
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
write!(f, "{}", self.part)
}
}
#[derive(Clone, Copy)]
pub struct ColoredElements {
p... |
rust_dataset_chunk_510356 | rust_dataset.txt | 510,356 | 512 | style!(
palette.ribbon_selected.emphasis_0,
palette.ribbon_selected.background
)
.bold(),
char_right_separator: style!(
palette.ribbon_selected.base,
palette.ribbon_selected.background
)
.bold(),... |
rust_dataset_chunk_510357 | rust_dataset.txt | 510,357 | 512 | },
superkey_prefix: style!(foreground, background).bold(),
superkey_suffix_separator: style!(background, background),
}
}
impl StatusBar {
pub fn has_slots(&self) -> bool {
!self.slots.is_empty()
}
pub fn take_timer_requests(&mut self) -> Vec<f64> {
std::mem::ta... |
rust_dataset_chunk_510358 | rust_dataset.txt | 510,358 | 512 | ints::now_ms() + session_hints::SWITCH_HINT_MS);
self.timer_requests
.push(session_hints::SWITCH_HINT_MS as f64 / 1000.0 + 0.2);
request_desktop_integration(&desktop_integration::Request::SetFlag(
desktop_integration::Flag::DesktopAppIntroduced,
... |
rust_dataset_chunk_510359 | rust_dataset.txt | 510,359 | 512 | .keys().copied().collect(),
};
let mut should_render = false;
for client_id in target_clients {
if self.update_client(event, client_id, context.slot_id) {
should_render = true;
}
}
if !should_render {
RenderResponse::Nothing
... |
rust_dataset_chunk_510360 | rust_dataset.txt | 510,360 | 512 | client.history = Some(history.clone());
},
Event::Timer(_) => {
should_render = client.history.is_some();
},
Event::CopyToClipboard(copy_destination) => {
let copy_destination = *copy_destination;
match client.text_copy_des... |
rust_dataset_chunk_510361 | rust_dataset.txt | 510,361 | 512 | true;
self.timer_requests
.push(session_hints::DONE_HINT_MS as f64 / 1000.0 + 0.2);
}
should_render
}
pub fn render(
&mut self,
rows: usize,
cols: usize,
slot_id: SlotId,
client_id: ClientId,
keybinds: &mut KeybindStor... |
rust_dataset_chunk_510362 | rust_dataset.txt | 510,362 | 512 | ed(hovered, || {
session_hints::with_session_hints(hints.clone(), || {
one_line_ui(
&client.mode_info,
active_tab,
cols,
separator,
clie... |
rust_dataset_chunk_510363 | rust_dataset.txt | 510,363 | 512 | u{1b}[48;2;{};{};{}m\u{1b}[0K", first_line, r, g, b);
} else {
print!("\u{1b}[m{}\u{1b}[0K", second_line);
}
}
},
PaletteColor::EightBit(color) => {
if rows > 1 {
println!("{}\u{1b... |
rust_dataset_chunk_510364 | rust_dataset.txt | 510,364 | 512 | loating_panes_visible {
match client.mode_info.mode {
InputMode::Normal => floating_panes_are_visible(&client.mode_info),
InputMode::Locked => {
locked_floating_panes_are_visible(&client.mode_info.style.colors)
},
_ => keybi... |
rust_dataset_chunk_510365 | rust_dataset.txt | 510,365 | 512 | }
let text_color = palette_match!(palette.text_unselected.base);
let green_color = palette_match!(palette.text_unselected.emphasis_2);
let orange_color = palette_match!(palette.text_unselected.emphasis_0);
let mut ret = vec![];
let common_modifiers = get_common_modifiers(keyvec.iter().collect());... |
rust_dataset_chunk_510366 | rust_dataset.txt | 510,366 | 512 | => "",
_ => "|",
};
for (idx, key) in key.iter().enumerate() {
if idx > 0 && !key_separator.is_empty() {
if let Some(background) = background {
let background = palette_match!(background);
ret.push(
Style::new()
... |
rust_dataset_chunk_510367 | rust_dataset.txt | 510,367 | 512 | {
let keyvec = vec![
KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(),
KeyWithModifier::new(BareKey::Char('b')).with_ctrl_modifier(),
KeyWithModifier::new(BareKey::Char('c')).with_ctrl_modifier(),
];
let ret = get_common_modifiers(keyvec.iter().c... |
rust_dataset_chunk_510368 | rust_dataset.txt | 510,368 | 512 | Char('f')), vec![Action::Quit])];
let ret = action_key(keymap, &[Action::Quit, Action::ScrollUp]);
assert_eq!(ret, Vec::new());
}
#[test]
fn action_key_simple_pattern_match_pattern_empty() {
let keymap = &[(KeyWithModifier::new(BareKey::Char('f')), vec![Action::Quit])];
let ... |
rust_dataset_chunk_510369 | rust_dataset.txt | 510,369 | 512 | _string())
}
#[test]
fn style_key_with_modifier_special_group_hjkl() {
let keyvec = vec![
KeyWithModifier::new(BareKey::Char('h')),
KeyWithModifier::new(BareKey::Char('j')),
KeyWithModifier::new(BareKey::Char('k')),
KeyWithModifier::new(BareKey::Char(... |
rust_dataset_chunk_510370 | rust_dataset.txt | 510,370 | 512 | Key::Char('a')).with_ctrl_modifier(),
KeyWithModifier::new(BareKey::Char('b')).with_ctrl_modifier(),
KeyWithModifier::new(BareKey::Char('c')).with_ctrl_modifier(),
KeyWithModifier::new(BareKey::Char('d')).with_ctrl_modifier(),
];
let palette = Styling::default();
... |
rust_dataset_chunk_510371 | rust_dataset.txt | 510,371 | 512 | c')),
];
let palette = Styling::default();
let ret = style_key_with_modifier(&keyvec, &palette, None);
let ret = unstyle(&ANSIStrings(&ret));
assert_eq!(ret, "<Alt a|Ctrl b|c>".to_string())
}
#[test]
fn style_key_with_modifier_unprintables() {
let keyvec = ... |
rust_dataset_chunk_510372 | rust_dataset.txt | 510,372 | 512 | ).with_alt_modifier(),
];
let palette = Styling::default();
let ret = style_key_with_modifier(&keyvec, &palette, None);
let ret = unstyle(&ANSIStrings(&ret));
assert_eq!(ret, "Alt + <ENTER|SPACE|TAB>".to_string())
}
}
#[cfg(test)]
mod hover_tests {
use super::*;
f... |
rust_dataset_chunk_510373 | rust_dataset.txt | 510,373 | 512 | assert!(bar.update_client(&Event::Mouse(Mouse::Hover(0, lock_col)), 1, Some(0)));
assert_eq!(bar.clients[&1].hovered, Some(to_mode(InputMode::Locked)));
bar.update_client(&Event::Mouse(Mouse::LeftClick(0, lock_col)), 1, Some(0));
bar.update_client(&Event::ModeUpdate(mode_info(InputMode::Locked... |
rust_dataset_chunk_510374 | rust_dataset.txt | 510,374 | 512 | _bar::second_line::{
ascended_to_host_session_hint, descended_into_nested_session_hint, system_clipboard_error,
text_copied_hint,
};
use crate::status_bar::{
action_key, action_key_group, bars_hint, color_elements, MORE_MSG, TO_NORMAL,
};
use crate::status_bar::{ColoredElements, LinePart};
use zellij_tile::... |
rust_dataset_chunk_510375 | rust_dataset.txt | 510,375 | 512 | InputMode) -> Action {
Action::SwitchToMode {
input_mode: base_mode,
}
}
fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<KeyShortcut>> {
let locked_binds = &help.get_keybinds_for_mode(InputMode::Locked);
let normal_binds = &help.get_keybinds_for_mode(InputMode::N... |
rust_dataset_chunk_510376 | rust_dataset.txt | 510,376 | 512 | to_char(action_key(
normal_binds,
&[Action::SwitchToMode {
input_mode: InputMode::Move,
}],
)),
),
KeyShortcut::new(
KeyMode::Un... |
rust_dataset_chunk_510377 | rust_dataset.txt | 510,377 | 512 | &[Action::SwitchToMode {
input_mode: InputMode::Normal,
}],
)),
),
],
),
(
InputMode::Move,
vec![
KeyShortcut::new(
KeyMode::Selected,
... |
rust_dataset_chunk_510378 | rust_dataset.txt | 510,378 | 512 | .get_keybinds_for_mode(InputMode::Move);
let scroll_binds = &help.get_keybinds_for_mode(InputMode::Scroll);
let session_binds = &help.get_keybinds_for_mode(InputMode::Session);
HashMap::from([
(
InputMode::Locked,
vec![KeyShortcut::new(
KeyMode::Selected,
... |
rust_dataset_chunk_510379 | rust_dataset.txt | 510,379 | 512 | Mode::UnselectedAlternate,
KeyAction::Quit,
to_char(action_key(normal_binds, &[Action::Quit])),
),
],
),
(
InputMode::Pane,
vec![KeyShortcut::new(
KeyMode::Selected,
KeyAction::Pan... |
rust_dataset_chunk_510380 | rust_dataset.txt | 510,380 | 512 | help.session_dimmed.unwrap_or(false),
);
let default_keys = if base_mode_is_locked {
base_mode_locked_mode_indicators(help)
} else {
base_mode_normal_mode_indicators(help)
};
match common_modifiers_in_all_modes(&default_keys) {
Some(modifiers) => {
if let ... |
rust_dataset_chunk_510381 | rust_dataset.txt | 510,381 | 512 | _common_modifiers: &Vec<KeyShortcut>,
help: &ModeInfo,
stripped_modifiers: &[KeyModifier],
) -> LinePart {
let mut full_shortcut_list = LinePart::default();
for key in keys_without_common_modifiers {
let is_selected = key.is_selected();
let shortcut = add_shortcut_with_inline_key(
... |
rust_dataset_chunk_510382 | rust_dataset.txt | 510,382 | 512 | vec![]),
is_selected,
Some(3),
));
}
shortened_shortcut_list
}
fn common_modifiers_in_all_modes(
key_shortcuts: &HashMap<InputMode, Vec<KeyShortcut>>,
) -> Option<Vec<KeyModifier>> {
let Some(mut common_modifiers) = key_shortcuts.iter().next().and_then(|k| {
k.1... |
rust_dataset_chunk_510383 | rust_dataset.txt | 510,383 | 512 | {
serialize_text(&Text::from(prefix_text).opaque())
};
let suffix_separator = palette.superkey_suffix_separator.paint(separator);
line_part_to_render.part =
format!("{}{}{}", line_part_to_render.part, prefix, suffix_separator);
line_part_to_render.len += prefix_text_len + display_width(... |
rust_dataset_chunk_510384 | rust_dataset.txt | 510,384 | 512 | padding_len = 0;
for _ in 0..remaining_space {
padding.push_str(&ANSIStrings(&[colored_elements.superkey_prefix.paint(" ")]).to_string());
padding_len += 1;
}
secondary_info.prepend_padding(&padding, padding_len);
if secondary_info.len <= max_len {
Some(secondary_info)
} els... |
rust_dataset_chunk_510385 | rust_dataset.txt | 510,385 | 512 | crease_key = resize_decrease_action_key
.iter()
.find(|k| k.bare_key == BareKey::Char('-'))
.or_else(|| resize_decrease_action_key.iter().next());
let mut resize_shortcuts = vec![];
if let Some(resize_increase_key) = resize_increase_key {
resize_shortcuts.push(resize_increase_key... |
rust_dataset_chunk_510386 | rust_dataset.txt | 510,386 | 512 | .bare_key == BareKey::Right)
.or_else(|| move_focus_left_action_key.iter().next());
if let Some(move_focus_left_key) = move_focus_left_key {
move_focus_shortcuts.push(move_focus_left_key.clone());
}
let toggle_floating_action_key = action_key(binds, &[Action::ToggleFloatingPanes]);
let ... |
rust_dataset_chunk_510387 | rust_dataset.txt | 510,387 | 512 | _string())
.collect::<Vec<_>>()
.join("-")
),
0,
help.session_dimmed.unwrap_or(false),
);
line.append(&modifier_str);
let strip = |keys: &Vec<KeyWithModifier>| -> Vec<KeyWithModifier> {
... |
rust_dataset_chunk_510388 | rust_dataset.txt | 510,388 | 512 | ).opaque())
};
LinePart {
part,
len: text_width,
..Default::default()
}
}
fn keybinds(help: &ModeInfo, max_width: usize) -> Option<LinePart> {
let full_shortcut_list = full_shortcut_list(help);
if full_shortcut_list.len <= max_width {
return Some(full_shortcut_list);... |
rust_dataset_chunk_510389 | rust_dataset.txt | 510,389 | 512 | whole: false,
key: targets.iter().position(target_is_hovered),
}
}
}
fn hint_clicks(
targets: &[Option<Vec<Action>>],
key_ranges: &[(usize, usize)],
total_len: usize,
) -> Vec<ClickRegion> {
if targets.len() == 1 {
return targets[0]
.clone()
... |
rust_dataset_chunk_510390 | rust_dataset.txt | 510,390 | 512 | ) in labels.iter().enumerate() {
if index > 0 {
body.push_str(&base.paint(key_separator).to_string());
}
let label_style = if hovered_key == Some(index) {
style!(
palette.ribbon_selected.base,
palette.ribbon_selected.background
... |
rust_dataset_chunk_510391 | rust_dataset.txt | 510,391 | 512 | ],
) -> LinePart {
let capabilities = help.capabilities;
let mut ret = LinePart::default();
if key.is_empty() {
return ret;
}
let targets = key_targets(help, &key, stripped_modifiers);
let hover = hint_hover(help, &targets);
let labels: Vec<String> = key.iter().map(|k| k.to_string(... |
rust_dataset_chunk_510392 | rust_dataset.txt | 510,392 | 512 | supports_arrow_fonts = !help.capabilities.arrow_fonts;
let ribbon = if hover.any() {
let palette = help.style.colors;
let hover = palette.ribbon_hover_style();
let body = style!(hover.emphasis_0, hover.background)
.bold()
.paint(format!(" {} ", key_string))
... |
rust_dataset_chunk_510393 | rust_dataset.txt | 510,393 | 512 | ", mode_help_text)));
ret.len += display_width(&mode_help_text) + 2;
}
bits.push(dim_style.paint(format!("{}", separator)));
bits.push(dim_style.paint(format!(" ")));
bits.push(dim_style.paint(format!("{}", separator)));
ret.part = format!("{}{}", ret.part, ANSIStrin... |
rust_dataset_chunk_510394 | rust_dataset.txt | 510,394 | 512 | fn full_shortcut_list_nonstandard_mode(help: &ModeInfo) -> LinePart {
let mut line_part = LinePart::default();
let keys_and_hints = get_keys_and_hints(help);
for (long, _short, keys) in keys_and_hints.into_iter() {
line_part.append(&add_shortcut(help, &long, &keys.to_vec(), false, Some(2)));
}
... |
rust_dataset_chunk_510395 | rust_dataset.txt | 510,395 | 512 | {direction: Dir::Up}], &[A::MoveFocus{direction: Dir::Right}]])),
(s("Close"), s("Close"), single_action_key(&km, &[A::CloseFocus, TO_NORMAL])),
(s("Rename"), s("Rename"),
single_action_key(&km, &[A::SwitchToMode{input_mode: IM::RenamePane}, A::PaneNameInput{input: vec![0]}])),
(s("T... |
rust_dataset_chunk_510396 | rust_dataset.txt | 510,396 | 512 | let focus_keys_full: Vec<KeyWithModifier> = action_key_group(&old_keymap,
&[&[A::GoToPreviousTab], &[A::GoToNextTab]]);
let focus_keys = if focus_keys_full.contains(&KeyWithModifier::new(BareKey::Left))
&& focus_keys_full.contains(&KeyWithModifier::new(BareKey::Right)) {
... |
rust_dataset_chunk_510397 | rust_dataset.txt | 510,397 | 512 | ![
(s("Increase/Decrease size"), s("Increase/Decrease"),
action_key_group(&km, &[
&[A::Resize{resize: Resize::Increase, direction: None}],
&[A::Resize{resize: Resize::Decrease, direction: None}]
])),
(s("Increase to"), s("Increase"), action_key_gro... |
rust_dataset_chunk_510398 | rust_dataset.txt | 510,398 | 512 | PageScrollUp],
&[Action::HalfPageScrollDown], &[Action::HalfPageScrollUp]])),
(s("Edit scrollback in default editor"), s("Edit"),
single_action_key(&km, &[Action::EditScrollback { ansi: false }, TO_NORMAL])),
(s("Select pane"), s("Select"), to_basemode_key),
(s("Scroll co... |
rust_dataset_chunk_510399 | rust_dataset.txt | 510,399 | 512 | option: SOpt::WholeWord}])),
]} else if mi.mode == IM::Session {
let hints = crate::status_bar::session_hints::session_hints();
let toggle_keys = crate::status_bar::session_hints::first_action_keys(&km, &A::ToggleSession);
let back_keys = crate::status_bar::session_hints::first_action_keys(&... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.