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_510800 | rust_dataset.txt | 510,800 | 512 | _x + 4;
let label = "[Uninstall]";
let uninstall = if Some(Row::Uninstall) == self.hovered {
Text::from(label).color_all(3)
} else {
Text::from(label).color_range(3, 1..label.len() - 1)
};
... |
rust_dataset_chunk_510801 | rust_dataset.txt | 510,801 | 512 | Checking this computer…").dim_all()));
blocks.push(Block::Text(Text::from("")));
},
(None, Some(error)) => {
for line in wrap(&format!("Desktop setup is not available: {}", error), width) {
blocks.push(Block::Text(Text::from(line).dim_all()));
... |
rust_dataset_chunk_510802 | rust_dataset.txt | 510,802 | 512 | >", "Don't Show Again", Row::Never));
}
blocks.push(Block::Buttons(buttons));
blocks
}
fn result_width(&self) -> usize {
self.outcomes
.iter()
.flat_map(|outcome| outcome_sections(&outcome.message))
.flat_map(|section| match section {
... |
rust_dataset_chunk_510803 | rust_dataset.txt | 510,803 | 512 | blocks
.push(Block::Text(Text::from(format!(" {}", wrapped)).dim_all()));
}
},
}
}
}
if let Some(error) = &self.status_error {
for wrapped in wrap(&format!("✗ ... |
rust_dataset_chunk_510804 | rust_dataset.txt | 510,804 | 512 | ;
while let Some(found) = text[search_from..].find(command) {
let byte_start = search_from + found;
let start = text[..byte_start].chars().count();
let end = start + command.chars().count();
if !ranges.iter().any(|(s, e)| start < *e && end > *s) {
... |
rust_dataset_chunk_510805 | rust_dataset.txt | 510,805 | 512 | ing => Some(files),
_ => None,
});
match existing {
Some(files) => files.push(file.to_owned()),
None => sections.push(OutcomeSection::Files(heading, vec![file.to_owned()])),
}
},
None if !... |
rust_dataset_chunk_510806 | rust_dataset.txt | 510,806 | 512 | StyledText::from(line.clone());
assert!(zellij_tile::graphemes::display_width(&styled.text) <= 40);
let indices = styled.indices.get(3).cloned().unwrap_or_default();
for (index, character) in styled.text.chars().enumerate() {
if indices.contains(&index) {
... |
rust_dataset_chunk_510807 | rust_dataset.txt | 510,807 | 512 | }
#[test]
fn an_app_of_ours_with_an_update_waiting_can_be_uninstalled() {
let out_of_date = ItemStatus {
available: true,
changeable: true,
owner: Owner::Zellij,
..ItemStatus::unavailable(Item::Launcher, "Zellij.app 0.46.0 is installed")
}
... |
rust_dataset_chunk_510808 | rust_dataset.txt | 510,808 | 512 | assert_eq!(words.uninstall_title(), "Uninstall Desktop Entry");
assert_eq!(words.uninstalled(), "✓ The desktop entry was uninstalled.");
assert_eq!(
words.not_uninstalled("busy"),
"✗ The desktop entry could not be uninstalled: busy"
);
assert_eq!(
wor... |
rust_dataset_chunk_510809 | rust_dataset.txt | 510,809 | 512 | .key)
}
pub fn is_previewing(&self, key: SettingKey) -> bool {
self.active_key() == Some(key)
}
fn restore_action(preview: &Preview) -> Option<PreviewAction> {
if preview.shown.as_deref() == Some(preview.shown_originally.as_str()) {
return None;
}
Some(if prev... |
rust_dataset_chunk_510810 | rust_dataset.txt | 510,810 | 512 | {
if dropped.contains(&preview.key) {
preview.original_was_unsaved = false;
preview.original = None;
preview.shown = None;
}
}
}
}
#[cfg(test)]
mod tests {
use super::*;
const UNSET: &str = "(not set)";
fn state(saved: O... |
rust_dataset_chunk_510811 | rust_dataset.txt | 510,811 | 512 | Action::Revert(SettingKey::Theme)]
);
assert_eq!(preview.restore(), None);
let mut preview = ThemePreview::default();
preview.highlight(SettingKey::Theme, "dracula", "default", Some(&unset), UNSET);
assert_eq!(
preview.restore(),
Some(PreviewAction::Revert... |
rust_dataset_chunk_510812 | rust_dataset.txt | 510,812 | 512 | ores_the_new_saved_value() {
let mut preview = ThemePreview::default();
let unsaved = state(Some("nord"), Some("gruvbox-dark"));
preview.highlight(
SettingKey::Theme,
"dracula",
"gruvbox-dark",
Some(&unsaved),
UNSET,
);
... |
rust_dataset_chunk_510813 | rust_dataset.txt | 510,813 | 512 | "nord".to_owned())
]
);
}
}
--- FILE: zellij/default-plugins/configuration/src/theme_sample.rs ---
use zellij_tile::prelude::*;
use zellij_utils::input::config_blocks::styling_from_colours;
const LABEL_WIDTH: usize = 12;
pub const SAMPLE_MIN_WIDTH: usize = LABEL_WIDTH + 40;
fn fg_code(colou... |
rust_dataset_chunk_510814 | rust_dataset.txt | 510,814 | 512 | ,
parts: &[(&str, Part)],
with_background: bool,
) -> &mut Self {
let bg = if with_background {
Some(declaration.background)
} else {
None
};
for (text, part) in parts {
let (fg, bold) = match part {
Part::Base => (d... |
rust_dataset_chunk_510815 | rust_dataset.txt | 510,815 | 512 | declaration.background),
Some(surrounding),
false,
);
}
}
const FRAMES_PER_ROW: usize = 3;
fn frame_lines(styling: &Styling, width: usize, stacked: bool) -> Vec<Line> {
let frames = [
("Pane", styling.frame_unselected),
("Focused", Some(styling.frame_selected)),... |
rust_dataset_chunk_510816 | rust_dataset.txt | 510,816 | 512 | line.styled(declaration, &with_emphasis(before, after), background);
line
}
const RIBBONS: usize = 2;
const FRAMES: usize = 5;
const PLAYERS: usize = 7;
const GROUP_COUNT: usize = 8;
const STACKABLE: [usize; 3] = [RIBBONS, FRAMES, PLAYERS];
fn sample_groups(
styling: &Styling,
width: usize,
arrows... |
rust_dataset_chunk_510817 | rust_dataset.txt | 510,817 | 512 | styled_line(width, &styling.table_title, "NAME ", " ", false),
styled_line(
width,
&styling.table_cell_unselected,
"notes.txt",
" ",
true,
),
styled_line(width, &styling.table_cell_selecte... |
rust_dataset_chunk_510818 | rust_dataset.txt | 510,818 | 512 | lines: users,
});
groups
}
const COLUMN_GAP: usize = 3;
const HEADER_ROWS: usize = 2;
const NATURAL_WIDTH: usize = 1000;
const MAX_COLUMNS: usize = 3;
const TIERS: [(usize, usize); 6] = [(1, 1), (2, 1), (1, 0), (2, 0), (3, 1), (3, 0)];
#[derive(Debug, Clone, Copy)]
struct Size {
width: usize,
height:... |
rust_dataset_chunk_510819 | rust_dataset.txt | 510,819 | 512 | fn tallest_column(&self, dims: &[Dims]) -> usize {
self.columns
.iter()
.map(|column| self.column_height(dims, column))
.max()
.unwrap_or(0)
}
}
fn stacking_choices() -> Vec<[bool; GROUP_COUNT]> {
let mut choices: Vec<[bool; GROUP_COUNT]> = (0..1usize <<... |
rust_dataset_chunk_510820 | rust_dataset.txt | 510,820 | 512 | ;
}
let better = match best {
None => true,
Some(current) => {
(layout.tallest_column(dims), layout.total_width())
< (current.tallest_column(dims), current.total_width())
},
};
if better {
*best = Some(la... |
rust_dataset_chunk_510821 | rust_dataset.txt | 510,821 | 512 | Preview (e0-e3 show the emphasis colors)",
width,
))
.color_range(2, ..7)
.dim_range(7..),
x,
y,
None,
None,
);
let styling = styling_from_colours(colours);
let rows = height.saturating_sub(HEADER_ROWS);
let dims = group_dims(&styling, ... |
rust_dataset_chunk_510822 | rust_dataset.txt | 510,822 | 512 | {
assert!(layout.total_width() <= width);
assert!(layout.tallest_column(dims) <= rows);
let mut shown: Vec<usize> = layout
.columns
.iter()
.flat_map(|column| column.groups.clone())
.collect();
shown.sort();
assert_eq!(shown, (0..G... |
rust_dataset_chunk_510823 | rust_dataset.txt | 510,823 | 512 | assert_eq!(layout.columns.len(), 1);
assert_eq!(layout.gap, 1);
}
}
--- FILE: zellij/default-plugins/configuration/src/themes_screen.rs ---
use std::collections::BTreeMap;
use zellij_tile::prelude::*;
use zellij_utils::input::config_blocks::{
colour_text, parse_colour, styling_colours, theme_slots, ... |
rust_dataset_chunk_510824 | rust_dataset.txt | 510,824 | 512 | ThemeSource) -> &'static str {
match source {
ThemeSource::BuiltIn => "built in",
ThemeSource::ConfigFile => "config file",
ThemeSource::ThemeFolder => "theme folder",
}
}
fn source_heading(source: ThemeSource) -> &'static str {
match source {
ThemeSource::BuiltIn => "Built... |
rust_dataset_chunk_510825 | rust_dataset.txt | 510,825 | 512 | 1 => " · Ctrl e fixes the 1 color below 3:1".to_owned(),
count => format!(" · Ctrl e fixes all {} colors below 3:1", count),
};
if let Some(Some(found)) = contrasts.get(focused) {
if found.ratio < found.target {
let better = suggest_for_all(found.foreground, &found.backgrounds());
... |
rust_dataset_chunk_510826 | rust_dataset.txt | 510,826 | 512 | );
Some(styled_advice(text, width, None, None))
}
fn swatch(colour: &str, x: usize, y: usize) {
let escape = match parse_colour(colour) {
Some(PaletteColor::Rgb((r, g, b))) => format!("\u{1b}[38;2;{};{};{}m", r, g, b),
Some(PaletteColor::EightBit(index)) => format!("\u{1b}[38;5;{}m", index),
... |
rust_dataset_chunk_510827 | rust_dataset.txt | 510,827 | 512 | .push((2, 2, 0..active.chars().count()));
}
}
styles
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum Focus {
Search,
Filter,
List,
}
#[derive(Debug, Clone, PartialEq)]
enum NamePurpose {
New,
Rename(String),
}
struct NameForm {
purpose: NamePurpose,
input: TextInput,
... |
rust_dataset_chunk_510828 | rust_dataset.txt | 510,828 | 512 | search_mode(),
filter: Dropdown::new(
Text::from("Source").color_all(0),
vec![ALL_SOURCES.to_owned()],
)
.label_width(SHORT_LABEL_WIDTH)
.accent_brackets(),
scroll: RowScroll::default(),
new_button: Button::new(NEW_T... |
rust_dataset_chunk_510829 | rust_dataset.txt | 510,829 | 512 | .options() != options.as_slice() {
let current = self.filter.selected_value().map(|label| label.to_owned());
let index = current
.and_then(|current| options.iter().position(|option| *option == current))
.unwrap_or(0);
self.filter.set_options(options);
... |
rust_dataset_chunk_510830 | rust_dataset.txt | 510,830 | 512 | _themes
.iter()
.all(|theme| self.saved.iter().any(|saved| saved == theme));
if matches_saved {
self.effects.push(Effect::Revert(SettingKey::Themes));
} else {
self.effects
.push(Effect::ReplaceBlocks(themes_kdl(&config_themes)));
... |
rust_dataset_chunk_510831 | rust_dataset.txt | 510,831 | 512 | iter()
.find(|theme| theme.name == from)
.map(|theme| source_text(theme.source))
.unwrap_or("built in");
let question = format!(
"{} is {} and cannot be changed. Make an editable copy of it as a new file in the theme folder?",
from,
match s... |
rust_dataset_chunk_510832 | rust_dataset.txt | 510,832 | 512 | ().len())
.map(|index| {
form.inputs
.text_input(&index)
.map(|input| input.get_text().trim().to_owned())
.unwrap_or_default()
})
.collect()
}
fn edited_colours(form: &ColourForm) -> Result<Vec<String... |
rust_dataset_chunk_510833 | rust_dataset.txt | 510,833 | 512 | ());
if let Some(input) = form.inputs.text_input_mut(&index) {
input.set_text(colour_text(&better));
fixed += 1;
}
}
self.notice = Some(match (focused_only, fixed) {
(true, 0) => "This color already has enough contrast".to_owned(),
... |
rust_dataset_chunk_510834 | rust_dataset.txt | 510,834 | 512 | ::Rename(from) => from.clone(),
};
self.name_form = Some(NameForm {
purpose,
input: TextInput::new(initial)
.label("Name")
.label_width(6)
.focused(),
error: None,
});
}
fn apply_name(&mut self) {
... |
rust_dataset_chunk_510835 | rust_dataset.txt | 510,835 | 512 | : None,
});
},
NamePurpose::Rename(from) => {
for theme in config_themes.iter_mut() {
if theme.name == from {
theme.name = name.clone();
}
}
if from == self.active {
... |
rust_dataset_chunk_510836 | rust_dataset.txt | 510,836 | 512 | other {} in that file stay{}.",
theme.name,
path,
if others == 1 { "theme" } else { "themes" },
if others == 1 { "s" } else { "" }
)
};
let name_start = "Delete the theme ".chars().count();
let name_end = name_start + t... |
rust_dataset_chunk_510837 | rust_dataset.txt | 510,837 | 512 | },
}
}
fn revert_selected(&mut self) {
let Some(theme) = self.selected_theme() else {
return;
};
if !self.is_unsaved(&theme) {
self.notice = Some("Nothing to revert".to_owned());
return;
}
let mut config_themes: Vec<... |
rust_dataset_chunk_510838 | rust_dataset.txt | 510,838 | 512 | count {
self.selected += 1;
}
} else if is_plain(key, BareKey::Up) {
if self.selected == 0 {
self.focus = if self.searching() {
Focus::Search
} else {
Focus::Filter
};
} e... |
rust_dataset_chunk_510839 | rust_dataset.txt | 510,839 | 512 | return PageResponse::LeaveToMenu;
}
if is_plain(key, BareKey::Esc) {
return PageResponse::Close;
}
if typed(key, 'a') {
self.open_name_form(NamePurpose::New);
return PageResponse::Handled;
}
match self.filter.handle_key(key)... |
rust_dataset_chunk_510840 | rust_dataset.txt | 510,840 | 512 | form.inputs.handle_mouse(mouse).is_handled();
buttons_changed || inputs_changed || !matches!(mouse, Mouse::Hover(..))
}
fn handle_name_mouse(&mut self, mouse: Mouse) -> bool {
let Some(form) = self.name_form.as_mut() else {
return false;
};
let input_changed = form.i... |
rust_dataset_chunk_510841 | rust_dataset.txt | 510,841 | 512 | }
}
if let Some((line, column)) = is_click(&mouse) {
if self.link_at(line, column) {
self.open_config_file();
return PageResponse::Handled;
}
}
if let Mouse::Hover(line, column) = mouse {
let hovered = !under_overlay(li... |
rust_dataset_chunk_510842 | rust_dataset.txt | 510,842 | 512 | ::new(path), None, BTreeMap::new());
}
}
fn render_path(&mut self, x: usize, y: usize, width: usize) {
self.link_area = None;
self.link_target = None;
let target = match self.selected_theme() {
Some(theme) if theme.source == ThemeSource::ConfigFile => {
... |
rust_dataset_chunk_510843 | rust_dataset.txt | 510,843 | 512 | .render(x, y + 2, SHORT_FIELD_WIDTH.min(width));
if BESIDE_SHORT_FIELD + self.new_button.natural_width() <= width {
self.new_button.render(x + BESIDE_SHORT_FIELD, y + 2);
} else {
self.new_button.clear_area();
}
4
};
let ent... |
rust_dataset_chunk_510844 | rust_dataset.txt | 510,844 | 512 | styles) = &rows[index];
let look = RowLook::new(
cursor_shown && index == self.selected,
self.scroll.is_hovered(index),
);
layout.print_styled(columns, marker, x, screen_y, row_width, look, styles);
}
}
}
impl Page for ThemesScreen {
... |
rust_dataset_chunk_510845 | rust_dataset.txt | 510,845 | 512 | .link_area = None;
form.input.set_show_cursor(true);
form.input.render(x, y + 2, width.min(50));
self.form_buttons.render(x, y + 4, width);
if let Some(error) = &form.error {
print_text_with_coordinates(
Text::from(truncate(error, width... |
rust_dataset_chunk_510846 | rust_dataset.txt | 510,846 | 512 | visible {
let Some(row) = form.scroll.screen_row(index) else {
continue;
};
let is_focused = index == focused;
if let Some(input) = form.inputs.text_input_mut(&index) {
input.set_show_cursor(is_focused);
... |
rust_dataset_chunk_510847 | rust_dataset.txt | 510,847 | 512 | _overlay(rows, cols);
note_dropdown(&self.filter);
}
}
fn handle_mouse(&mut self, mouse: Mouse) -> PageResponse {
let changed = if self.colour_form.is_some() {
self.handle_colour_mouse(mouse)
} else if self.name_form.is_some() {
self.handle_name_mouse(... |
rust_dataset_chunk_510848 | rust_dataset.txt | 510,848 | 512 | () {
return vec![("<Enter>", "confirm"), ("<Esc>", "cancel")];
}
match self.focus {
Focus::Search => vec![
("<type>", "search themes"),
("<↓>", "results"),
("<Esc>", "clear"),
],
Focus::Filter => vec![
... |
rust_dataset_chunk_510849 | rust_dataset.txt | 510,849 | 512 | _colours(&DEFAULT_STYLES);
colours[0] = first.to_owned();
ThemeEntry {
name: name.to_owned(),
source,
colours,
file_path: None,
}
}
fn folder_theme(name: &str, path: &str) -> ThemeEntry {
ThemeEntry {
file_path: Some(pa... |
rust_dataset_chunk_510850 | rust_dataset.txt | 510,850 | 512 | COPY_NAME_FIELD.to_owned(),
PromptValue::Text(name.to_owned()),
);
PromptResult::Answered(PromptValue::Form(values))
}
#[test]
fn the_list_shows_where_each_theme_comes_from() {
let screen = screen();
assert_eq!(screen.themes[0].name, "mine");
assert_eq!(... |
rust_dataset_chunk_510851 | rust_dataset.txt | 510,851 | 512 | unwrap();
assert_ne!(first_request, second_request);
assert_eq!(from, "dracula");
assert!(screen.prompt_result(second_request, &name_answer(" ")));
assert!(screen.pending_copy.is_some());
assert!(screen.take_effects().is_empty());
}
#[test]
fn cancelling_the_copy_po... |
rust_dataset_chunk_510852 | rust_dataset.txt | 510,852 | 512 | key(BareKey::Up));
screen.handle_key(&key(BareKey::End));
screen.handle_key(&key(BareKey::Backspace));
type_text(&mut screen, "1");
screen.take_effects();
screen.handle_key(&ctrl('a'));
assert!(screen.colour_form.is_none());
assert!(matches!(
screen.ta... |
rust_dataset_chunk_510853 | rust_dataset.txt | 510,853 | 512 | cean.kdl");
changed.colours[0] = "#abcdef".to_owned();
changed.colours[1] = "#fedcba".to_owned();
screen.set_themes(vec![changed], vec![], "default".to_owned(), false);
assert_eq!(input_text(&screen, 0), "#abcdef");
assert_eq!(input_text(&screen, 1), "#111111");
assert!(s... |
rust_dataset_chunk_510854 | rust_dataset.txt | 510,854 | 512 | to_owned(), false);
screen.handle_key(&key(BareKey::Enter));
screen
}
#[test]
fn ctrl_f_raises_the_contrast_of_the_focused_color() {
let mut screen = low_contrast_screen();
screen.handle_key(&ctrl('f'));
let fixed = parse_colour(&input_text(&screen, 0)).unwrap();
... |
rust_dataset_chunk_510855 | rust_dataset.txt | 510,855 | 512 | | c.set(true));
}
}
pub fn take_close_request() -> bool {
CLOSE_REQUESTED.with(|c| c.replace(false))
}
pub fn print_link(link: &str, x: usize, y: usize, color: Option<PaletteColor>, hovered: bool) {
let color = match color {
Some(PaletteColor::Rgb((r, g, b))) => format!("\u{1b}[38;2;{};{};{}m", r,... |
rust_dataset_chunk_510856 | rust_dataset.txt | 510,856 | 512 | loating =>
{
return ItemState::Hidden;
},
ContextMenuAction::ClickedPane(
ClickedPaneAction::ToggleMute
| ClickedPaneAction::ToggleWatch
| ClickedPaneAction::ToggleIgnoreOutput
| ClickedPaneAction::PasteF... |
rust_dataset_chunk_510857 | rust_dataset.txt | 510,857 | 512 | .push(None);
}
},
ContextMenuEntry::Item { label, actions, .. } => {
let state = item_state(actions, context);
if state == ItemState::Hidden {
continue;
}
let mut i... |
rust_dataset_chunk_510858 | rust_dataset.txt | 510,858 | 512 | {
let Some(menu) = self.menu.as_mut() else {
if key.is_key_without_modifier(BareKey::Esc) {
close_self();
}
return false;
};
let response = menu.handle_key(&key);
self.handle_response(response)
}
fn handle_mouse(&mut self, mous... |
rust_dataset_chunk_510859 | rust_dataset.txt | 510,859 | 512 | new(BareKey::Char(c)).with_alt_modifier()
}
fn pane(action: ClickedPaneAction) -> ContextMenuAction {
ContextMenuAction::ClickedPane(action)
}
fn tab(action: ClickedTabAction) -> ContextMenuAction {
ContextMenuAction::ClickedTab(action)
}
#[test]
fn items_for_the_clicked_p... |
rust_dataset_chunk_510860 | rust_dataset.txt | 510,860 | 512 | (k, v)| (k.to_string(), v.to_string()))
.collect();
Action::LaunchOrFocusPlugin {
plugin: RunPluginOrAlias::Alias(PluginAlias::new(name, &Some(configuration), None)),
should_float,
move_to_focused_tab: true,
should_open_in_place: false,
clo... |
rust_dataset_chunk_510861 | rust_dataset.txt | 510,861 | 512 | _pane_bindings() {
let mode_info = mode_info(InputMode::Normal);
assert_eq!(
shortcut_for(
&mode_info,
&[pane(ClickedPaneAction::ToggleFocusFullscreen)]
),
Some("Ctrl p, f".to_owned())
);
assert_eq!(
shortcut... |
rust_dataset_chunk_510862 | rust_dataset.txt | 510,862 | 512 | (None).into()]),
Some("Alt n".to_owned())
);
assert_eq!(
shortcut_for(&mode_info, &[new_pane(Some(Direction::Down)).into()]),
None
);
}
#[test]
fn shortcuts_follow_mode_switches_from_the_base_mode() {
let mut mode_info = mode_info(InputMod... |
rust_dataset_chunk_510863 | rust_dataset.txt | 510,863 | 512 | configuration: BTreeMap<String, String>,
slots: BTreeMap<SlotId, Slot>,
removed_slots: Vec<SlotId>,
clients: BTreeSet<ClientId>,
disconnected_clients: Vec<ClientId>,
key_events: Vec<(Option<SlotId>, Option<ClientId>)>,
self_command_results: Vec<String>,
permission_result: Option<String>,... |
rust_dataset_chunk_510864 | rust_dataset.txt | 510,864 | 512 | self, slot_id: SlotId) {
self.slots.remove(&slot_id);
self.removed_slots.push(slot_id);
}
fn client_connected(&mut self, client_id: ClientId) {
self.clients.insert(client_id);
}
fn client_disconnected(&mut self, client_id: ClientId) {
self.clients.remove(&client_id);
... |
rust_dataset_chunk_510865 | rust_dataset.txt | 510,865 | 512 | "register_settings_entry" => {
register_settings_entry("Shared settings");
RenderResponse::Nothing
},
"panic" => panic!("the shared fixture was asked to panic"),
"close_first_slot" => {
if let Some(slot_id) = self.slots.keys... |
rust_dataset_chunk_510866 | rust_dataset.txt | 510,866 | 512 | "open_window",
'm' => "write",
'n' => "send_key",
'o' => "mute",
'p' => "ignore_output",
'q' => "watch",
_ => "focus",
}
}
#[cfg(target_family = "wasm")]
fn run_session_pane_command(command: &str, session: &str, pane: PaneId) {
match command {
"mark_seen... |
rust_dataset_chunk_510867 | rust_dataset.txt | 510,867 | 512 | port", "Port").default_value(8080),
]),
"prompt_input_timeout" => {
let request =
PromptRequest::input("Name").timeout(std::time::Duration::from_secs(1));
match args.get("default") {
Some(default) => request.default(default.... |
rust_dataset_chunk_510868 | rust_dataset.txt | 510,868 | 512 | , "rows", 10),
resize_allowed: args.get("resize").map(|resize| resize == "true"),
view_only: args.get("view_only").map(|v| v == "true").unwrap_or(false),
};
set_live_view(Some(view.clone()));
self.live_view = Some(view);
... |
rust_dataset_chunk_510869 | rust_dataset.txt | 510,869 | 512 | !("mouse={:?}", mouse));
true
},
Event::PastedText(text) => {
self.live_view_input = Some(format!("paste={}", text));
true
},
_ => false,
}
}
fn render_live_view_fixture(&self, rows: usize, cols: usize) {
... |
rust_dataset_chunk_510870 | rust_dataset.txt | 510,870 | 512 | }
}
#[allow(dead_code)] // used when compiled as wasm plugin, not in native test target
#[derive(Default, Serialize, Deserialize)]
struct TestWorker {
number_of_messages_received: usize,
}
impl<'de> ZellijWorker<'de> for TestWorker {
fn on_message(&mut self, message: String, payload: String) {
if mes... |
rust_dataset_chunk_510871 | rust_dataset.txt | 510,871 | 512 | let should_subscribe_mode_update = configuration
.get("subscribe_mode_update")
.map(|v| v == "true")
.unwrap_or(false);
let should_subscribe_nested_session_events = configuration
.get("subscribe_nested_session_events")
.map(|v| v == "true")
... |
rust_dataset_chunk_510872 | rust_dataset.txt | 510,872 | 512 | b') if key.has_no_modifiers() => {
new_tabs_with_layout(
"layout {
tab {
pane
pane
}
tab split_direction=\"vertical\" {
... |
rust_dataset_chunk_510873 | rust_dataset.txt | 510,873 | 512 | ') if key.has_no_modifiers() => clear_screen(),
BareKey::Char('t') if key.has_no_modifiers() => scroll_up(),
BareKey::Char('u') if key.has_no_modifiers() => scroll_down(),
BareKey::Char('v') if key.has_no_modifiers() => scroll_to_top(),
BareKey::Char('w') ... |
rust_dataset_chunk_510874 | rust_dataset.txt | 510,874 | 512 | ('e') if key.has_only_modifiers(&[KeyModifier::Ctrl]) => {
let tab_index = 2;
go_to_tab(tab_index)
},
BareKey::Char('f') if key.has_only_modifiers(&[KeyModifier::Ctrl]) => {
let plugin_url = "file:/path/to/my/plugin.wasm";
... |
rust_dataset_chunk_510875 | rust_dataset.txt | 510,875 | 512 | _pane(
CommandToRun {
path: std::path::PathBuf::from("/path/to/my/file.rs"),
args: vec!["arg1".to_owned(), "arg2".to_owned()],
..Default::default()
},
BTreeMap::new... |
rust_dataset_chunk_510876 | rust_dataset.txt | 510,876 | 512 | ifiers(&[KeyModifier::Ctrl]) => {
rename_plugin_pane(1, "new plugin_pane_name");
},
BareKey::Char('x') if key.has_only_modifiers(&[KeyModifier::Ctrl]) => {
rename_tab(1, "new tab name");
},
BareKey::Char('z') if key.... |
rust_dataset_chunk_510877 | rust_dataset.txt | 510,877 | 512 | Key::Char('5') if key.has_only_modifiers(&[KeyModifier::Ctrl]) => {
switch_session(Some("my_new_session"));
},
BareKey::Char('6') if key.has_only_modifiers(&[KeyModifier::Ctrl]) => {
disconnect_other_clients()
},
Bar... |
rust_dataset_chunk_510878 | rust_dataset.txt | 510,878 | 512 | Modifier::Alt]) => {
rerun_command_pane(1);
},
BareKey::Char('e') if key.has_only_modifiers(&[KeyModifier::Alt]) => {
resize_pane_with_id(
ResizeStrategy::new(Resize::Increase, Some(Direction::Left)),
... |
rust_dataset_chunk_510879 | rust_dataset.txt | 510,879 | 512 | [KeyModifier::Alt]) => {
page_scroll_up_in_pane_id(PaneId::Terminal(2));
},
BareKey::Char('q') if key.has_only_modifiers(&[KeyModifier::Alt]) => {
page_scroll_down_in_pane_id(PaneId::Terminal(2));
},
BareKey::Char('r... |
rust_dataset_chunk_510880 | rust_dataset.txt | 510,880 | 512 | g')).with_ctrl_modifier(),
),
(
InputMode::Normal,
KeyWithModifier::new(BareKey::Char('g')).with_ctrl_modifier(),
),
(
InputMode::Pane,
... |
rust_dataset_chunk_510881 | rust_dataset.txt | 510,881 | 512 | }],
),
(
InputMode::Search,
KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(),
vec![actions::Action::SwitchToMode {
input_mode: InputMode::Lock... |
rust_dataset_chunk_510882 | rust_dataset.txt | 510,882 | 512 | test_pattern".to_string(),
style: HighlightStyle::Emphasis0,
layer: HighlightLayer::Hint,
context: BTreeMap::new(),
on_hover: false,
bold: false,
italic: true,
... |
rust_dataset_chunk_510883 | rust_dataset.txt | 510,883 | 512 | {
self.explicit_string_to_render =
Some(format!("Layout dump error: {}", e))
},
}
},
BareKey::Char('c')
if key.has_only_modifiers(&[KeyModifier::Ctrl, KeyModifier:... |
rust_dataset_chunk_510884 | rust_dataset.txt | 510,884 | 512 | _tab(0) {
Ok((kdl, metadata)) => {
self.explicit_string_to_render = Some(format!(
"Tab 0 layout: {} bytes, metadata: {:?}",
kdl.len(),
metadata
... |
rust_dataset_chunk_510885 | rust_dataset.txt | 510,885 | 512 | _kdl, false) {
Ok(_) => {
self.explicit_string_to_render = Some(format!("Save layout success"))
},
Err(e) => {
self.explicit_string_to_render =
Some(format!("Sa... |
rust_dataset_chunk_510886 | rust_dataset.txt | 510,886 | 512 | },
}
},
BareKey::Char('f')
if key.has_only_modifiers(&[KeyModifier::Ctrl, KeyModifier::Alt]) =>
{
// Test rename_layout() - not found case
match rename_layout("nonexist... |
rust_dataset_chunk_510887 | rust_dataset.txt | 510,887 | 512 | ("test_layout2", context) {
Ok(_) => {
self.explicit_string_to_render =
Some(format!("Edit layout command sent"))
},
Err(e) => {
self.explicit_string_to_render ... |
rust_dataset_chunk_510888 | rust_dataset.txt | 510,888 | 512 | ");
},
BareKey::Char('o')
if key.has_only_modifiers(&[KeyModifier::Ctrl, KeyModifier::Alt]) =>
{
unregister_settings_entry();
},
_ => {},
},
Event::NestedSessionModeUpdate {
... |
rust_dataset_chunk_510889 | rust_dataset.txt | 510,889 | 512 | is_for_this_user = pipe_message
.args
.get("only_client")
.map(|client_id| *client_id == get_plugin_ids().client_id.to_string())
.unwrap_or(true);
if is_for_this_user {
self.handle_live_view_message(&name, &pipe_message.args);
... |
rust_dataset_chunk_510890 | rust_dataset.txt | 510,890 | 512 | fn render(&mut self, rows: usize, cols: usize) {
if self.live_view_fixture() {
self.render_live_view_fixture(rows, cols);
} else if let Some(prompt_result) = self.prompt_result.as_ref() {
println!("{}", prompt_result);
} else if let Some(payload) = self.received_paylo... |
rust_dataset_chunk_510891 | rust_dataset.txt | 510,891 | 512 | (=) between node child arguments and their values. eg. { argument=\"value\" }")
},
}
}
#[derive(Clone)]
pub struct ErrorScreen {
pub message: String,
pub return_to_screen: Box<Screen>,
}
impl ErrorScreen {
pub fn handle_key(&mut self, _key: KeyWithModifier) -> KeyResponse {
KeyRespons... |
rust_dataset_chunk_510892 | rust_dataset.txt | 510,892 | 512 | _rows = rows.saturating_sub(header_height);
let available_cols = cols.saturating_sub(2); // Padding on sides
// Render error lines with middle truncation
let error_lines: Vec<&str> = self.detailed_error.lines().collect();
let total_lines = error_lines.len();
if total_lines <= a... |
rust_dataset_chunk_510893 | rust_dataset.txt | 510,893 | 512 | header_height + current_row + 1,
2,
truncated
);
current_row += 1;
}
}
}
}
--- FILE: zellij/default-plugins/layout-manager/src/main.rs ---
mod errors;
mod screens;
mod ui;
use errors::format_kdl_error;... |
rust_dataset_chunk_510894 | rust_dataset.txt | 510,894 | 512 | .builtin_sort_priority()
.cmp(&other.builtin_sort_priority())
{
std::cmp::Ordering::Equal => {
self.name().to_lowercase().cmp(&other.name().to_lowercase())
},
priority_order => priority_order,
}
}
fn compare_for_display(&self, oth... |
rust_dataset_chunk_510895 | rust_dataset.txt | 510,895 | 512 | _screen) => error_detail_screen.handle_key(key),
}
}
fn apply_key_response(&mut self, response: KeyResponse) -> bool {
let mut should_render = false;
if let Some(update) = response.optimistic_update {
self.apply_optimistic_update(update);
should_render = true;
... |
rust_dataset_chunk_510896 | rust_dataset.txt | 510,896 | 512 | .sort_by(|a, b| a.compare_for_display(b));
if let Screen::LayoutList(ref mut screen) = self.screen {
screen.update_selected_index(&self.display_layouts);
}
}
}
register_plugin!(State);
impl ZellijPlugin for State {
fn load(&mut self, _configuration: BTreeMap<String, String>) {
... |
rust_dataset_chunk_510897 | rust_dataset.txt | 510,897 | 512 | cols: usize) {
match &mut self.screen {
Screen::LayoutList(layout_list_screen) => {
layout_list_screen.render(&self.display_layouts, rows, cols)
},
Screen::NewLayoutFromSession(new_layout_from_session_screen) => {
new_layout_from_session_scree... |
rust_dataset_chunk_510898 | rust_dataset.txt | 510,898 | 512 | _escape_key(&mut self) -> KeyResponse {
if self.editing_name {
self.editing_name = false;
KeyResponse::render()
} else {
KeyResponse::new_screen(self.cancel_import())
}
}
fn handle_editing_mode_key(&mut self, key: KeyWithModifier) -> KeyResponse {
... |
rust_dataset_chunk_510899 | rust_dataset.txt | 510,899 | 512 | ::new_screen(Screen::LayoutList(LayoutListScreen::default()))
.with_optimistic(optimistic),
Err(error_msg) => KeyResponse::new_screen(self.create_error_screen(&error_msg)),
}
}
fn create_error_screen(&self, message: &str) -> Screen {
Screen::Error(ErrorScreen {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.