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_510600 | rust_dataset.txt | 510,600 | 512 | (_) | None => {
if self.editing.is_none() && !self.actions_focused {
let first_text = self
.group
.keys()
.into_iter()
.find(|key| matches!(key, FormKey::Text(_)));
mat... |
rust_dataset_chunk_510601 | rust_dataset.txt | 510,601 | 512 | = self.field_keys().last().copied() {
self.group.focus(&last);
}
return FormResult::Pending;
}
if let Some((_, picker)) = self.picker.as_mut() {
let response = picker.handle_key(key);
return self.dialog_picker_r... |
rust_dataset_chunk_510602 | rust_dataset.txt | 510,602 | 512 | _handled() {
if matches!(mouse, Mouse::LeftClick(..)) {
self.actions_focused = false;
}
return self.handle_event(event, self.base_mode, self.for_menu, false);
}
if let Some((_, picker)) = self.picker.as_mut() {
let response = picker.handle_... |
rust_dataset_chunk_510603 | rust_dataset.txt | 510,603 | 512 | (max_width),
(wanted + 3).min(max_height),
),
(true, _) => (
DIALOG_WIDE_WIDTH.min(max_width),
max_height.min(DIALOG_TALL_HEIGHT),
),
(false, Some(Some(wanted))) => (
(content_column + natural_width + extra +... |
rust_dataset_chunk_510604 | rust_dataset.txt | 510,604 | 512 | (|k| *k == focused));
let visible = self
.scroll
.layout(x, y, inner, field_rows, field_count, focused_field);
let row_field_width = natural_width
.min(self.scroll.row_width().saturating_sub(content_column))
.max(5);
let mut row = y;
for ke... |
rust_dataset_chunk_510605 | rust_dataset.txt | 510,605 | 512 | .filter_map(|key| self.group.button(key).map(|b| b.natural_width()))
.collect();
let total = widths.iter().sum::<usize>() + 2 * widths.len().saturating_sub(1);
let mut column = x + inner.saturating_sub(total) / 2;
for key in buttons {
if let Some(Elem... |
rust_dataset_chunk_510606 | rust_dataset.txt | 510,606 | 512 | self) -> Vec<FieldValue> {
self.read_values();
self.values.clone()
}
#[cfg(test)]
pub fn set_text(&mut self, index: usize, text: &str) {
if let Some(input) = self.group.text_input_mut(&FormKey::Text(index)) {
input.set_text(text);
}
if let Some(value) = s... |
rust_dataset_chunk_510607 | rust_dataset.txt | 510,607 | 512 | PairKey(index, pair_index)));
FormResult::Pending
},
(FormKey::Actions(index), UiResponse::Activated) => {
self.read_values();
let actions = self.values[index].actions();
let label = self.specs[index].label;
self.pic... |
rust_dataset_chunk_510608 | rust_dataset.txt | 510,608 | 512 | if is_plain(key, BareKey::Enter) && focused.is_none() {
return FormResult::Apply;
}
}
self.handle_event(event, base_mode, for_menu, true)
}
fn handle_mouse(
&mut self,
mouse: Mouse,
base_mode: Option<InputMode>,
for_menu: bool,
) -... |
rust_dataset_chunk_510609 | rust_dataset.txt | 510,609 | 512 | >", "field"),
("<Enter>", "apply"),
("<Esc>", "cancel"),
],
}
}
fn render(&mut self, x: usize, y: usize, width: usize, height: usize) {
if let Some((_, picker)) = self.picker.as_mut() {
self.group.clear_areas();
picker.render(x,... |
rust_dataset_chunk_510610 | rust_dataset.txt | 510,610 | 512 | );
}
}
fn render_overlays(&mut self, rows: usize, cols: usize) {
if self.dialog {
self.render_dialog(rows, cols);
return;
}
match self.picker.as_mut() {
Some((_, picker)) => picker.render_overlays(rows, cols),
None => {
... |
rust_dataset_chunk_510611 | rust_dataset.txt | 510,611 | 512 | {
form.into_dialog(self.base_mode, self.for_menu)
} else {
form
}
}
pub fn set_entries(
&mut self,
current: Vec<K::Entry>,
saved: Vec<K::Entry>,
defaults: Vec<K::Entry>,
) {
self.current = current;
self.saved = saved;
... |
rust_dataset_chunk_510612 | rust_dataset.txt | 510,612 | 512 | ;
true
}
fn follow_entry(&mut self, index: usize) {
self.follow = match self.current.get(index) {
Some(entry) if !self.kind.ordered() => {
Some(Follow::Identity(self.kind.identity(entry)))
},
_ => Some(Follow::Index(index)),
};
}
... |
rust_dataset_chunk_510613 | rust_dataset.txt | 510,613 | 512 | (form) = self.form.as_mut() {
form.error = Some(format!("{} already exists", identity));
}
return false;
}
}
let mut list = self.current.clone();
let position = match editing {
Some(index) if index < list.len() => {
... |
rust_dataset_chunk_510614 | rust_dataset.txt | 510,614 | 512 | .title()));
} else {
match self.find(&self.saved, &entry).cloned() {
Some(saved_entry) => list[index] = saved_entry,
None => {
list.remove(index);
},
}
self.notice = Some(format!("Reverted the {}", self.kind.... |
rust_dataset_chunk_510615 | rust_dataset.txt | 510,615 | 512 | fn answer_delete(&mut self, request_id: u64, result: &PromptResult) -> bool {
match self.pending_delete {
Some((pending_id, index)) if pending_id == request_id => {
self.pending_delete = None;
if crate::page::removal_confirmed(result) {
self.delet... |
rust_dataset_chunk_510616 | rust_dataset.txt | 510,616 | 512 | only be opened, not edited, added, deleted or reverted.
fn read_only(&self) -> bool {
false
}
fn heading_note(&self) -> Option<String> {
None
}
fn prompt_result(&mut self, _request_id: u64, _result: &PromptResult) -> bool {
false
}
#[cfg(test)]
fn waits_for_promp... |
rust_dataset_chunk_510617 | rust_dataset.txt | 510,617 | 512 | _entries(current, saved, defaults);
}
fn len(&self) -> usize {
self.current.len()
}
fn columns(&self, index: usize) -> Vec<String> {
self.current
.get(index)
.map(|entry| self.kind.columns(entry))
.unwrap_or_default()
}
fn marker(&self, index: ... |
rust_dataset_chunk_510618 | rust_dataset.txt | 510,618 | 512 | self.apply_list(list) {
Some(Box::new(entry))
} else {
None
}
}
fn insert_entry(&mut self, index: usize, entry: Box<dyn Any>) -> Result<(), Box<dyn Any>> {
let entry = entry.downcast::<K::Entry>()?;
let mut list = self.current.clone();
let positio... |
rust_dataset_chunk_510619 | rust_dataset.txt | 510,619 | 512 | self.dialog_form
}
fn render_overlays(&mut self, rows: usize, cols: usize) {
if let Some(form) = self.form.as_mut() {
form.render_overlays(rows, cols);
}
}
fn busy_hints(&self) -> Vec<(&'static str, &'static str)> {
self.form
.as_ref()
.map(|f... |
rust_dataset_chunk_510620 | rust_dataset.txt | 510,620 | 512 | <usize>>,
score: (usize, usize),
}
fn match_columns(query: &str, columns: &[String]) -> Option<EntryMatch> {
let candidate = columns.join(" ");
let indices = fuzzy_match_indices(query, &candidate)?;
let first = indices.first().copied().unwrap_or(0);
let last = indices.last().copied().unwrap_or(0);
... |
rust_dataset_chunk_510621 | rust_dataset.txt | 510,621 | 512 | if let Some(shortcut) = columns.get(offset + 2) {
styles.push((offset + 2, DIM, 0..shortcut.chars().count()));
}
if let Some(found) = found {
for (column, indices) in found.columns.iter().enumerate() {
for index in indices {
styles.push((offset + column, 1, *index... |
rust_dataset_chunk_510622 | rust_dataset.txt | 510,622 | 512 | .filter.is_open()))
}
fn select_first_entry(&mut self) {
let rows = self.rows();
let first = rows.iter().find(|row| row.selectable()).or(rows.first());
if let Some(row) = first.copied() {
self.select(row);
}
self.scroll.reset();
}
fn styled_columns(&se... |
rust_dataset_chunk_510623 | rust_dataset.txt | 510,623 | 512 | BareKey::Left) {
return Some(false);
}
match self.filter.handle_key(key) {
UiResponse::Changed(_) => {
self.select_first_entry();
Some(true)
},
UiResponse::Not... |
rust_dataset_chunk_510624 | rust_dataset.txt | 510,624 | 512 | (&mouse) {
if self.search.hit_test(line, column) {
self.header_focus = HeaderFocus::Search;
return Some(true);
}
}
let mouse = outside_overlays(mouse);
let mut activated = None;
let mut changed = false;
for (section, buttons... |
rust_dataset_chunk_510625 | rust_dataset.txt | 510,625 | 512 | self.scroll.hovered = hovered_row;
self.hovered_action =
row_index.and_then(|index| self.action_at(index, column).map(|action| (index, action)));
before != (self.scroll.hovered, self.hovered_action)
}
fn layouts(&self, width: usize) -> Vec<ColumnLayout> {
let rows: Ve... |
rust_dataset_chunk_510626 | rust_dataset.txt | 510,626 | 512 | usize, usize))> = vec![];
for (section_index, section) in self.sections.iter().enumerate() {
for entry in 0..section.len() {
let columns = section.columns(entry);
if let Some(matched) = match_columns(&query, &columns) {
found.pu... |
rust_dataset_chunk_510627 | rust_dataset.txt | 510,627 | 512 | = fallback
.or_else(|| rows.iter().find(|row| row.selectable()).copied())
.or_else(|| rows.first().copied())
.unwrap_or(Row::Actions(0));
}
return;
}
let row = match self.selected {
Row::Entry(section, entry... |
rust_dataset_chunk_510628 | rust_dataset.txt | 510,628 | 512 | self.sections
.iter()
.any(|section| section.waits_for_prompt())
}
pub fn prompt_result(&mut self, request_id: u64, result: &PromptResult) -> bool {
let handled = self
.sections
.iter_mut()
.any(|section| section.prompt_result(request_id, resu... |
rust_dataset_chunk_510629 | rust_dataset.txt | 510,629 | 512 | else { self.sections[target].len() };
if let Err(taken) = self.sections[target].insert_entry(position, taken) {
let _ = self.sections[section].insert_entry(entry, taken);
}
}
pub fn handle_key(&mut self, key: &KeyWithModifier) -> bool {
if let Some(busy) = self.busy_section(... |
rust_dataset_chunk_510630 | rust_dataset.txt | 510,630 | 512 | {
match self.selected {
Row::Entry(section, entry) => self.sections[section].open_edit(entry),
Row::Actions(section) => {
self.sections[section].run_action(self.action_choice, None)
},
_ => return false,
}
... |
rust_dataset_chunk_510631 | rust_dataset.txt | 510,631 | 512 | (row);
}
},
Row::Actions(section) => match self.action_at(row_index, column) {
Some(action) => {
self.select(row);
self.action_choice = action;
self.sections[section].run_action(action, None);
... |
rust_dataset_chunk_510632 | rust_dataset.txt | 510,632 | 512 | 2;
let mut spans = vec![];
for (index, label) in self.sections[section].actions().iter().enumerate() {
let label_width = label.chars().count();
if column + label_width > x + width {
break;
... |
rust_dataset_chunk_510633 | rust_dataset.txt | 510,633 | 512 | .enumerate()
.filter_map(|(index, row)| match row {
Row::Entry(section, entry) => {
let columns = self.styled_columns(*section, *entry);
let found = if searching {
match_columns(&query, &columns[offset..])
}... |
rust_dataset_chunk_510634 | rust_dataset.txt | 510,634 | 512 | .natural_width("● unsaved".chars().count()))
.max()
.unwrap_or(0)
.max(headings_width);
let list_width = RowScroll::fitted_width(rows.len(), list_height, content_width, width);
let selected_index = rows.iter().position(|row| *row == self.selected);
let visible... |
rust_dataset_chunk_510635 | rust_dataset.txt | 510,635 | 512 | )
.dim_range(length..),
x,
screen_y,
None,
None,
);
},
Row::Actions(section) => {
self.prepare_section_buttons(section);
... |
rust_dataset_chunk_510636 | rust_dataset.txt | 510,636 | 512 | pub fn render_overlays(&mut self, rows: usize, cols: usize) {
if self.styled.is_some() && self.filter.is_open() {
self.filter.render_overlay(rows, cols);
note_dropdown(&self.filter);
}
if let Some(busy) = self.busy_section() {
self.sections[busy].render_overl... |
rust_dataset_chunk_510637 | rust_dataset.txt | 510,637 | 512 | if self.styled.is_some() {
hints.push(("</>", "search"));
}
hints
}
pub fn take_effects(&mut self) -> Vec<Effect> {
std::mem::take(&mut self.effects)
}
pub fn take_notice(&mut self) -> Option<String> {
self.notice.take()
}
pub fn close(&mut sel... |
rust_dataset_chunk_510638 | rust_dataset.txt | 510,638 | 512 | separator(&self) -> Option<Pair> {
if self.ordered {
Some(Pair("-".to_owned(), String::new()))
} else {
None
}
}
fn unique_identity(&self) -> bool {
!self.ordered
}
}
fn pair(name: &str, value: &str) -> Pai... |
rust_dataset_chunk_510639 | rust_dataset.txt | 510,639 | 512 | ReplaceBlocks("A=1,B=2,C=3".to_owned())]
);
assert!(editor.is_unsaved(2));
assert!(!editor.is_unsaved(0));
assert!(editor.is_default(0));
assert!(!editor.is_default(1));
assert_eq!(Section::marker(&editor, 2), "● unsaved");
assert_eq!(Section::marker(&editor, 0), ... |
rust_dataset_chunk_510640 | rust_dataset.txt | 510,640 | 512 | ReplaceBlocks("B=2,A=9".to_owned())]
);
assert!(editor.is_unsaved(1));
Section::revert(&mut editor, 1);
assert_eq!(
Section::take_effects(&mut editor),
vec![Effect::Revert(SettingKey::Env)]
);
}
#[test]
fn the_edit_form_has_delete_and_revert_b... |
rust_dataset_chunk_510641 | rust_dataset.txt | 510,641 | 512 | .take_effects(),
vec![
Effect::ReplaceBlocks("A=1".to_owned()),
Effect::ReplaceBlocks("B=2,C=3".to_owned()),
]
);
assert_eq!(list.selected(), Row::Entry(1, 0));
list.handle_key(&KeyWithModifier::new(BareKey::Up).with_alt_modifier());
... |
rust_dataset_chunk_510642 | rust_dataset.txt | 510,642 | 512 | .text_input(&FormKey::Text(1)).is_some());
form.choose(0, "separator");
assert!(form.group.text_input(&FormKey::Text(1)).is_none());
assert_eq!(form.values()[1], FieldValue::Text("Hi".to_owned()));
}
#[test]
fn a_styled_list_searches_every_section() {
let mut list = list(fal... |
rust_dataset_chunk_510643 | rust_dataset.txt | 510,643 | 512 | ), index.to_string()))
.collect();
let mut form = EntryForm::new(
"Edit".to_owned(),
None,
vec![FieldSpec::pairs("Config")],
vec![FieldValue::Pairs(pairs)],
vec![],
)
.into_dialog(None, false);
let last = form.field_... |
rust_dataset_chunk_510644 | rust_dataset.txt | 510,644 | 512 | 100)));
assert!(list.handle_mouse(Mouse::LeftClick(30, 100)));
}
}
--- FILE: zellij/default-plugins/configuration/src/main.rs ---
mod action_picker;
mod bindings_list;
mod blocks_screen;
mod contrast;
mod help;
mod keybindings_screen;
mod keys_screen;
mod list_editor;
mod mousebindings_screen;
mod page;
... |
rust_dataset_chunk_510645 | rust_dataset.txt | 510,645 | 512 | ,
EventType::ModeUpdate,
EventType::AvailableKeybindPresets,
EventType::ConfigFileChangedSinceRead,
EventType::BeforeClose,
EventType::Visible,
EventType::PromptResult,
EventType::DesktopIntegration,
... |
rust_dataset_chunk_510646 | rust_dataset.txt | 510,646 | 512 | },
Event::FailedToWriteConfigToDisk(config_file_path) => {
settings_screen.config_write_failed(config_file_path);
true
},
Event::ConfigChangesDropped(dropped) => {
settings_screen.changes_dropped(dropped);
... |
rust_dataset_chunk_510647 | rust_dataset.txt | 510,647 | 512 | Clicks";
const MULTI_CLICKS: &str = "Double and triple clicks";
const SCROLLING: &str = "Scrolling";
const FRAME: &str = "Frame";
const PASSED: &str = "Passed to app / Ignored";
const OTHER: &str = "Other actions";
const VARIES: &str = "Varies by mode";
const VARIES_TEXT: &str = "varies by mode";
const CATEGORY_ORDER: ... |
rust_dataset_chunk_510648 | rust_dataset.txt | 510,648 | 512 | match chars.peek() {
None | Some(';') | Some('{') => break,
Some('"') => {
chars.next();
let mut value = String::new();
while let Some(c) = chars.next() {
match c {
'\\' => {
... |
rust_dataset_chunk_510649 | rust_dataset.txt | 510,649 | 512 | ".to_owned());
}
if let Some(behaviour) = actions.iter().find(|action| is_behaviour(action)) {
let name = action_parts(behaviour)
.map(|(name, _)| name)
.unwrap_or_default();
if actions.len() > 1 {
return Err(format!("{} must be the only item in a mouse bindin... |
rust_dataset_chunk_510650 | rust_dataset.txt | 510,650 | 512 | : Vec<MousebindingEntry>,
source: KeybindingSource,
uniform: bool,
}
impl MouseRow {
pub fn single(entry: MousebindingEntry) -> Self {
MouseRow {
mode: Some(entry.mode),
trigger: entry.trigger.clone(),
source: entry.source.clone(),
entries: vec![entry... |
rust_dataset_chunk_510651 | rust_dataset.txt | 510,651 | 512 | .varies() => "some modes".to_owned(),
None => scope_text(None),
}
}
}
pub fn rows_for(entries: Vec<MousebindingEntry>) -> Vec<MouseRow> {
let mut by_trigger: BTreeMap<MouseTrigger, Vec<MousebindingEntry>> = BTreeMap::new();
for entry in &entries {
by_trigger
.entry(e... |
rust_dataset_chunk_510652 | rust_dataset.txt | 510,652 | 512 | dl(),
scope_text(mode)
));
}
}
warnings
}
pub fn removal_effects(row: &MouseRow) -> Result<Vec<Effect>, String> {
if row.is_unbound() {
return Err(format!(
"{} is already deleted; r brings back the preset's binding",
row.trigger
))... |
rust_dataset_chunk_510653 | rust_dataset.txt | 510,653 | 512 | bound)".to_owned(),
}
};
vec![self.label(), actions]
}
fn dim_actions(&self) -> bool {
self.varies()
}
fn search_actions(&self) -> String {
if !self.varies() {
return self.columns()[1].clone();
}
let mut summaries: Vec<String> = vec... |
rust_dataset_chunk_510654 | rust_dataset.txt | 510,654 | 512 | ,
fields: FocusGroup<Field>,
picker: ActionPicker,
on_actions: bool,
error: Option<String>,
}
impl MouseForm {
fn new(
mode: Option<InputMode>,
original: Option<MouseRow>,
trigger: MouseTrigger,
actions: Vec<String>,
app_first: Option<bool>,
) -> Self {
... |
rust_dataset_chunk_510655 | rust_dataset.txt | 510,655 | 512 | First);
}
keys
}
fn rebuild_fields(&mut self) {
let focused = self.fields.focused_key().copied();
let mut fields = FocusGroup::new().wrap(false);
for key in self.field_keys() {
match key {
Field::Button => {
let options: Vec... |
rust_dataset_chunk_510656 | rust_dataset.txt | 510,656 | 512 | ) {
self.button = *button;
}
},
(Field::Clicks, UiValue::Choice { index, .. }) => {
self.clicks = (index as u8 + 1).clamp(1, 3);
},
(Field::Ctrl, UiValue::Bool(on)) => self.ctrl = on,
(Field::Alt, UiValue::Bo... |
rust_dataset_chunk_510657 | rust_dataset.txt | 510,657 | 512 | Self {
MousebindingsScreen {
list: BindingsList::new(TEXTS),
form: None,
dialog: ConfirmDialog::new("", ""),
dialog_purpose: None,
effects: vec![],
notice: None,
preset_name: String::new(),
}
}
}
impl Mousebindings... |
rust_dataset_chunk_510658 | rust_dataset.txt | 510,658 | 512 | if confirmed {
self.apply_form(actions);
} else {
self.notice = Some("Change the trigger, or Esc to stop".to_owned());
}
},
None => {},
}
}
fn finish_form(&mut self, actions: Vec<String>) {
let Some(... |
rust_dataset_chunk_510659 | rust_dataset.txt | 510,659 | 512 | &KeyWithModifier) {
let Some(form) = self.form.as_mut() else {
return;
};
let down = is_plain(key, BareKey::Down) || is_plain(key, BareKey::Tab);
let up = is_plain(key, BareKey::Up) || is_shift_tab(key);
if !form.on_actions {
let dropdown_open = form.fiel... |
rust_dataset_chunk_510660 | rust_dataset.txt | 510,660 | 512 | Add => {
self.open_add();
PageResponse::Handled
},
ListResponse::Edit => {
self.open_edit();
PageResponse::Handled
},
}
}
fn render_form(&mut self, rows: usize, cols: usize) {
let warnings = match... |
rust_dataset_chunk_510661 | rust_dataset.txt | 510,661 | 512 | _height);
let x = dialog_x + 2;
let y = dialog_y + 2;
let width = dialog_width.saturating_sub(4);
let bottom = dialog_y + dialog_height.saturating_sub(2);
let button_width = natural_button_width
.min(width.saturating_sub(content_column))
.max(5);
f... |
rust_dataset_chunk_510662 | rust_dataset.txt | 510,662 | 512 | lays(rows, cols);
form.fields.render_overlays(rows, cols);
note_group(&form.fields);
note_overlay(Rect::new(dialog_x, dialog_y, dialog_width, dialog_height));
}
}
impl Page for MousebindingsScreen {
fn set_snapshot(&mut self, snapshot: &ConfigSnapshot) {
let active = &snapshot.k... |
rust_dataset_chunk_510663 | rust_dataset.txt | 510,663 | 512 | .list.render_overlays(rows, cols);
self.render_form(rows, cols);
self.dialog.render_centered(rows, cols);
}
fn captures_keys(&self) -> bool {
self.form.is_some() || self.dialog.is_open() || self.list.captures_keys()
}
fn hints(&self) -> Vec<(&'static str, &'static str)> {
... |
rust_dataset_chunk_510664 | rust_dataset.txt | 510,664 | 512 | ().value().to_owned(), arguments))
}
#[test]
fn the_quick_parser_reads_every_default_action_like_the_kdl_parser() {
let config = zellij_utils::input::config::Config::from_default_assets().unwrap();
let mut texts: Vec<String> =
zellij_utils::input::config_blocks::keybinding_entri... |
rust_dataset_chunk_510665 | rust_dataset.txt | 510,665 | 512 | ok()
);
assert!(!default_app_first(&["DrawFloatingPane".to_owned()]));
let trigger = MouseTrigger::parse("Ctrl Left", MouseTarget::Content).unwrap();
assert_eq!(
mouse_category(&trigger, &["DrawFloatingPane".to_owned()]),
CLICKS
);
}
}
#[cfg(test)]
mo... |
rust_dataset_chunk_510666 | rust_dataset.txt | 510,666 | 512 | effects
.iter()
.filter_map(|effect| match effect {
Effect::Reconfigure(kdl) => Some(kdl.clone()),
_ => None,
})
.collect()
}
#[test]
fn the_same_trigger_in_the_same_mode_is_a_conflict() {
let rows = singles(vec... |
rust_dataset_chunk_510667 | rust_dataset.txt | 510,667 | 512 | .take_effects();
assert_eq!(effects.len(), 1);
assert!(screen.form.is_none());
}
#[test]
fn an_anywhere_binding_is_warned_about_a_more_specific_one() {
let rows = singles(vec![entry(
InputMode::Normal,
"Left",
MouseTarget::Frame,
&["Mo... |
rust_dataset_chunk_510668 | rust_dataset.txt | 510,668 | 512 | let all = rows_for(everywhere(
"Left",
MouseTarget::Any,
&["Select"],
KeybindingSource::Preset,
));
assert!(
trigger_warnings(&all, None, &trigger("Double Left", MouseTarget::Any), None)
.is_empty()
);
le... |
rust_dataset_chunk_510669 | rust_dataset.txt | 510,669 | 512 | everywhere(
"Right",
MouseTarget::Any,
&["ContextMenu"],
KeybindingSource::Preset,
),
);
let effects = removal_effects(&preset).unwrap();
assert_eq!(
effects,
vec![Effect::Reconfigure(... |
rust_dataset_chunk_510670 | rust_dataset.txt | 510,670 | 512 | !(screen
.take_notice()
.unwrap()
.contains("already uses the preset's binding"));
select(&mut screen, MouseButton::Middle);
press(&mut screen, 'r');
assert_eq!(
screen.take_effects(),
vec![Effect::ResetMousebinds(vec![(
... |
rust_dataset_chunk_510671 | rust_dataset.txt | 510,671 | 512 | _binding_first() {
let original = MouseRow::single(entry(
InputMode::Normal,
"Left",
MouseTarget::Frame,
&["MovePane"],
KeybindingSource::Preset,
));
let normal = Some(InputMode::Normal);
let effects = binding_effects(
... |
rust_dataset_chunk_510672 | rust_dataset.txt | 510,672 | 512 | \""));
}
#[test]
fn app_first_is_only_written_when_it_differs_from_the_default() {
let click = vec!["Click".to_owned()];
let new_pane = vec!["NewPane".to_owned()];
assert!(default_app_first(&click));
assert!(!default_app_first(&new_pane));
assert!(default_app_first(&... |
rust_dataset_chunk_510673 | rust_dataset.txt | 510,673 | 512 | KeybindingSource::Preset,
);
middle.pop();
entries.extend(middle);
let mut screen = MousebindingsScreen::default();
screen.set_entries(entries);
let rows = screen.visible();
assert_eq!(rows.len(), 3);
assert!(rows.iter().all(|row| row.mode.is_none()));
... |
rust_dataset_chunk_510674 | rust_dataset.txt | 510,674 | 512 | _form(vec!["NewTab".to_owned()]);
let kdl = reconfigured(&screen.take_effects());
assert_eq!(
kdl,
vec![
"mousebinds {\n normal {\n bind \"Middle\" { NewTab; }\n }\n}\n"
.to_owned()
]
);
}
#[test]
f... |
rust_dataset_chunk_510675 | rust_dataset.txt | 510,675 | 512 | (
InputMode::Normal,
text,
target,
actions,
KeybindingSource::Preset,
))
.category()
};
assert_eq!(category("Left", MouseTarget::Any, &["Click"]), CLICKS);
assert_eq!(category("Left", MouseTar... |
rust_dataset_chunk_510676 | rust_dataset.txt | 510,676 | 512 | _owned()]);
assert!(screen.form.is_some());
assert!(screen.form.as_ref().unwrap().error.is_some());
assert!(screen.take_effects().is_empty());
screen.finish_form(vec!["Select".to_owned()]);
assert!(screen.form.is_none());
assert_eq!(screen.take_effects().len(), 1);
}
... |
rust_dataset_chunk_510677 | rust_dataset.txt | 510,677 | 512 | ("Confirm")
.message(question)
.buttons("Delete", "Cancel")
}
pub fn removal_confirmed(result: &PromptResult) -> bool {
match result {
PromptResult::Answered(PromptValue::Form(values)) => {
if values.get(DONT_ASK_AGAIN) == Some(&PromptValue::Bool(true)) {
CONFIRM... |
rust_dataset_chunk_510678 | rust_dataset.txt | 510,678 | 512 | => Mouse::Hover(-1, 0),
other => other,
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum Effect {
Reconfigure(String),
ReplaceBlocks(String),
Revert(SettingKey),
ResetKeys(Vec<(InputMode, KeyWithModifier)>),
ResetMousebinds(Vec<(InputMode, MouseTrigger)>),
SwitchMode(InputMode),
... |
rust_dataset_chunk_510679 | rust_dataset.txt | 510,679 | 512 | : usize, height: usize);
fn render_overlays(&mut self, _rows: usize, _cols: usize) {}
fn captures_keys(&self) -> bool;
fn hints(&self) -> Vec<(&'static str, &'static str)>;
fn take_effects(&mut self) -> Vec<Effect>;
fn take_notice(&mut self) -> Option<String>;
fn leave(&mut self) {}
fn set_f... |
rust_dataset_chunk_510680 | rust_dataset.txt | 510,680 | 512 | _sub(length)))
}
pub fn short_action_text(text: &str) -> String {
let mut short = String::new();
let mut previous_was_space = false;
for character in text.chars() {
let character = if character == '\n' { ' ' } else { character };
if character == ' ' {
if previous_was_space {
... |
rust_dataset_chunk_510681 | rust_dataset.txt | 510,681 | 512 | , PartialEq, Eq)]
pub struct RowLook {
pub selected: bool,
pub hovered: bool,
}
impl RowLook {
pub fn new(selected: bool, hovered: bool) -> Self {
RowLook { selected, hovered }
}
pub fn apply(&self, text: Text) -> Text {
if self.selected {
text.selected()
} else ... |
rust_dataset_chunk_510682 | rust_dataset.txt | 510,682 | 512 | }
}
pub fn fit(mut self, available: usize, order: &[usize]) -> Self {
let shown = self.widths.iter().filter(|width| **width > 0).count();
let fixed = self.indent
+ COLUMN_GAP * shown.saturating_sub(1)
+ if self.marker_width > 0 {
COLUMN_GAP + self.... |
rust_dataset_chunk_510683 | rust_dataset.txt | 510,683 | 512 | == 0 {
continue;
}
if index == column {
return start;
}
let text = columns.get(index).map(|c| c.as_str()).unwrap_or("");
start += pad(text, *width).chars().count() + COLUMN_GAP;
}
start
}
pub fn line(&se... |
rust_dataset_chunk_510684 | rust_dataset.txt | 510,684 | 512 | unsaved"));
} else if marker.starts_with('○') {
rendered = rendered.dim_range(marker_start..marker_end("○ default"));
}
}
for (column, color, range) in styles {
let dim = *color == DIM;
let column_width = self.widths.get(*column).copied().... |
rust_dataset_chunk_510685 | rust_dataset.txt | 510,685 | 512 | }
pub fn reset(&mut self) {
self.view.set_offset(0);
}
pub fn layout(
&mut self,
x: usize,
y: usize,
width: usize,
height: usize,
total: usize,
selected: Option<usize>,
) -> std::ops::Range<usize> {
let height = height.max(1);
... |
rust_dataset_chunk_510686 | rust_dataset.txt | 510,686 | 512 | self.view.screen_row(row)
}
pub fn contains(&self, line: isize, column: usize) -> bool {
match self.area {
Some((x, y, _, height)) => {
line >= y as isize
&& (line as usize) < y + height
&& column >= x
&& col... |
rust_dataset_chunk_510687 | rust_dataset.txt | 510,687 | 512 | (&mut self, mouse: Mouse) -> (Option<usize>, bool) {
let mouse = outside_overlays(mouse);
let mut activated = None;
let mut hover_changed = false;
for (index, button) in self.buttons.iter_mut().enumerate() {
let was_hovered = button.is_hovered();
if let UiResponse... |
rust_dataset_chunk_510688 | rust_dataset.txt | 510,688 | 512 | #[test]
fn a_narrow_list_shrinks_the_last_columns_first() {
let rows = vec![(
strings(&["name", "a very long value that does not fit"]),
String::new(),
)];
let layout = ColumnLayout::new(rows.iter().map(|(c, m)| (c.as_slice(), m.as_str())), 30);
assert_eq!(la... |
rust_dataset_chunk_510689 | rust_dataset.txt | 510,689 | 512 | 本 ");
}
#[test]
fn an_empty_column_takes_no_space() {
let rows = vec![(strings(&["A", ""]), String::new())];
let layout = ColumnLayout::new(rows.iter().map(|(c, m)| (c.as_slice(), m.as_str())), 80);
assert_eq!(layout.line(&rows[0].0, "").0, " A");
}
#[test]
fn markers... |
rust_dataset_chunk_510690 | rust_dataset.txt | 510,690 | 512 | (40, &[1, 0, 2]);
assert_eq!(layout.widths[2], 6);
assert_eq!(layout.widths[0], 17);
assert!(layout.text_width() <= 40);
}
#[test]
fn items_move_with_alt_or_shift_arrows() {
let down = KeyWithModifier::new(BareKey::Down);
assert!(is_move_key(
&down.clone(... |
rust_dataset_chunk_510691 | rust_dataset.txt | 510,691 | 512 | usize) -> String {
String::new()
}
fn actions(&self) -> Vec<String> {
vec![]
}
fn run_action(&mut self, _action: usize, _after: Option<usize>) {}
fn open_add(&mut self, _after: Option<usize>) {}
fn add_separator(&mut self, _after: Option<usize>) -> bool {
false
}
... |
rust_dataset_chunk_510692 | rust_dataset.txt | 510,692 | 512 | ::mem::take(&mut self.effects)
}
fn take_notice(&mut self) -> Option<String> {
None
}
fn close(&mut self) {}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::list_editor::{Row, SectionedList};
fn entry(plugin_id: u32, title: &str) -> PluginSettingsEntry {
PluginSettingsE... |
rust_dataset_chunk_510693 | rust_dataset.txt | 510,693 | 512 | }
press(&mut list, BareKey::Delete);
list.handle_key(&KeyWithModifier::new(BareKey::Down).with_shift_modifier());
assert!(list.take_notice().is_none());
assert!(list.take_effects().is_empty());
assert!(!list.is_busy());
assert_eq!(*shared.borrow(), vec![entry(4, "... |
rust_dataset_chunk_510694 | rust_dataset.txt | 510,694 | 512 | ::General,
Category::Appearance,
Category::Keyboard,
Category::Mouse,
Category::Clipboard,
Category::PanesAndLayouts,
Category::Attention,
Category::Notifications,
Category::Sessions,
Category::ZellijTerminal,
Category::Web,
Category::Advanced,
];
pub const SUB_PAGES: [Categ... |
rust_dataset_chunk_510695 | rust_dataset.txt | 510,695 | 512 | menu…",
Category::PluginsAndEnvironment => "Plugins and environment…",
other => other.title(),
}
}
pub fn search_words(&self) -> &'static str {
match self {
Category::Themes => "themes colors palette edit theme",
Category::Borders => "borders bord... |
rust_dataset_chunk_510696 | rust_dataset.txt | 510,696 | 512 | pub fn links(&self) -> Vec<Category> {
SUB_PAGES
.iter()
.copied()
.filter(|page| page.parent() == Some(*self))
.collect()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Scope {
OnlyYou,
Everyone,
}
#[derive(Debug, Clone, Copy, PartialEq,... |
rust_dataset_chunk_510697 | rust_dataset.txt | 510,697 | 512 | label| label.to_owned())
.unwrap_or_else(|| value.to_owned())
}
const LINE_STYLES: &[&str] = &["single", "double", "heavy", "dashed", "heavy_dashed"];
pub const INPUT_MODES: &[&str] = &[
"normal", "locked", "pane", "tab", "resize", "move", "scroll", "session", "tmux",
];
fn info(
name: &'static str,
... |
rust_dataset_chunk_510698 | rust_dataset.txt | 510,698 | 512 | instead of following the terminal",
OptionalChoice(&["dark", "light"]),
"not set",
Everyone,
),
SettingKey::SimplifiedUi => info(
"Simplified UI",
"Avoid arrow glyphs for fonts that lack them",
Toggle,
"false",
... |
rust_dataset_chunk_510699 | rust_dataset.txt | 510,699 | 512 | IdleActivitySecs => info(
"Busy output for (seconds)",
"Seconds of steady output before quiet detection applies",
Number {
min: 1,
max: 3600,
step: 1,
},
"10",
Everyone,
),
SettingKey:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.