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_510200 | rust_dataset.txt | 510,200 | 512 | ![ComponentLine::new(vec![ActiveComponent::new(
TextOrCustomRender::Text(Text::from("show_startup_tips false").color_range(0, ..)),
)])])
.with_paragraph(vec![ComponentLine::new(vec![ActiveComponent::new(
TextOrCustomRender::Text(Text::from(HOME_MANAGER_NOTE)),
... |
rust_dataset_chunk_510201 | rust_dataset.txt | 510,201 | 512 | = Page::new_tip_screen(
self.link_executable.clone(),
self.base_mode.clone(),
self.tip_index,
);
}
}
--- FILE: zellij/default-plugins/about/src/onboarding.rs ---
use std::cell::RefCell;
use std::collections::BTreeMap;
use std::rc::Rc;
use zellij_tile::prelude::actions... |
rust_dataset_chunk_510202 | rust_dataset.txt | 510,202 | 512 | -> String {
mode_keys(base_mode, 'p', key)
}
fn esc_help() -> Text {
Text::from("Help: <ESC> - Go back").color_range(1, 6..=10)
}
fn command_line(command: &str) -> ComponentLine {
styled(Text::from(format!("$ {}", command)).color_substring(3, command))
}
fn text_piece(text: &str) -> ActiveComponent {
... |
rust_dataset_chunk_510203 | rust_dataset.txt | 510,203 | 512 | ellij: tray icon, default terminal and more",
));
let mut help = String::from("Help:");
if !facts.in_desktop_terminal {
help.push_str(" <w> - Open in a window,");
}
if facts.launcher_installable {
help.push_str(" <i> - Add to app menu,");
}
... |
rust_dataset_chunk_510204 | rust_dataset.txt | 510,204 | 512 | are done or have errored."),
])
.with_paragraph(vec![
ComponentLine::new(vec![
text_piece("The inbox integrates natively with the desktop "),
terminal,
text_piece(" and system tray."),
]),
... |
rust_dataset_chunk_510205 | rust_dataset.txt | 510,205 | 512 | color_range(0, ..),
)
.with_paragraph(vec![
line("Zellij now includes a configurable right-click menu, allowing quick actions"),
line(
"with a mouse click. The menu is contextual on terminal panes, tabs and stack",
),
... |
rust_dataset_chunk_510206 | rust_dataset.txt | 510,206 | 512 | color_range(1, 6..=10)
}))
}
pub fn new_repair(missing: &str, current: &str) -> Page {
let mut lines = vec![];
for wrapped in wrap(
&format!(
"Your Zellij launcher points to {}, which no longer exists. Point it at this copy ({})?",
missing... |
rust_dataset_chunk_510207 | rust_dataset.txt | 510,207 | 512 | Inbox and"),
line("Show Sessions, and Zellij can become your default terminal (Setup Zellij)."),
styled(Text::from(REMOTE_WARNING).dim_all()),
],
)
}
pub fn tip_inbox_keys(base_mode: Rc<RefCell<InputMode>>) -> Page {
let base_mode = *base_mode.borrow... |
rust_dataset_chunk_510208 | rust_dataset.txt | 510,208 | 512 | ],
)
}
pub fn tip_session_history(base_mode: Rc<RefCell<InputMode>>) -> Page {
let base_mode = *base_mode.borrow();
let back = session_mode_keys(base_mode, "Tab");
let left = session_mode_keys(base_mode, "Left");
let right = session_mode_keys(base_mode, "Right");
... |
rust_dataset_chunk_510209 | rust_dataset.txt | 510,209 | 512 | dl_for_binds(binds: &[(InputMode, KeyWithModifier, Vec<Action>)]) -> Vec<String> {
let mut lines = vec!["keybinds {".to_owned()];
for (mode, key, actions) in binds {
let actions: Vec<String> = actions
.iter()
.map(|action| {
let written = action
... |
rust_dataset_chunk_510210 | rust_dataset.txt | 510,210 | 512 | word in text.split_whitespace() {
let candidate = if current.is_empty() {
word.to_owned()
} else {
format!("{} {}", current, word)
};
if candidate.chars().count() > width && !current.is_empty() {
lines.push(std::mem::take(&mut current));
c... |
rust_dataset_chunk_510211 | rust_dataset.txt | 510,211 | 512 | : Rc<RefCell<String>>,
pub keybinding_state: Rc<RefCell<KeybindingState>>,
pub facts: Rc<RefCell<DesktopFacts>>,
pub main_screen: Rc<dyn Fn() -> Page>,
}
impl Shared {
pub fn main_screen(&self) -> Page {
(self.main_screen)()
}
}
impl Page {
pub fn new_main_screen(
link_executab... |
rust_dataset_chunk_510212 | rust_dataset.txt | 510,212 | 512 | ActiveComponent::new(TextOrCustomRender::Text(
Text::from("Use Zellij as your terminal app").color_range(2, ..),
))
.with_hover(TextOrCustomRender::Text(
Text::from("Use Zellij as your terminal app")
.color_range(2, ..)
.se... |
rust_dataset_chunk_510213 | rust_dataset.txt | 510,213 | 512 | <ActiveComponent> = grouped_binds_to_add(keybinding_state)
.into_iter()
.map(|(mode_name, binds)| {
let keys: Vec<String> = binds
.iter()
.map(|(key_text, description)| format!("{} {}", key_text, description))
.collect()... |
rust_dataset_chunk_510214 | rust_dataset.txt | 510,214 | 512 | = shared.clone();
move || {
apply_missing_binds(&shared.keybinding_state);
Page::new_update_keybindings(&shared)
}
})),
ActiveComponent::new(TextOrCustomRe... |
rust_dataset_chunk_510215 | rust_dataset.txt | 510,215 | 512 | (3, ..),
ApplyStatus::Failed(None) => Text::from(
"Keybindings added to this session, but the config file could not be written.",
)
.color_range(3, ..),
ApplyStatus::NotApplied => Text::from(""),
}
}
pub(crate) fn missing_binds_note(shared: &Shared, feature: Feature) -> ... |
rust_dataset_chunk_510216 | rust_dataset.txt | 510,216 | 512 | Feature::SessionHistory)
}
fn feature_page(feature: Feature, shared: &Shared) -> Page {
if feature_has_page(feature) {
Page::new_inbox(shared)
} else {
shared.main_screen()
}
}
fn confirm_text() -> Text {
Text::from("y").color_range(3, ..)
}
fn cancel_text() -> Text {
Text::from(... |
rust_dataset_chunk_510217 | rust_dataset.txt | 510,217 | 512 | {
Some((feature, group_mode_name, binds))
if *feature == bind.feature && *group_mode_name == mode_name =>
{
binds.push(entry);
},
_ => groups.push((bind.feature, mode_name, vec![entry])),
}
}
groups
.into_iter()
... |
rust_dataset_chunk_510218 | rust_dataset.txt | 510,218 | 512 | (word).color_range(3, ..),
)),
None => ActiveComponent::new(TextOrCustomRender::Text(Text::from(word))),
};
if let Some(line) = lines.last_mut() {
line.push(component);
}
}
}
lines.into_iter().map(ComponentLine::new).col... |
rust_dataset_chunk_510219 | rust_dataset.txt | 510,219 | 512 | (x, y);
if page_to_render.is_some() {
return page_to_render;
}
},
RenderedComponent::Paragraph(paragraph) => {
for component_line in paragraph {
let page_to_render = component_line... |
rust_dataset_chunk_510220 | rust_dataset.txt | 510,220 | 512 | match self.position_of_active_selectable() {
Some(position_of_active_selectable) => {
self.clear_active_selectables();
self.set_active_selectable(position_of_active_selectable + 1);
},
None => {
self.set_active_selectable(0);
... |
rust_dataset_chunk_510221 | rust_dataset.txt | 510,221 | 512 | => {
column_count = std::cmp::max(column_count, bulletin_list.column_count());
},
RenderedComponent::Paragraph(paragraph) => {
for active_component in paragraph {
column_count = std::cmp::max(column_count, active_component.... |
rust_dataset_chunk_510222 | rust_dataset.txt | 510,222 | 512 | _is_selected,
);
current_y += rendered_rows + 1; // 1 for the line space between components
}
}
}
fn render_error(error: &str, y: usize) {
print_text_with_coordinates(
Text::from(format!("ERROR: {}", error)).color_range(3, ..),
0,
y,
None,
... |
rust_dataset_chunk_510223 | rust_dataset.txt | 510,223 | 512 | ::from(title_text).color_range(2, ..)
}
}
fn main_screen_help_text(
hovering_over_link: bool,
menu_item_is_selected: bool,
has_missing_binds: bool,
) -> Text {
if hovering_over_link {
return link_hover_help();
}
let mut help_text = String::from("Help: <↓↑> - Navigate");
if menu_... |
rust_dataset_chunk_510224 | rust_dataset.txt | 510,224 | 512 | ");
Text::from(support_text).color_range(3, ..)
}
pub enum TextOrCustomRender {
Text(Text),
CustomRender(
Box<dyn Fn(usize, usize) -> usize>, // (rows, columns) -> text_len (render function)
Box<dyn Fn() -> usize>, // length of rendered component
),
}
impl TextOrCustomRend... |
rust_dataset_chunk_510225 | rust_dataset.txt | 510,225 | 512 | mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
RenderedComponent::HelpText(_) => write!(f, "HelpText"),
RenderedComponent::BulletinList(bulletinlist) => write!(f, "{:?}", bulletinlist),
RenderedComponent::Paragraph(component_list) => write!(f, "{:?}", compone... |
rust_dataset_chunk_510226 | rust_dataset.txt | 510,226 | 512 | max(column_count, item.column_count() + item_bulletin_len);
}
column_count
}
pub fn handle_left_click_at_position(&mut self, x: usize, y: usize) -> Option<Page> {
for component in &mut self.items {
let page_to_render = component.handle_left_click_at_position(x, y);
... |
rust_dataset_chunk_510227 | rust_dataset.txt | 510,227 | 512 | _to_render = active_component.handle_left_click_at_position(x, y);
if page_to_render.is_some() {
return page_to_render;
}
}
None
}
pub fn handle_hover_at_position(&mut self, x: usize, y: usize) -> Option<bool> {
for active_component in &mut self.co... |
rust_dataset_chunk_510228 | rust_dataset.txt | 510,228 | 512 | <String>>,
base_mode: Rc<RefCell<InputMode>>,
tip_index: usize,
) -> Self {
if tip_index == 0 {
Page::tip_1(link_executable)
} else if tip_index == 1 {
Page::tip_2(link_executable, base_mode)
} else if tip_index == 2 {
Page::tip_3(link_exec... |
rust_dataset_chunk_510229 | rust_dataset.txt | 510,229 | 512 | Render::Text(
Text::from("Check out the Zellij screencasts/tutorials to learn how to better take advantage")
))
]),
ComponentLine::new(vec![
ActiveComponent::new(TextOrCustomRender::Text(
Text... |
rust_dataset_chunk_510230 | rust_dataset.txt | 510,230 | 512 | OrCustomRender::Text(
Text::from("through them, copy to your clipboard or even save them for later.")
))
])
])
.with_paragraph(vec![ComponentLine::new(vec![
match *base_mode.borrow() {
InputMode::... |
rust_dataset_chunk_510231 | rust_dataset.txt | 510,231 | 512 | .with_paragraph(vec![ComponentLine::new(vec![
ActiveComponent::new(TextOrCustomRender::Text(support_the_developer_text())),
ActiveComponent::new(TextOrCustomRender::Text(sponsors_link_text_unselected()))
.with_hover(TextOrCustomRender::CustomRender(
... |
rust_dataset_chunk_510232 | rust_dataset.txt | 510,232 | 512 | ComponentLine::new(vec![ActiveComponent::new(TextOrCustomRender::Text(
Text::from("A great use case for these is to tail log files or to show"),
))]),
ComponentLine::new(vec![ActiveComponent::new(TextOrCustomRender::Text(
Text::from... |
rust_dataset_chunk_510233 | rust_dataset.txt | 510,233 | 512 | )),
ActiveComponent::new(TextOrCustomRender::Text(
Text::from("Press Alt - until you are back at the original state")
.color_range(3, 6..=10)
)),
ActiveComponent::new(TextOrCustomR... |
rust_dataset_chunk_510234 | rust_dataset.txt | 510,234 | 512 | -> Page {
Page::new()
.main_screen()
.with_title(Text::from("Zellij Tip #6").color_range(0, ..))
.with_paragraph(vec![
ComponentLine::new(vec![
ActiveComponent::new(TextOrCustomRender::Text(Text::from("Are the Zellij keybindings colliding ... |
rust_dataset_chunk_510235 | rust_dataset.txt | 510,235 | 512 | Text(support_the_developer_text())),
ActiveComponent::new(TextOrCustomRender::Text(sponsors_link_text_unselected()))
.with_hover(TextOrCustomRender::CustomRender(
Box::new(sponsors_link_text_selected),
Box::new(sponsors_link_text_select... |
rust_dataset_chunk_510236 | rust_dataset.txt | 510,236 | 512 | ]),
])
.with_paragraph(vec![ComponentLine::new(vec![
ActiveComponent::new(TextOrCustomRender::Text(support_the_developer_text())),
ActiveComponent::new(TextOrCustomRender::Text(sponsors_link_text_unselected()))
.with_hover(TextO... |
rust_dataset_chunk_510237 | rust_dataset.txt | 510,237 | 512 | tips_help_text(hovering_over_link)
}))
}
pub fn tip_9(link_executable: Rc<RefCell<String>>) -> Page {
Page::new()
.main_screen()
.with_title(Text::from("Zellij Tip #9").color_range(0, ..))
.with_paragraph(vec![
ComponentLine... |
rust_dataset_chunk_510238 | rust_dataset.txt | 510,238 | 512 | Render(
Box::new(matrix_link_text_selected),
Box::new(matrix_link_text_selected_len),
))
.with_left_click_action(ClickAction::new_open_link(
"https://matrix.to/#/#zellij_general:matrix.org... |
rust_dataset_chunk_510239 | rust_dataset.txt | 510,239 | 512 | w")
.color_substring(3, "Ctrl g")
.color_nth_substring(3, "o", 1)
.color_last_substring(3, "w"),
_ => Text::from("Check it out with: Ctrl o + w")
.color_substring(3, "Ctrl o")
.co... |
rust_dataset_chunk_510240 | rust_dataset.txt | 510,240 | 512 | izing or splitting a pane breaks out of this arrangement. It is then possible")
)),
]),
ComponentLine::new(vec![
ActiveComponent::new(TextOrCustomRender::Text(
Text::from("to snap back by pressing Alt + [] once more. This st... |
rust_dataset_chunk_510241 | rust_dataset.txt | 510,241 | 512 | _substring(3, "Ctrl o")
.color_last_substring(3, "p")
}
}
)),
]),
])
.with_paragraph(vec![ComponentLine::new(vec![
ActiveComponent::new(TextOrCu... |
rust_dataset_chunk_510242 | rust_dataset.txt | 510,242 | 512 | 40
}
fn plugin_docs_link_text_selected_len() -> usize {
40
}
fn awesome_zellij_link_text_selected(x: usize, y: usize) -> usize {
print!(
"\u{1b}[{};{}H\u{1b}[m\u{1b}[1;4mhttps://github.com/zellij-org/awesome-zellij",
y + 1,
x + 1
);
44
}
fn awesome_zellij_link_text_selecte... |
rust_dataset_chunk_510243 | rust_dataset.txt | 510,243 | 512 | print!(
"\u{1b}[{};{}H\u{1b}[m\u{1b}[1;4mhttps://zellij.dev/documentation/themes",
y + 1,
x + 1
);
39
}
fn theme_link_selected_len() -> usize {
39
}
fn theme_list_selected(x: usize, y: usize) -> usize {
print!(
"\u{1b}[{};{}H\u{1b}[m\u{1b}[1;4mhttps://zellij.dev/documen... |
rust_dataset_chunk_510244 | rust_dataset.txt | 510,244 | 512 | _tile::prelude::actions::Action;
use zellij_tile::prelude::*;
pub const CLICK_SEQUENCE_CONTEXT_KEY: &str = "bars_click_sequence";
#[derive(Debug, Clone, PartialEq)]
pub struct ClickRegion {
pub start: usize,
pub end: usize,
pub actions: Vec<Action>,
}
impl ClickRegion {
pub fn new(start: usize, end: ... |
rust_dataset_chunk_510245 | rust_dataset.txt | 510,245 | 512 | {
return;
};
self.next_id += 1;
let id = self.next_id;
if queue.is_empty() {
self.queues.remove(&client_id);
} else {
self.queues.insert(client_id, (owner.to_owned(), id, queue));
}
run_action(first, Self::context(owner, id));
... |
rust_dataset_chunk_510246 | rust_dataset.txt | 510,246 | 512 | &completion("status", 1)));
assert_eq!(runner.pending_for(1), 1);
assert!(runner.action_completed("status", 1, &completion("status", 1)));
assert_eq!(runner.pending_for(1), 0);
assert!(!runner.action_completed("status", 1, &completion("status", 1)));
}
#[test]
fn a_new_clic... |
rust_dataset_chunk_510247 | rust_dataset.txt | 510,247 | 512 | Char('p')), &[]),
None
);
assert_eq!(
actions_for_key(&keybinds, &KeyWithModifier::new(BareKey::Char('x')), &[]),
None
);
}
#[test]
fn regions_are_found_by_column_and_can_be_shifted() {
let regions = vec![
ClickRegion::new(2, 4... |
rust_dataset_chunk_510248 | rust_dataset.txt | 510,248 | 512 | ResizeAny => "Increase or decrease size".to_string(),
ActionType::Search => "Search".to_string(),
ActionType::NewPaneWithDirection => "Split right/down".to_string(),
ActionType::NewPaneWithoutDirection => "New pane".to_string(),
ActionType::BreakPaneLeftOrRight => "Break ... |
rust_dataset_chunk_510249 | rust_dataset.txt | 510,249 | 512 | ".to_string(),
ActionType::EditScrollback => "Open pane scrollback in editor".to_string(),
ActionType::NewTab => "New tab".to_string(),
ActionType::Detach => "Detach".to_string(),
ActionType::Inbox => "Inbox".to_string(),
ActionType::Quit => "Quit".to_string()... |
rust_dataset_chunk_510250 | rust_dataset.txt | 510,250 | 512 | anes => ActionType::ToggleFloatingPanes,
Action::CloseFocus => ActionType::CloseFocus,
Action::CloseTab => ActionType::CloseTab,
Action::ToggleActiveSyncTab => ActionType::ToggleActiveSyncTab,
Action::ToggleTab => ActionType::ToggleTab,
Action::BreakPane => Ac... |
rust_dataset_chunk_510251 | rust_dataset.txt | 510,251 | 512 | bind_utils.rs ---
use crate::compact_bar::action_types::ActionType;
use std::collections::HashSet;
use zellij_tile::prelude::actions::Action;
use zellij_tile::prelude::*;
#[derive(Debug, Clone, PartialEq)]
pub struct TooltipKeyChunk {
pub text: String,
pub actions: Option<Vec<Action>>,
}
impl TooltipKeyChunk ... |
rust_dataset_chunk_510252 | rust_dataset.txt | 510,252 | 512 | Vec::new();
let keybinds = mode_info.get_keybinds_for_mode(mode);
let mut processed_action_types = HashSet::new();
for predicate in predicates {
for (_key, actions) in &keybinds {
if let Some(first_action) = actions.first() {
if predicate(first_a... |
rust_dataset_chunk_510253 | rust_dataset.txt | 510,253 | 512 | _keys {
format!("<{}>", text)
} else {
text.to_owned()
}
};
if filtered_keys.len() == 1 {
let (key, actions) = &filtered_keys[0];
return vec![TooltipKeyChunk::key(bracketed(key), actions.clone())];
}
let mu... |
rust_dataset_chunk_510254 | rust_dataset.txt | 510,254 | 512 | up_pgdown.push(("PgDn", actions)),
_ => other_keys.push(TooltipKeyChunk::key(bracketed(key), actions)),
}
}
let mut groups: Vec<Vec<TooltipKeyChunk>> = Vec::new();
let mut add_group =
|mut keys: Vec<(&'static str, Vec<Action>)>, order: &[&str], separator:... |
rust_dataset_chunk_510255 | rust_dataset.txt | 510,255 | 512 | ::plain("/"));
}
result.extend(group);
}
result
}
fn sort_by_order(keys: &mut Vec<(&'static str, Vec<Action>)>, order: &[&str]) {
let mut seen = HashSet::new();
keys.retain(|(key, _)| seen.insert(*key));
keys.sort_by_key(|(key, _)| {
o... |
rust_dataset_chunk_510256 | rust_dataset.txt | 510,256 | 512 | Mode::Pane => {
let ordered_predicates = vec![
|action: &Action| {
matches!(
action,
Action::NewPane {
direction: None,
pane_name: None,
... |
rust_dataset_chunk_510257 | rust_dataset.txt | 510,257 | 512 | action: &Action| matches!(action, Action::GoToPreviousTab),
|action: &Action| matches!(action, Action::GoToNextTab),
|action: &Action| {
matches!(
action,
Action::NewTab {
... |
rust_dataset_chunk_510258 | rust_dataset.txt | 510,258 | 512 | )
},
|action: &Action| {
matches!(
action,
Action::Resize {
resize: Resize::Increase,
direction: Some(Direction::Right)
... |
rust_dataset_chunk_510259 | rust_dataset.txt | 510,259 | 512 | ScrollUp),
|action: &Action| {
matches!(
action,
Action::SwitchToMode {
input_mode: InputMode::EnterSearch
}
)
},
... |
rust_dataset_chunk_510260 | rust_dataset.txt | 510,260 | 512 | !(
action,
Action::SwitchToMode {
input_mode: InputMode::RenameSession
}
)
},
|action: &Action| action.launches_plugin("session-manager"),
... |
rust_dataset_chunk_510261 | rust_dataset.txt | 510,261 | 512 | }];
let decrease = vec![Action::Resize {
resize: Resize::Decrease,
direction: None,
}];
let keys = vec![
("=".to_owned(), increase.clone()),
("-".to_owned(), decrease.clone()),
("+".to_owned(), increase.clone()),
];
... |
rust_dataset_chunk_510262 | rust_dataset.txt | 510,262 | 512 | zellij_tile_utils::style;
pub(crate) const PREFIX_TEXT: &str = " Zellij ";
pub struct TabLineOutput {
pub parts: Vec<LinePart>,
pub breadcrumb_range: Option<(usize, usize)>,
pub mode_range: Option<(usize, usize)>,
pub session_indicator_range: Option<(usize, usize)>,
}
#[derive(Debug, Default, Clone,... |
rust_dataset_chunk_510263 | rust_dataset.txt | 510,263 | 512 | struct TabLineConfig {
pub session_name: Option<String>,
pub hide_session_name: bool,
pub mode: InputMode,
pub session_indicator: SessionIndicator,
pub toggle_tooltip_key: Option<String>,
pub tooltip_is_active: bool,
pub dimmed: bool,
pub breadcrumb_ancestry: Vec<String>,
pub nested... |
rust_dataset_chunk_510264 | rust_dataset.txt | 510,264 | 512 | left_count,
right_count,
&collapsed_indicators,
);
match self.decide_next_action(&fit_analysis, total_left, total_right) {
TabAction::AddLeft => {
if let Some(tab) = tabs_before_active.pop() {
... |
rust_dataset_chunk_510265 | rust_dataset.txt | 510,265 | 512 | total_right: usize,
) -> TabAction {
if (total_left <= total_right || !fit_analysis.right_fits) && fit_analysis.left_fits {
TabAction::AddLeft
} else if fit_analysis.right_fits {
TabAction::AddRight
} else {
TabAction::Finish
}
}
fn creat... |
rust_dataset_chunk_510266 | rust_dataset.txt | 510,266 | 512 | )]
struct TabSizes {
left: usize,
right: usize,
}
#[derive(Debug)]
struct TabFitAnalysis {
left_fits: bool,
right_fits: bool,
}
#[derive(Debug)]
struct IndicatorColors {
text: PaletteColor,
separator: PaletteColor,
background: PaletteColor,
}
#[derive(Debug)]
enum TabAction {
AddLeft,... |
rust_dataset_chunk_510267 | rust_dataset.txt | 510,267 | 512 | TabLinePrefix {
parts: vec![self.create_zellij_part()],
breadcrumb_range: None,
mode_range: None,
}
}
fn create_breadcrumb_parts(
&self,
name: &str,
used_len: usize,
) -> Option<(Vec<LinePart>, (usize, usize), usize)> {
let bg_col... |
rust_dataset_chunk_510268 | rust_dataset.txt | 510,268 | 512 | ) -> LinePart {
let prefix_text = PREFIX_TEXT;
let colors = self.get_text_colors();
let text_style = if self.dimmed {
style!(colors.text, colors.background).italic()
} else {
style!(colors.text, colors.background).bold()
};
LinePart {
... |
rust_dataset_chunk_510269 | rust_dataset.txt | 510,269 | 512 | separator: self.palette.text_unselected.background,
}
}
}
struct RightSideElementsBuilder {
palette: Styling,
dimmed: bool,
simplified_ui: bool,
}
impl RightSideElementsBuilder {
fn new(palette: Styling, dimmed: bool, simplified_ui: bool) -> Self {
Self {
palette,
... |
rust_dataset_chunk_510270 | rust_dataset.txt | 510,270 | 512 | = keys_text.iter().map(|k| display_width(k)).sum::<usize>()
+ keys_text.len().saturating_sub(1) * 3;
if !keys_text.is_empty() && prefix_len + keys_display_len <= max_len {
let prefix_style = dim_style(bg).italic();
let mut part = prefix_style.paint(format!(" {}", prefix)).t... |
rust_dataset_chunk_510271 | rust_dataset.txt | 510,271 | 512 | ,
}
impl TabLineBuilder {
pub fn new(
config: TabLineConfig,
palette: Styling,
capabilities: PluginCapabilities,
cols: usize,
) -> Self {
Self {
config,
palette,
capabilities,
cols,
}
}
pub fn build(self, a... |
rust_dataset_chunk_510272 | rust_dataset.txt | 510,272 | 512 | ,
session_indicator_range,
}
}
fn split_tabs(
&self,
mut all_tabs: Vec<LinePart>,
active_tab_index: usize,
) -> (Vec<LinePart>, LinePart, Vec<LinePart>) {
let mut tabs_after_active = all_tabs.split_off(active_tab_index);
let mut tabs_before_active... |
rust_dataset_chunk_510273 | rust_dataset.txt | 510,273 | 512 | (capabilities: PluginCapabilities) -> &'static str {
if !capabilities.arrow_fonts {
ARROW_SEPARATOR
} else {
""
}
}
--- FILE: zellij/default-plugins/bars/src/compact_bar/mod.rs ---
mod action_types;
mod clipboard_utils;
pub(crate) mod keybind_utils;
mod line;
mod tab;
pub(crate) mod toolti... |
rust_dataset_chunk_510274 | rust_dataset.txt | 510,274 | 512 | Copy, PartialEq, Eq)]
enum CompactRegion {
Tab(usize),
Marker { left: bool, position: usize },
Breadcrumb,
Mode,
}
fn region_at(regions: &[(usize, usize, CompactRegion)], col: usize) -> Option<CompactRegion> {
regions
.iter()
.find(|(start, end, _)| col >= *start && col < *end)
... |
rust_dataset_chunk_510275 | rust_dataset.txt | 510,275 | 512 | : usize,
display_area_cols: usize,
text_copy_destination: Option<CopyDestination>,
display_system_clipboard_failure: bool,
last_left_click: Option<(SlotId, ClickTarget)>,
hovered: Option<CompactRegion>,
hover_at: Option<(SlotId, usize)>,
drag: Option<TabDrag>,
switch_when_settled: Option... |
rust_dataset_chunk_510276 | rust_dataset.txt | 510,276 | 512 | Keybinds,
EventType::Mouse,
EventType::ActionComplete,
]
} else {
vec![
EventType::TabUpdate,
EventType::PaneUpdate,
EventType::ModeUpdate,
EventType::Mouse,
EventType::CopyToC... |
rust_dataset_chunk_510277 | rust_dataset.txt | 510,277 | 512 | },
)
})
.collect()
}
pub fn seed(&mut self, seeds: &BTreeMap<ClientId, ClientSeed>) {
for (client_id, seed) in seeds {
let client = self.clients.entry(*client_id).or_default();
client.mode_info = seed.mode_info.clone();
client... |
rust_dataset_chunk_510278 | rust_dataset.txt | 510,278 | 512 | .filter(|id| match (tab_index, self.slot_tabs.get(id)) {
(Some(tab_index), Some(slot_tab)) => *slot_tab == tab_index,
_ => true,
})
.collect()
}
fn tooltip_slots_for_client(&self, client_id: ClientId) -> Vec<SlotId> {
self.tooltip_slots_in_tab(se... |
rust_dataset_chunk_510279 | rust_dataset.txt | 510,279 | 512 | .handle_pane_update(pane_manifest) {
RenderResponse::Slots(self.main_slot_ids())
} else {
RenderResponse::Nothing
}
},
Event::Mouse(mouse_event) => {
if let (Some(slot_id), Some(client_id)) = (context.slot_id... |
rust_dataset_chunk_510280 | rust_dataset.txt | 510,280 | 512 | Some(client) = self.clients.get_mut(&client_id) else {
return false;
};
let mut should_render = false;
if let Some(drag) = client.drag.as_mut() {
should_render = drag.move_completed();
}
if let Some(... |
rust_dataset_chunk_510281 | rust_dataset.txt | 510,281 | 512 | base_mode: InputMode,
) {
let persist = self.slots.get(&slot_id).map(|s| s.persist).unwrap_or(false);
if !persist && (new_mode == base_mode || is_restricted_mode(new_mode)) {
let _ = close_slot(slot_id);
} else if new_mode != old_mode || persist {
self.update_tooltip... |
rust_dataset_chunk_510282 | rust_dataset.txt | 510,282 | 512 | .session_indicator.handle_pipe(pipe_message) {
RenderResponse::Slots(self.main_slot_ids())
} else {
RenderResponse::Nothing
}
}
fn handle_mouse_event(
&mut self,
slot_id: SlotId,
client_id: ClientId,
mouse_event: &Mouse,
) -> bool {
... |
rust_dataset_chunk_510283 | rust_dataset.txt | 510,283 | 512 | *col));
if let Some(drag) = client
.drag
.as_mut()
.filter(|drag| drag.slot_id == Some(slot_id))
{
if let Some((tab_id, target)) =
drag.hold(&client.tabs, &slot_client.segments, *col)... |
rust_dataset_chunk_510284 | rust_dataset.txt | 510,284 | 512 | Target::Bar,
};
open_context_menu(target, (*line).max(0) as usize, *col);
},
Mouse::ScrollUp(_) => {
let next_tab = min(client.active_tab_idx + 1, client.tabs.len());
switch_tab_to(next_tab as u32);
},
Mouse:... |
rust_dataset_chunk_510285 | rust_dataset.txt | 510,285 | 512 | ,
};
client.text_copy_destination = Some(copy_destination);
should_render
}
fn handle_clipboard_failure(&mut self, client_id: ClientId) -> bool {
let client = self.clients.entry(client_id).or_default();
client.display_system_clipboard_failure = true;
true
}
... |
rust_dataset_chunk_510286 | rust_dataset.txt | 510,286 | 512 |
}
fn handle_tooltip_pipe(&mut self, slot_id: SlotId, message: &PipeMessage) {
if message.name == MSG_TOGGLE_PERSISTED_TOOLTIP {
let Some(slot) = self.slots.get_mut(&slot_id) else {
return;
};
if slot.is_first_run {
slot.persist = true... |
rust_dataset_chunk_510287 | rust_dataset.txt | 510,287 | 512 | : SlotId, new_tab_index: usize) {
break_panes_to_tab_with_index(
&[PaneId::Plugin(slot_id)],
new_tab_index.saturating_sub(1),
false,
);
self.slot_tabs
.insert(slot_id, new_tab_index.saturating_sub(1));
}
fn calculate_tooltip_coordinates(&s... |
rust_dataset_chunk_510288 | rust_dataset.txt | 510,288 | 512 | client_id) else {
return;
};
if slot.is_tooltip {
let tooltip_renderer = TooltipRenderer::new(&client.mode_info);
let regions = tooltip_renderer.regions(rows, cols);
let hovered = client
.tooltip_hover_at
.filter(|(hover_slo... |
rust_dataset_chunk_510289 | rust_dataset.txt | 510,289 | 512 | .and(client.hovered);
let (mut tab_line_output, mut regions, mut segments) = compose(hovered);
if let Some(col) = hover_col {
let under_mouse =
region_at(®ions, col).filter(|region| hoverable(client, region));
if under_mouse != hovered {
... |
rust_dataset_chunk_510290 | rust_dataset.txt | 510,290 | 512 | )) => {
print!("{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", text, r, g, b);
},
PaletteColor::EightBit(color) => {
print!("{}\u{1b}[48;5;{}m\u{1b}[0K", text, color);
},
}
}
fn prepare_tab_data(
client: &ClientState,
hovered: Option<CompactRegion>,
cols: usize,
) ->... |
rust_dataset_chunk_510291 | rust_dataset.txt | 510,291 | 512 | "
payload "{}"
}}
}}
}}
}}
"#,
toggle_key, toggle_key, client_id
)
}
#[cfg(test)]
mod tests {
use super::*;
fn part(text: &str, tab_index: Option<usize>) -> LinePart {
LinePart {
part: text.to_owned... |
rust_dataset_chunk_510292 | rust_dataset.txt | 510,292 | 512 | 14),
Some(CompactRegion::Marker {
left: true,
position: 0
})
);
assert_eq!(region_at(regions, 16), Some(CompactRegion::Tab(1)));
assert_eq!(region_at(regions, 18), Some(CompactRegion::Tab(2)));
assert_eq!(bar.slot_clients[&(0, 1)].... |
rust_dataset_chunk_510293 | rust_dataset.txt | 510,293 | 512 | _event(0, 1, &Mouse::LeftClick(0, 16)));
assert_eq!(bar.clients[&1].drag.as_ref().map(|d| d.tab_id), Some(11));
bar.handle_mouse_event(0, 1, &Mouse::Hold(0, 19));
assert_eq!(
bar.clients[&1].drag.as_ref().and_then(|d| d.pending_target),
Some(2)
);
let move... |
rust_dataset_chunk_510294 | rust_dataset.txt | 510,294 | 512 | _the_stored_tooltip_regions() {
let mut bar = bar(client_with_tabs(&[10], 0, InputMode::Resize));
bar.slots.insert(
5,
SlotConfig {
is_tooltip: true,
..Default::default()
},
);
let actions = vec![actions::Action::Resize ... |
rust_dataset_chunk_510295 | rust_dataset.txt | 510,295 | 512 | ,
active: position == active,
name: name.to_string(),
..Default::default()
})
.collect(),
active_tab_idx: active + 1,
mode_info: ModeInfo {
mode: InputMode::Normal,
base_mo... |
rust_dataset_chunk_510296 | rust_dataset.txt | 510,296 | 512 | !(total <= 40);
assert_eq!(total, rendered_width(&parts));
assert!(parts
.iter()
.any(|part| part.tab_index == Some(1) && strip_ansi(&part.part).contains('…')));
let (regions, _) = compact_regions(&parts, &rendered, active, None, None);
assert!(regions
... |
rust_dataset_chunk_510297 | rust_dataset.txt | 510,297 | 512 | , len)
}
pub(crate) fn fit_tab_text(text: String, max_width: usize) -> String {
if max_width == 0 || graphemes::display_width(&text) <= max_width {
text
} else {
graphemes::truncate_end(&text, max_width, "…").into_owned()
}
}
pub fn render_tab(
text: String,
tab: &TabInfo,
is_a... |
rust_dataset_chunk_510298 | rust_dataset.txt | 510,298 | 512 | _text(text, max_width.saturating_sub(decoration_len));
let tab_text_len = graphemes::display_width(&text) + decoration_len;
let marker_part = match marker {
Some(marker) => {
let color = if dimmed {
palette.ribbon_unselected.base
} else {
foregrou... |
rust_dataset_chunk_510299 | rust_dataset.txt | 510,299 | 512 | marker,
)
}
pub(crate) fn get_clicked_line_part(
tab_line: &[LinePart],
mouse_click_col: usize,
) -> Option<&LinePart> {
let mut len = 0;
for tab_line_part in tab_line {
if mouse_click_col >= len && mouse_click_col < len + tab_line_part.len {
return Some(tab_line_part);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.