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_511300 | rust_dataset.txt | 511,300 | 512 | skip current at 1
state.move_selection_down();
assert_eq!(state.selected_index, Some(3)); // "c"
state.move_selection_down();
assert_eq!(state.selected_index, Some(4)); // "d"
state.move_selection_down();
assert_eq!(state.selected_index, Some(0)); // "a", wrapped
}
... |
rust_dataset_chunk_511301 | rust_dataset.txt | 511,301 | 512 | 1, 1, 1, true, 100),
make_active_session("alpha", 1, 1, 1, false, 200),
make_active_session("beta", 1, 1, 1, false, 300),
];
state.search_term = String::new();
state.update_search_term(&active, &[]);
state.tab_complete(&active, &[]);
// First non-current ... |
rust_dataset_chunk_511302 | rust_dataset.txt | 511,302 | 512 | state.tab_complete(&active, &resurrectable);
assert_eq!(state.search_term, "beta");
}
#[test]
fn test_4_5_tab_completion_with_empty_results_noop() {
let mut state = SingleScreenState::default();
let active = vec![
make_active_session("alpha", 1, 1, 1, false, 100),
... |
rust_dataset_chunk_511303 | rust_dataset.txt | 511,303 | 512 | ("work", 1, 1, 1, false, 300),
];
state.search_term = "nix".to_string();
state.update_search_term(&active, &[]);
let expected: Vec<String> = state
.unified_results
.iter()
.map(|r| r.session_name().to_owned())
.collect();
assert_eq!... |
rust_dataset_chunk_511304 | rust_dataset.txt | 511,304 | 512 | state.tab_complete(&active, &[]);
assert_eq!(state.search_term, "alpha");
state.search_term = "be".to_string();
state.update_search_term(&active, &[]);
state.tab_complete(&active, &[]);
assert_eq!(state.search_term, "beta");
state.tab_complete(&active, &[]);
asse... |
rust_dataset_chunk_511305 | rust_dataset.txt | 511,305 | 512 | fn test_5_3_round_trip_transition_preserves_search_term() {
let mut state = SingleScreenState::default();
state.search_term = "my-new-session".to_string();
state.mode = SingleScreenMode::SearchAndSelect;
state.transition_to_layout_selection();
assert_eq!(state.mode, SingleScreen... |
rust_dataset_chunk_511306 | rust_dataset.txt | 511,306 | 512 | 1.0, 0);
timers.record(TimerOwner::Spinner, 0.3, 100);
timers.record(TimerOwner::Clock, 0.3, 100);
assert_eq!(timers.fired(), Some(TimerOwner::Spinner));
assert_eq!(timers.fired(), Some(TimerOwner::Clock));
assert_eq!(timers.fired(), Some(TimerOwner::Clock));
assert_eq!(t... |
rust_dataset_chunk_511307 | rust_dataset.txt | 511,307 | 512 | /// Max column widths across all cached rows.
pub full_name_width: usize,
pub full_details_width: usize,
pub abbr_details_width: usize,
}
impl UnifiedResultsRenderCache {
/// Rebuild the cache from the current `unified_results`.
pub fn rebuild(&mut self, results: &[UnifiedSearchResult]) {
... |
rust_dataset_chunk_511308 | rust_dataset.txt | 511,308 | 512 | conn_end),
],
}
};
let name_width = graphemes::display_width(&session_name);
let full_details_width = graphemes::display_width(&full_details);
let abbr_details_width = graphemes::display_... |
rust_dataset_chunk_511309 | rust_dataset.txt | 511,309 | 512 | Update max widths
if row.name_width > self.full_name_width {
self.full_name_width = row.name_width;
}
if row.full_details_width > self.full_details_width {
self.full_details_width = row.full_details_width;
}
if row.abbr_details... |
rust_dataset_chunk_511310 | rust_dataset.txt | 511,310 | 512 | line_count += 1
};
if self.tab_name.is_some() {
line_count += 1
};
if self.pane_name.is_some() {
line_count += 1
};
line_count
}
pub fn render(&self, indices: Option<Vec<usize>>, max_cols: usize) -> Vec<LineToRender> {
l... |
rust_dataset_chunk_511311 | rust_dataset.txt | 511,311 | 512 | UiSpanTelescope(UiSpanTelescope),
TruncatableUiSpan(TruncatableUiSpan),
}
impl UiSpan {
pub fn render(
&self,
indices: Option<(SpanStyle, Vec<usize>)>,
line_to_render: &mut LineToRender,
remaining_cols: &mut usize,
) {
match self {
UiSpan::UiSpanTelescop... |
rust_dataset_chunk_511312 | rust_dataset.txt | 511,312 | 512 | )]
pub struct TruncatableUiSpan {
text: String,
style: SpanStyle,
}
impl TruncatableUiSpan {
pub fn new(text: String, style: SpanStyle) -> Self {
TruncatableUiSpan { text, style }
}
pub fn render(
&self,
indices: Option<(SpanStyle, Vec<usize>)>,
line_to_render: &mut ... |
rust_dataset_chunk_511313 | rust_dataset.txt | 511,313 | 512 | }
}
#[derive(Debug, Clone)]
pub struct LineToRender {
line: String,
is_selected: bool,
truncated_result_count: usize,
colors: Colors,
}
impl LineToRender {
pub fn new(colors: Colors) -> Self {
LineToRender {
line: String::default(),
is_selected: false,
... |
rust_dataset_chunk_511314 | rust_dataset.txt | 511,314 | 512 | {};{}m{arrows}{}",
r, g, b, r, g, b, self.line
);
},
}
}
pub fn render(&self) -> String {
let mut line = self.line.clone();
let more = if self.truncated_result_count > 0 {
self.colors
.exit_code_error(&format!("... |
rust_dataset_chunk_511315 | rust_dataset.txt | 511,315 | 512 | + graphemes::display_width(&total_pane_count)
+ 7,
),
StringAndLength::new(
format!(" ({tab_count_styled}, {total_pane_count_styled})"),
2 + graphemes::display_width(&tab_count)
+ 2
+ graphemes::display_width(&total_... |
rust_dataset_chunk_511316 | rust_dataset.txt | 511,316 | 512 | phasis_1),
));
let connected_users_count_span = UiSpan::UiSpanTelescope(UiSpanTelescope::new(vec![
StringAndLength::new(
format!(" ({pane_count_styled} panes)"),
2 + graphemes::display_width(&pane_count) + 7,
),
StringAndLength::new(
format!(" ({pane_c... |
rust_dataset_chunk_511317 | rust_dataset.txt | 511,317 | 512 | usize, usize, usize, usize) {
// returns: (start_index, anchor_index, end_index, lines_left_to_remove)
let (count_to_render, line_count_to_remove) = if line_count_to_remove > total_count {
(1, line_count_to_remove.saturating_sub(total_count) + 1)
} else {
(total_count.saturating_sub(line_cou... |
rust_dataset_chunk_511318 | rust_dataset.txt | 511,318 | 512 | };
used += format!(" <ENTER> - {}", action).chars().count();
format!(" {} - {}", enter_key, action)
}
},
None => String::new(),
};
for (key, label) in extra_hints {
let width = format!(", {} - {}", key, label).chars().count();
... |
rust_dataset_chunk_511319 | rust_dataset.txt | 511,319 | 512 | not use the tab toggle; this arm exists for exhaustiveness
return;
},
}
let bg_color = match background {
PaletteColor::Rgb((r, g, b)) => format!("\u{1b}[48;2;{};{};{}m\u{1b}[0K", r, g, b),
PaletteColor::EightBit(color) => format!("\u{1b}[48;5;{}m\u{1b}[0K", color),
};
... |
rust_dataset_chunk_511320 | rust_dataset.txt | 511,320 | 512 | 1b}[m{}{} {} ({} {}, {} {})",
format!("\u{1b}[{};{}H", y + 1, x + 1),
colors.session_name_prompt(folder_prompt),
colors.session_and_folder_entry(&new_session_folder),
change_folder_shortcut,
to_change,
... |
rust_dataset_chunk_511321 | rust_dataset.txt | 511,321 | 512 | ",
format!("\u{1b}[{};{}H", y + 1, x + 1),
colors.session_name_prompt(short_folder_prompt),
colors.session_and_folder_entry(&truncated_path),
change_folder_shortcut,
reset_folder_shortcut,
);
... |
rust_dataset_chunk_511322 | rust_dataset.txt | 511,322 | 512 | _name = new_session_info.name();
if max_cols_of_new_session_block
> graphemes::display_width(&prompt)
+ graphemes::display_width(&long_instruction)
+ graphemes::display_width(&new_session_name)
+ 15
{
println!(
"\u{1... |
rust_dataset_chunk_511323 | rust_dataset.txt | 511,323 | 512 | : {} {}",
format!("\u{1b}[{};{}H", y + 1, x + 1),
colors.session_name_prompt("New session name"),
colors.session_and_folder_entry(new_session_name),
esc,
);
}
render_layout_selection_list(
new_session_info,
... |
rust_dataset_chunk_511324 | rust_dataset.txt | 511,324 | 512 | _name.chars().count();
let is_builtin = layout_info.is_builtin();
if i > max_rows_of_new_session_block.saturating_sub(1) {
break;
} else {
let mut layout_cell = if is_builtin {
Text::from(format!("{} (built-in)", layout_name))
.color_ra... |
rust_dataset_chunk_511325 | rust_dataset.txt | 511,325 | 512 | x,
y + 2,
None,
None,
);
}
}
pub fn render_controls_line(
active_screen: ActiveScreen,
max_cols: usize,
colors: Colors,
x: usize,
y: usize,
show_navigate: bool,
) -> usize {
const HELP_PREFIX_LEN: usize = 6;
let x = x + 1;
... |
rust_dataset_chunk_511326 | rust_dataset.txt | 511,326 | 512 | arrows} - {navigate}, {enter} - {select}, {del} - {del_text}, {del_all} - {del_all_text}"
);
true
} else if max_cols >= 28 {
print!("\u{1b}[m\u{1b}[{y};{x}H{arrows}/{enter}/{del}/{del_all}");
false
} else {
false
... |
rust_dataset_chunk_511327 | rust_dataset.txt | 511,327 | 512 | _text}, {rename} - {rename_text}, {disconnect} - {disconnect_full_text}, {kill} - {kill_text}"
);
true
} else if max_cols > 105 {
print!(
"\u{1b}[m\u{1b}[{y};{x}HHelp: {arrows} - {navigate}, {layout} - {layout_short_text}, {rename} - {renam... |
rust_dataset_chunk_511328 | rust_dataset.txt | 511,328 | 512 | {
0
}
}
fn format_elapsed_time(elapsed_millis: u64) -> String {
// Convert elapsed milliseconds to Duration
let elapsed_duration = Duration::from_millis(elapsed_millis);
// Use humantime to format the duration, same as in resurrectable_sessions.rs
let duration_str = format_duration(elapse... |
rust_dataset_chunk_511329 | rust_dataset.txt | 511,329 | 512 | + space_width
+ time_width;
let minimal_width = shortcut_width + space_width + time_width;
// Select appropriate message based on available width
let msg = if max_cols >= full_width {
format!(
"{}{}{}{}{}",
shortcut_text, separator, full_action_text, space, time_tex... |
rust_dataset_chunk_511330 | rust_dataset.txt | 511,330 | 512 | pub fn session_name_prompt(&self, text: &str) -> String {
self.color(&self.palette.exit_code_success.base, text)
}
pub fn connected_users(&self, text: &str) -> String {
self.color(&self.palette.text_unselected.emphasis_2, text)
}
pub fn session_and_folder_entry(&self, text: &str) -... |
rust_dataset_chunk_511331 | rust_dataset.txt | 511,331 | 512 | build_tab_ui_line, minimize_lines, Colors,
LineToRender,
};
macro_rules! render_assets {
($assets:expr, $line_count_to_remove:expr, $selected_index:expr, $to_render_until_selected: expr, $to_render_after_selected:expr, $has_deeper_selected_assets:expr, $max_cols:expr, $colors:expr) => {{
let (start_in... |
rust_dataset_chunk_511332 | rust_dataset.txt | 511,332 | 512 | truncated_result_count_below = 0;
current_index += 1;
$to_render_after_selected.insert(0, asset.into());
}
}
line_count_to_remove
}};
}
impl SessionList {
pub fn render(&self, max_rows: usize, max_cols: usize, colors: Colors) -> Vec<Li... |
rust_dataset_chunk_511333 | rust_dataset.txt | 511,333 | 512 | _to_render.append(&mut lines_to_render_after_selected);
lines_to_render
}
fn render_sessions(
&self,
to_render_until_selected: &mut Vec<LineToRender>,
to_render_after_selected: &mut Vec<LineToRender>,
line_count_to_remove: usize,
max_cols: usize,
colors: C... |
rust_dataset_chunk_511334 | rust_dataset.txt | 511,334 | 512 | _to_remove,
self.selected_index.2,
to_render_until_selected,
to_render_after_selected,
false,
max_cols,
colors
)
} else {
line_count_to_remove
}
}
fn total_lines_to_render(&sel... |
rust_dataset_chunk_511335 | rust_dataset.txt | 511,335 | 512 | = build_session_ui_line(&self, colors);
for span in ui_spans {
span.render(None, &mut line_to_render, &mut max_cols);
}
line_to_render
}
}
#[derive(Debug, Clone)]
pub struct TabUiInfo {
pub name: String,
pub panes: Vec<PaneUiInfo>,
pub position: usize,
}
impl TabUi... |
rust_dataset_chunk_511336 | rust_dataset.txt | 511,336 | 512 | new(colors);
let ui_spans = build_pane_ui_line(&self, colors);
for span in ui_spans {
span.render(None, &mut line_to_render, &mut max_cols);
}
line_to_render
}
}
--- FILE: zellij/default-plugins/share/src/main.rs ---
mod main_screen;
mod token_management_screen;
mod tok... |
rust_dataset_chunk_511337 | rust_dataset.txt | 511,337 | 512 | self.subscribe_to_events();
self.state.own_plugin_id = Some(get_plugin_ids().plugin_id);
self.retrieve_token_list();
self.query_link_executable();
self.set_plugin_title();
}
fn subscribe_to_events(&self) {
subscribe(&[
EventType::Key,
Even... |
rust_dataset_chunk_511338 | rust_dataset.txt | 511,338 | 512 | .different_version_error = None;
},
WebServerStatus::DifferentVersion(version) => {
self.web_server.started = false;
self.web_server.different_version_error = Some(version);
},
}
true
}
fn handle_key_input(&mut self, key: KeyWi... |
rust_dataset_chunk_511339 | rust_dataset.txt | 511,339 | 512 | ) -> bool {
if self.tokens.handle_text_input(&key) {
return true;
}
match key.bare_key {
BareKey::Esc if key.has_no_modifiers() => self.handle_escape_key(),
BareKey::Down if key.has_no_modifiers() => self.tokens.navigate_down(),
BareKey::Up if key... |
rust_dataset_chunk_511340 | rust_dataset.txt | 511,340 | 512 | 0, &new_name) {
Ok(_) => {
self.retrieve_token_list();
if self.tokens.adjust_selection_after_list_change() {
self.change_to_main_screen();
}
},
Err(e) => self.web_server.error = Some(e),
... |
rust_dataset_chunk_511341 | rust_dataset.txt | 511,341 | 512 | self.ui.link_executable = Some("open");
}
false
}
fn handle_web_server_error(&mut self, error: String) -> bool {
self.web_server.error = Some(error);
true
}
fn query_link_executable(&self) {
let mut xdg_context = BTreeMap::new();
xdg_context.insert("xdg... |
rust_dataset_chunk_511342 | rust_dataset.txt | 511,342 | 512 | cols: usize) {
let state_changes = MainScreen::new(
self.tokens.list.is_empty(),
self.web_server.started,
&self.web_server.error,
&self.web_server.different_version_error,
&self.web_server.base_url,
self.web_server.ip,
self.web... |
rust_dataset_chunk_511343 | rust_dataset.txt | 511,343 | 512 | bool,
currently_hovering_over_unencrypted: bool,
}
impl UIState {
fn reset_render_state(&mut self) {
self.currently_hovering_over_link = false;
self.clickable_urls.clear();
}
}
#[derive(Debug, Default)]
struct TokenManager {
list: Vec<(String, String, bool)>, // bool -> is_read_only
... |
rust_dataset_chunk_511344 | rust_dataset.txt | 511,344 | 512 | }
fn handle_text_input(&mut self, key: &KeyWithModifier) -> bool {
match key.bare_key {
BareKey::Char(c) if key.has_no_modifiers() => {
if let Some(ref mut name) = self.entering_new_name {
name.push(c);
return true;
}
... |
rust_dataset_chunk_511345 | rust_dataset.txt | 511,345 | 512 | default() -> Self {
Screen::Main
}
}
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CoordinatesInLine {
x: usize,
y: usize,
width: usize,
}
impl CoordinatesInLine {
pub fn new(x: usize, y: usize, width: usize) -> Self {
CoordinatesInLine { x, y, width }
}
pub fn contain... |
rust_dataset_chunk_511346 | rust_dataset.txt | 511,346 | 512 | ,
web_server_error: &'a Option<String>,
web_server_different_version_error: &'a Option<String>,
web_server_base_url: &'a String,
web_server_ip: Option<std::net::IpAddr>,
web_server_port: Option<u16>,
session_name: &'a Option<String>,
web_sharing: WebSharing,
... |
rust_dataset_chunk_511347 | rust_dataset.txt | 511,347 | 512 | _height =
2 + web_server_height + 1 + current_session_height + 1 + usage_height;
if self.connection_is_unencrypted() {
let warning_width = self.unencrypted_warning_width();
max_width = max_width.max(warning_width);
total_height += 3;
}
Layout {
... |
rust_dataset_chunk_511348 | rust_dataset.txt | 511,348 | 512 | Layout,
y: usize,
state: &mut MainScreenState,
) -> usize {
let mut current_session_section = CurrentSessionSection::new(
self.web_server_started,
self.web_server_ip,
self.web_server_port,
self.session_name.clone(),
self.web_sharing... |
rust_dataset_chunk_511349 | rust_dataset.txt | 511,349 | 512 | _TEXT, Self::SSL_URL));
let url_x = x + Self::MORE_INFO_TEXT.chars().count();
let url_y = y + 1;
let url_width = Self::SSL_URL.chars().count();
state.clickable_urls.insert(
CoordinatesInLine::new(url_x, url_y, url_width),
Self::SSL_URL.to_owned(),
);
... |
rust_dataset_chunk_511350 | rust_dataset.txt | 511,350 | 512 | end_index: usize,
truncated_top: usize,
truncated_bottom: usize,
}
#[derive(Debug)]
struct ColumnWidths {
token: usize,
date: usize,
read_only: usize,
controls: usize,
}
pub struct TokenManagementScreen<'a> {
token_list: &'a Vec<(String, String, bool)>, // bool -> is_read_only
selecte... |
rust_dataset_chunk_511351 | rust_dataset.txt | 511,351 | 512 | date: MIN_DATE_WIDTH,
read_only: MIN_READ_ONLY_WIDTH,
controls: MIN_CONTROLS_WIDTH,
};
}
const PREFERRED_DATE_WIDTH: usize = 29; // "issued on YYYY-MM-DD HH:MM:SS"
const PREFERRED_READ_ONLY_WIDTH: usize = 10; // "read-write"
co... |
rust_dataset_chunk_511352 | rust_dataset.txt | 511,352 | 512 | include_issued_prefix: bool,
) -> String {
let full_text = if include_issued_prefix {
format!("issued on {}", created_at)
} else {
created_at.to_string()
};
if full_text.chars().count() <= max_width {
return full_text;
}
// If we... |
rust_dataset_chunk_511353 | rust_dataset.txt | 511,353 | 512 |
let padding = max_width - short_controls.chars().count();
format!("{}{}", short_controls, " ".repeat(padding))
} else {
// Very constrained space
" ".repeat(max_width)
}
}
fn calculate_max_item_height(&self) -> usize {
// Calculate fixed ... |
rust_dataset_chunk_511354 | rust_dataset.txt | 511,354 | 512 | Some(text) = &status_message {
max_width = std::cmp::max(max_width, text.len());
}
max_width = std::cmp::min(max_width, max_table_width);
ScreenContent {
title: (title_text.to_string(), title),
items,
help: (help_text, help_line),
st... |
rust_dataset_chunk_511355 | rust_dataset.txt | 511,355 | 512 | ;
let items_below = max_height.saturating_sub(items_above).saturating_sub(1); // -1 for the selected item itself
// Calculate the start and end indices
let start_index = if selected_index < items_above {
0
} else if selected_index + items_below >= total_token_items {
... |
rust_dataset_chunk_511356 | rust_dataset.txt | 511,356 | 512 | );
let controls_text = " ".repeat(column_widths.controls);
let token_end = truncated_name.chars().count();
let items = vec![
Text::from(item_text)
.color_range(0, ..token_end + 1)
.selected(),
Text::from(date_text),
Text::from(... |
rust_dataset_chunk_511357 | rust_dataset.txt | 511,357 | 512 | );
if item_text.is_empty() {
// otherwise the table gets messed up
item_text.push(' ');
};
let date_text = self.format_date(created_at, column_widths.date, true);
let read_only_text = self.format_read_only(is_read_only, column_widths.read_only);
let contro... |
rust_dataset_chunk_511358 | rust_dataset.txt | 511,358 | 512 | new token, <Enter> to submit",
41..=47,
)
} else if self.renaming_token.is_some() {
(
"Help: Enter new name for this token, <Enter> to submit",
39..=45,
)
} else {
(
"Help: <Ctrl x> - revoke ... |
rust_dataset_chunk_511359 | rust_dataset.txt | 511,359 | 512 | _y = base_y + 2; // title + spacing after title
let new_token_y = item_start_y + token_item_rows;
let help_y = new_token_y + 1 + 1; // new token line + spacing before help
Layout {
base_x: (self.cols.saturating_sub(content.max_width) as f64 / 2.0).floor() as usize,
base_... |
rust_dataset_chunk_511360 | rust_dataset.txt | 511,360 | 512 | str = "If lost, it can always be revoked and a new one generated.";
const EXPLANATION_3_SHORT: &str = "It can always be revoked and a regenerated.";
const ESC_INSTRUCTION: &str = "<Esc> - go back";
// Screen layout constants
const SCREEN_HEIGHT: usize = 7;
const TOKEN_Y_OFFSET: usize = 0;
const EXPLANATION_1_Y_OFFSET:... |
rust_dataset_chunk_511361 | rust_dataset.txt | 511,361 | 512 | );
let token_text = format!("{}{}", token_label, self.token);
let token_element = self.create_token_text_element(&token_text, token_label);
let explanation_texts: Vec<&str> = explanation_variants
.iter()
.map(|variant| variant.select(self.cols))
.collect();
... |
rust_dataset_chunk_511362 | rust_dataset.txt | 511,362 | 512 | zip(y_offsets.iter()) {
print_text_with_coordinates(explanation.clone(), base_x, base_y + y_offset, None, None);
}
print_text_with_coordinates(
elements.esc.clone(),
base_x,
base_y + ESC_Y_OFFSET,
None,
None,
);
}
... |
rust_dataset_chunk_511363 | rust_dataset.txt | 511,363 | 512 | "(<Ctrl c> - Stop)";
pub const CTRL_C_STOP_OTHER: &str = "<Ctrl c> - Stop other server";
pub const PRESS_ENTER_START: &str = "Press <ENTER> to start";
pub const ERROR_PREFIX: &str = "ERROR: ";
pub const URL_TITLE: &str = "URL: ";
pub const UNENCRYPTED_MARKER: &str = " [*]";
pub const CURRENT_SESSION_TITLE: &str = "Cu... |
rust_dataset_chunk_511364 | rust_dataset.txt | 511,364 | 512 | Self {
let end = self.text.chars().count();
self.ranges.push(ColorRange {
start: 0,
end,
color,
});
self
}
pub fn build(self) -> (Text, usize) {
let length = self.text.chars().count();
let mut text_component = Text::from(self.... |
rust_dataset_chunk_511365 | rust_dataset.txt | 511,365 | 512 | &'static str,
bulletin_2_short: &'static str,
bulletin_3_full: &'static str,
bulletin_3_short: &'static str,
bulletin_4: &'static str,
}
impl Usage {
pub fn new(has_login_tokens: bool) -> Self {
Usage {
has_login_tokens,
usage_title: USAGE_TITLE,
bulleti... |
rust_dataset_chunk_511366 | rust_dataset.txt | 511,366 | 512 | : usize, max_width: usize) {
if self.has_login_tokens {
self.render_full_usage(x, y, max_width)
} else {
self.render_first_time_usage(x, y)
}
}
pub fn render_full_usage(&self, x: usize, y: usize, max_width: usize) {
let bulletin_1 =
get_text_w... |
rust_dataset_chunk_511367 | rust_dataset.txt | 511,367 | 512 | web_server_started: bool,
web_server_base_url: String,
web_server_error: Option<String>,
web_server_different_version_error: Option<String>,
connection_is_unencrypted: bool,
pub clickable_urls: HashMap<CoordinatesInLine, String>,
pub currently_hovering_over_link: bool,
pub currently_hove... |
rust_dataset_chunk_511368 | rust_dataset.txt | 511,368 | 512 | _component(error).0;
print_text_with_coordinates(error_component, x, y + 1, None, None);
} else if let Some(different_version) = &self.web_server_different_version_error {
let version_error_component = self
.web_server_different_version_error_component(different_version)
... |
rust_dataset_chunk_511369 | rust_dataset.txt | 511,369 | 512 | _RUNNING,
COLOR_INDEX_0,
COLOR_HIGHLIGHT,
)
}
}
fn create_running_status_line(&self) -> (Text, usize) {
let full_text = format!("{}{}{}", WEB_SERVER_TITLE, WEB_SERVER_RUNNING, CTRL_C_STOP);
ColoredTextBuilder::new(full_text)
.highl... |
rust_dataset_chunk_511370 | rust_dataset.txt | 511,370 | 512 | ing_over_link: false,
connection_is_unencrypted,
}
}
pub fn current_session_status_width_and_height(&self) -> (usize, usize) {
let mut max_len = self.get_session_status_line_length();
if self.web_sharing.web_clients_allowed() && self.web_server_started {
let url... |
rust_dataset_chunk_511371 | rust_dataset.txt | 511,371 | 512 | : usize,
hover_coordinates: Option<(usize, usize)>,
) {
let session_url = self.session_url();
let url_x = x + SESSION_URL_TITLE.chars().count();
let url_width = session_url.chars().count();
let url_y = y + 1;
self.clickable_urls.insert(
CoordinatesInLine:... |
rust_dataset_chunk_511372 | rust_dataset.txt | 511,372 | 512 | unwrap_or_else(|| "UNDEFINED".to_owned());
let web_server_port = self
.web_server_port
.map(|p| p.to_string())
.unwrap_or_else(|| "UNDEFINED".to_owned());
let prefix = if self.connection_is_unencrypted {
"http"
} else {
"https"
... |
rust_dataset_chunk_511373 | rust_dataset.txt | 511,373 | 512 | Platform::is_root(&self.path, self.platform) {
return;
}
if let Some(parent) = self.path.parent() {
self.path = Platform::ensure_drive_root(parent.to_path_buf(), self.platform);
} else {
self.path = PathBuf::new();
}
self.path_is_dir = true;
... |
rust_dataset_chunk_511374 | rust_dataset.txt | 511,374 | 512 | copied()
}
pub fn move_selection_up(&mut self) {
if let Some(selected) = self.selected() {
*self.selected_mut() = selected.saturating_sub(1);
}
}
pub fn move_selection_down(&mut self) {
if let Some(selected) = self.selected() {
let next = selected.satura... |
rust_dataset_chunk_511375 | rust_dataset.txt | 511,375 | 512 | , Ord, Clone, Debug)]
pub enum FsEntry {
Dir(PathBuf),
File(PathBuf, u64),
}
impl FsEntry {
pub fn name(&self) -> String {
let path = match self {
FsEntry::Dir(p) => p,
FsEntry::File(p, _) => p,
};
path.file_name().unwrap().to_string_lossy().into_owned()
... |
rust_dataset_chunk_511376 | rust_dataset.txt | 511,376 | 512 | EventType::Mouse,
EventType::CustomMessage,
EventType::Timer,
EventType::FileSystemUpdate,
EventType::HostFolderChanged,
EventType::PermissionRequestResult,
]);
self.file_list_view.clear_selected();
match configuration
.ge... |
rust_dataset_chunk_511377 | rust_dataset.txt | 511,377 | 512 | () => {
self.traverse_dir();
should_render = true;
},
BareKey::Left if key.has_no_modifiers() => {
if !self.is_in_virtual_root {
self.descend_to_previous_path();
}
... |
rust_dataset_chunk_511378 | rust_dataset.txt | 511,378 | 512 | .is_in_virtual_root {
render_search_term("");
render_virtual_root_header(cols);
self.render_virtual_root(rows_for_list, cols);
} else {
render_search_term(&self.search_term);
render_current_path(
&self.file_list_view.path,
... |
rust_dataset_chunk_511379 | rust_dataset.txt | 511,379 | 512 | Identity on Unix.
pub fn to_host_display(path: &Path, platform: Platform) -> String {
let s = path.to_string_lossy();
match platform {
Platform::Windows => s.replace('/', "\\"),
Platform::Unix => s.into_owned(),
}
}
/// Path separator character for the host ... |
rust_dataset_chunk_511380 | rust_dataset.txt | 511,380 | 512 | match platform {
Platform::Unix => s == "/" || s.is_empty(),
Platform::Windows => {
let bytes = s.as_bytes();
// Drive root: "C:/" or "C:"
let is_drive_root_slash = s.len() == 3
&& matches!(bytes.get(0), Some(c) if c.is_... |
rust_dataset_chunk_511381 | rust_dataset.txt | 511,381 | 512 | PathBuf::from("C:/Users/user");
assert_eq!(
Platform::to_host_display(&p, Platform::Windows),
"C:\\Users\\user"
);
}
#[test]
fn to_host_display_unix() {
let p = PathBuf::from("/home/user");
assert_eq!(Platform::to_host_display(&p, Platform::Unix), "/... |
rust_dataset_chunk_511382 | rust_dataset.txt | 511,382 | 512 | MatcherV2;
use fuzzy_matcher::FuzzyMatcher;
use zellij_tile::prelude::*;
#[derive(Default, Debug)]
pub struct SearchView {
pub search_results: Vec<SearchResult>,
pub selected_search_result: usize,
pub platform: Platform,
}
impl SearchView {
pub fn search_result_count(&self) -> usize {
self.sea... |
rust_dataset_chunk_511383 | rust_dataset.txt | 511,383 | 512 | _size)
.unwrap_or("".to_owned());
if search_result.is_folder() {
search_result_text.push(self.platform.separator());
}
let search_result_text_width =
zellij_tile::graphemes::display_width(&search_result_text);
... |
rust_dataset_chunk_511384 | rust_dataset.txt | 511,384 | 512 | >, go to root with /, <Ctrl e> - toggle hidden files";
let text = Text::from(text)
.color_range(3, 19..27)
.color_range(3, 45..46)
.color_range(3, 48..56);
print_text_with_coordinates(text, 0, y, Some(max_cols), None);
} else if max_cols > 56 {
let text = ... |
rust_dataset_chunk_511385 | rust_dataset.txt | 511,385 | 512 | room_in_list = room_in_list.saturating_sub(1);
} else if start_index > 0 {
start_index = start_index.saturating_sub(1);
room_in_list = room_in_list.saturating_sub(1);
} else if end_index < result_count {
end_index += 1;
... |
rust_dataset_chunk_511386 | rust_dataset.txt | 511,386 | 512 | )",
prompt, current_path, enter_tip
))
.color_range(2, 0..prompt_chars)
.color_range(0, prompt_chars..path_end)
.color_range(3, path_end + 2..path_end + 9);
print_text(current_path);
} else {
let max_path_len = max_cols
.saturating_sub(prompt_l... |
rust_dataset_chunk_511387 | rust_dataset.txt | 511,387 | 512 | "MB", "GB", "TB", "PB", "EB"];
let mut value = bytes as f64;
let mut unit = 0;
while value >= 1000.0 && unit < UNITS.len() - 1 {
value /= 1000.0;
unit += 1;
}
let rounded = (value * 100.0).round() / 100.0;
format!("{} {}", rounded, UNITS[unit])
}
--- FILE: zellij/default-plugi... |
rust_dataset_chunk_511388 | rust_dataset.txt | 511,388 | 512 | {
self.is_searching = false;
}
self.search_view
.update_search_results(&self.search_term, &self.file_list_view.files);
}
}
pub fn clear_search_term(&mut self) {
self.search_term.clear();
self.search_view
.update_search_... |
rust_dataset_chunk_511389 | rust_dataset.txt | 511,389 | 512 | , _end_index) = calculate_list_bounds(
self.search_view.search_result_count(),
rows_for_list,
Some(self.search_view.selected_search_result),
);
let prev_selected = self.search_view.selected_search_result;
self.se... |
rust_dataset_chunk_511390 | rust_dataset.txt | 511,390 | 512 | _reset_selection();
if self.platform == Platform::Windows
&& Platform::is_root(&self.file_list_view.path, self.platform)
{
self.enter_virtual_root();
} else {
self.file_list_view.descend_to_previous_path();
}
}
pub fn descend_to_root_path(&mut ... |
rust_dataset_chunk_511391 | rust_dataset.txt | 511,391 | 512 | update_files(paths, self.hide_hidden_files);
}
}
pub fn open_selected_path(&mut self) {
if self.file_list_view.path_is_dir {
if self.close_on_selection {
open_terminal_in_place_of_plugin(&self.file_list_view.path, true);
} else {
open_termi... |
rust_dataset_chunk_511392 | rust_dataset.txt | 511,392 | 512 | (b))
});
self.virtual_root_entries = entries;
if self.virtual_root_selected >= self.virtual_root_entries.len() {
self.virtual_root_selected = 0;
}
}
pub fn render_virtual_root(&self, rows: usize, cols: usize) {
let (start_index, selected_index_in_range, end_in... |
rust_dataset_chunk_511393 | rust_dataset.txt | 511,393 | 512 | "wasm")]
unblock_cli_pipe_input(pipe_id);
#[cfg(target_family = "wasm")]
close_self();
},
_ => {},
}
}
}
pub(crate) fn refresh_directory(full_path: &Path) {
change_host_folder(PathBuf::from(full_path));
}
--- FILE: zellij/exampl... |
rust_dataset_chunk_511394 | rust_dataset.txt | 511,394 | 512 | ")));
let wasm = if wasm.exists() {
wasm
} else {
target_dir
.join(TARGET)
.join("release")
.join(format!("{}.wasm", PLUGIN))
};
assert!(
wasm.exists(),
"'{}' built successfully but no wasm artifact was found at '{}'",
PLUGIN,
... |
rust_dataset_chunk_511395 | rust_dataset.txt | 511,395 | 512 | self.permission_prompts_seen
))
.color_range(
if self.permission_prompts_seen == 0 { 3 } else { 1 },
..,
),
&mut row,
);
row += 1;
if self.updates_received == 0 {
line(Text::new("waiting ... |
rust_dataset_chunk_511396 | rust_dataset.txt | 511,396 | 512 | could not find its own location: {}", e))?;
let program = target_of(&launcher).ok_or_else(|| {
format!(
"{} is not named <program>{}, so there is no program to start.",
launcher.display(),
LAUNCHER_SUFFIX
)
})?;
if !program.is_file() {
return Err(... |
rust_dataset_chunk_511397 | rust_dataset.txt | 511,397 | 512 | name cannot hold a quote, so it is put right.
fn repaired_folder(folder: OsString) -> OsString {
if !cfg!(windows) {
return folder;
}
let Some(trimmed) = folder.to_str().and_then(|text| text.strip_suffix('"')) else {
return folder;
};
if trimmed.ends_with(':') {
OsString::fr... |
rust_dataset_chunk_511398 | rust_dataset.txt | 511,398 | 512 | args(arguments)
.creation_flags(CREATE_NO_WINDOW)
.stdin(Stdio::null())
.stdout(Stdio::null())
.stderr(Stdio::null());
if let Some(start_in) = start_in {
command.current_dir(start_in);
}
let child = command
.spawn()
.map_err(|e| format!("{} could not b... |
rust_dataset_chunk_511399 | rust_dataset.txt | 511,399 | 512 | assert_eq!(
target_of(&dir.join(executable("acme-terminal"))),
Some(dir.join(executable("acme"))),
"a renamed launcher for another distribution starts that distribution"
);
}
#[test]
fn a_dot_or_capitals_in_the_name_do_not_confuse_the_target() {
l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.