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_515900 | rust_dataset.txt | 515,900 | 512 | _viewports() {
for (cols, rows) in [(1, 1), (2, 2), (3, 3), (9, 9)] {
let size = Size { cols, rows };
let (mut tab, receivers) = create_new_tab_with_receivers(size, false, true);
tab.new_pane(
PaneId::Terminal(2),
None,
None,
false,
... |
rust_dataset_chunk_515901 | rust_dataset.txt | 515,901 | 512 | : 121,
rows: 40,
};
let mut tab = create_new_tab(size, false);
new_tiled_pane_in_tab(&mut tab, 2);
let coordinates = zellij_utils::data::FloatingPaneCoordinates {
x: Some(zellij_utils::input::layout::PercentOrFixed::Fixed(5)),
y: Some(zellij_utils::input::layout::PercentOrFixed::... |
rust_dataset_chunk_515902 | rust_dataset.txt | 515,902 | 512 | )));
assert_eq!(closed_pane_ids(&receivers), vec![PaneId::Plugin(id)]);
assert_reported_as_not_created(
completion_receiver,
PaneNotCreatedReason::PluginThreadUnavailable,
);
}
tab.suppress_pane_and_replace_with_pid(
PaneId::Terminal(1),
PaneId::Pl... |
rust_dataset_chunk_515903 | rust_dataset.txt | 515,903 | 512 | (&self, id: u32, buf: &[u8]) -> Result<usize> {
self.writes
.lock()
.unwrap()
.push((id, String::from_utf8_lossy(buf).to_string()));
Ok(buf.len())
}
fn tcdrain(&self, _id: u32) -> Result<()> {
Ok(())
}
fn kill(&self, _pid: u32) -> Result<()> {
... |
rust_dataset_chunk_515904 | rust_dataset.txt | 515,904 | 512 | {
zellij_utils::input::layout::RunPluginOrAlias::from_url(
"file:/path/to/fake/plugin",
&None,
None,
None,
)
.unwrap()
}
#[test]
pub fn max_panes_limits_tiled_panes_without_crashing() {
let size = Size {
cols: 121,
rows: 20,
};
let (mut tab, rece... |
rust_dataset_chunk_515905 | rust_dataset.txt | 515,905 | 512 | ivers(size, false, true);
let (completion, completion_receiver) = completion_and_receiver();
tab.new_in_place_pane(
PaneId::Terminal(5),
None,
None,
None,
false,
None,
Some(completion),
None,
)
.unwrap();
assert!(!tab.has_pane_with_pid(... |
rust_dataset_chunk_515906 | rust_dataset.txt | 515,906 | 512 | None,
true,
Some(1),
)
.unwrap();
assert!(tab.tiled_panes.panes_contain(&PaneId::Terminal(3)));
assert!(!tab.are_floating_panes_visible());
}
#[test]
pub fn broken_stack_list_is_dissolved_and_its_members_are_kept() {
let size = Size {
cols: 121,
rows: 40,
... |
rust_dataset_chunk_515907 | rust_dataset.txt | 515,907 | 512 | _suppressed_pane_in_tab(&mut tab, 3);
tab.change_floating_pane_coordinates(&PaneId::Terminal(3), coordinates, false)
.unwrap();
assert!(tab.floating_panes.panes_contain(&PaneId::Terminal(3)));
}
#[test]
pub fn joining_client_has_its_floating_pane_brought_to_the_top() {
let mut tab = tab_with_two_fl... |
rust_dataset_chunk_515908 | rust_dataset.txt | 515,908 | 512 | #[test]
pub fn input_routing_and_active_pane_agree_without_floating_focus() {
let mut tab = tab_with_two_floating_panes();
tab.floating_panes.defocus_pane(1);
assert_eq!(tab.get_active_pane_id(1), None);
assert!(tab.get_active_pane_or_floating_pane_mut(1).is_none());
tab.toggle_active_pane_fullscree... |
rust_dataset_chunk_515909 | rust_dataset.txt | 515,909 | 512 | }
active_panes.insert(1, PaneId::Terminal(2), &mut panes);
active_panes.insert(2, PaneId::Terminal(2), &mut panes);
active_panes.insert(3, PaneId::Terminal(3), &mut panes);
writes.lock().unwrap().clear();
let connected_clients: std::collections::HashSet<ClientId> = [1, 2].into_iter().collect();
... |
rust_dataset_chunk_515910 | rust_dataset.txt | 515,910 | 512 | (1),
Some(PaneId::Terminal(6))
);
tiled_tab.tiled_panes.focus_last_pane(1);
assert_eq!(
tiled_tab.tiled_panes.focused_pane_id(1),
Some(PaneId::Terminal(6))
);
}
#[test]
pub fn adding_a_floating_pane_twice_keeps_one_stacking_entry() {
let mut tab = tab_with_two_floating_panes... |
rust_dataset_chunk_515911 | rust_dataset.txt | 515,911 | 512 | vec![zellij_utils::data::PaneId::Terminal(2)]
);
}
#[test]
pub fn focusing_a_suppressed_pane_prefers_the_entry_stored_under_its_own_id() {
let size = Size {
cols: 121,
rows: 40,
};
let mut tab = create_new_tab(size, false);
new_tiled_pane_in_tab(&mut tab, 2);
tab.replace... |
rust_dataset_chunk_515912 | rust_dataset.txt | 515,912 | 512 | .render(&mut output, None).unwrap();
assert!(tab
.floating_panes
.panes_with_logged_render_errors()
.contains(&PaneId::Terminal(5)));
let report = output.drain_pane_render_report();
for client_id in [1, 2] {
assert!(report
.all_pane... |
rust_dataset_chunk_515913 | rust_dataset.txt | 515,913 | 512 | ::Unload(plugin_id) => Some(plugin_id),
_ => None,
})
.collect();
assert_eq!(unloaded, vec![9]);
}
#[test]
pub fn failed_layout_override_does_not_leave_the_tab_pending() {
let size = Size {
cols: 121,
rows: 20,
};
let mut tab = create_new_tab(size, false);
... |
rust_dataset_chunk_515914 | rust_dataset.txt | 515,914 | 512 | changing_coordinates_from_a_plugin_does_not_float_a_tiled_pane_that_suppresses_another() {
let size = Size {
cols: 121,
rows: 40,
};
let mut tab = create_new_tab(size, false);
new_tiled_pane_in_tab(&mut tab, 2);
tab.replace_pane_with_editor_pane(PaneId::Terminal(5), PaneId::Terminal... |
rust_dataset_chunk_515915 | rust_dataset.txt | 515,915 | 512 | .get(&PaneId::Terminal(5))
.map(|(_, pane)| pane.pid()),
Some(PaneId::Terminal(3)),
"the edited pane is still restored when the editor closes"
);
for (key, (_, pane)) in tab.suppressed_panes.iter() {
assert!(
*key == pane.pid() || *key == PaneId::Termi... |
rust_dataset_chunk_515916 | rust_dataset.txt | 515,916 | 512 | with"
);
}
#[test]
fn expanding_a_pane_restores_the_geometry_it_had() {
let mut tab = tab_with_a_pane_above_a_pane();
let before = (
geom_of(&tab, PaneId::Terminal(1)),
geom_of(&tab, PaneId::Terminal(2)),
);
tab.set_pane_collapsed(PaneId::Terminal(2), true);
tab.set_pane_colla... |
rust_dataset_chunk_515917 | rust_dataset.txt | 515,917 | 512 | be handed its rows back on the way out
tab.toggle_active_pane_fullscreen(1);
tab.toggle_active_pane_fullscreen(1);
assert!(tab.tiled_panes.pane_is_collapsed(&PaneId::Terminal(2)));
assert_eq!(
geom_of(&tab, PaneId::Terminal(1)).rows.as_usize(),
20,
"the pane that stayed should ... |
rust_dataset_chunk_515918 | rust_dataset.txt | 515,918 | 512 | _bar_under_a_pane(Size {
cols: 121,
rows: 20,
});
let main_pane = PaneId::Terminal(0);
let bar = PaneId::Terminal(1);
tab.set_pane_collapsed(bar, true);
// the tab changes shape, the way a nested session's does when its host expands it
// over the whole display and takes its own... |
rust_dataset_chunk_515919 | rust_dataset.txt | 515,919 | 512 | .collect()
}
fn all_tiled_geoms(tab: &Tab) -> HashMap<PaneId, PaneGeom> {
tab.get_tiled_panes()
.map(|(pane_id, pane)| (*pane_id, pane.position_and_size()))
.collect()
}
#[test]
fn a_collapsed_bar_is_serialized_as_if_it_were_expanded() {
let mut tab = tab_with_a_one_row_bar_under_a_pane(Size ... |
rust_dataset_chunk_515920 | rust_dataset.txt | 515,920 | 512 | iledPaneLayout::default(),
TiledPaneLayout::default(),
];
let mut bar = TiledPaneLayout::default();
bar.split_size = Some(SplitSize::Fixed(1));
layout.children = vec![stack, bar];
let mut tab = create_new_tab_with_layout(
Size {
cols: 121,
rows: 20,
},... |
rust_dataset_chunk_515921 | rust_dataset.txt | 515,921 | 512 | 1)
.unwrap();
assert_eq!(tab.get_active_pane_id(1), Some(PaneId::Terminal(1)));
assert!(
tab.tiled_panes.fullscreen_is_active(),
"refusing to focus a collapsed pane should leave fullscreen alone"
);
}
#[test]
fn collapsing_the_only_selectable_pane_keeps_its_focus() {
let mut t... |
rust_dataset_chunk_515922 | rust_dataset.txt | 515,922 | 512 | top);
assert_eq!(place_of(&tab, PaneId::Terminal(3)), bottom);
assert_eq!(
geom_of(&tab, PaneId::Terminal(1)).rows.as_usize()
+ geom_of(&tab, PaneId::Terminal(3)).rows.as_usize(),
20
);
let percents = geom_of(&tab, PaneId::Terminal(1))
.rows
.as_percent()
... |
rust_dataset_chunk_515923 | rust_dataset.txt | 515,923 | 512 | ize() + bottom.rows.as_usize(), 40);
}
#[test]
fn pane_info_reports_whether_a_pane_is_collapsed() {
let mut tab = tab_with_a_pane_above_a_pane();
let is_collapsed = |tab: &Tab, id: u32| {
tab.tiled_panes
.pane_info(&HashMap::new())
.into_iter()
.find(|info| info.id =... |
rust_dataset_chunk_515924 | rust_dataset.txt | 515,924 | 512 | {
let size = Size {
cols: 121,
rows: 20,
};
let mut tab = create_new_tab(size, true);
let rx = install_pty_writer_capture(&mut tab);
tab.handle_pty_bytes(1, b"\x1b[?1000h\x1b[?1006h".to_vec())
.unwrap();
tab.handle_mouse_event(&left_click_at(5, 5, true), 1)
.unw... |
rust_dataset_chunk_515925 | rust_dataset.txt | 515,925 | 512 | 16,
) -> zellij_utils::input::mouse::MouseEvent {
let mut event = zellij_utils::input::mouse::MouseEvent::new_scroll_up_event(position);
event.wheel_lines = lines;
event
}
fn counted_wheel_down(
position: zellij_utils::position::Position,
lines: u16,
) -> zellij_utils::input::mouse::MouseEvent {
... |
rust_dataset_chunk_515926 | rust_dataset.txt | 515,926 | 512 | _three_lines() {
let mut tab = tab_with_scrollback();
let at = zellij_utils::position::Position::new(5, 10);
tab.handle_mouse_event(&counted_wheel_up(at, 0), 1).unwrap();
assert_eq!(scrolled_lines(&tab), 3);
tab.handle_mouse_event(&counted_wheel_down(at, 0), 1)
.unwrap();
assert_eq!(scro... |
rust_dataset_chunk_515927 | rust_dataset.txt | 515,927 | 512 | (); 4]);
tab.handle_mouse_event(&counted_wheel_down(at, 0), 1)
.unwrap();
assert_eq!(written_strings(&rx), vec!["\u{1b}[B".to_string(); 3]);
}
#[test]
fn a_counted_wheel_event_tells_a_plugin_that_many_lines() {
let (mut tab, plugin_receiver) = tab_with_floating_plugin_pane(1);
let pane = tab.g... |
rust_dataset_chunk_515928 | rust_dataset.txt | 515,928 | 512 | _ne!(scrolled_lines(&tab), 9);
}
#[test]
fn paste_markers_inside_pasted_text_are_removed() {
use super::without_paste_markers;
assert_eq!(
without_paste_markers(b"ls\x1b[201~\nrm -rf ~\n".to_vec()),
b"ls\nrm -rf ~\n".to_vec()
);
assert_eq!(
without_paste_markers(b"a\x1b[200~b\x1... |
rust_dataset_chunk_515929 | rust_dataset.txt | 515,929 | 512 | PaneId::Terminal(1);
tab.set_pane_collapsed(bar, true);
set_bar_hidden(&mut tab, bar, true);
set_bar_hidden(&mut tab, bar, false);
assert!(tab.tiled_panes.pane_is_collapsed(&bar));
assert_eq!(geom_of(&tab, main_pane).rows.as_usize(), 20);
}
#[test]
fn a_hidden_bar_follows_the_tab_when_it_is_resi... |
rust_dataset_chunk_515930 | rust_dataset.txt | 515,930 | 512 | Layout::default();
layout.children_split_direction = SplitDirection::Horizontal;
let mut top_bar = TiledPaneLayout::default();
top_bar.split_size = Some(SplitSize::Fixed(1));
let mut bottom_bar = TiledPaneLayout::default();
bottom_bar.split_size = Some(SplitSize::Fixed(1));
layout.children = vec... |
rust_dataset_chunk_515931 | rust_dataset.txt | 515,931 | 512 | _by_pane_id_hides_floating_panes_and_focuses_it() {
let size = Size {
cols: 121,
rows: 20,
};
let client_id = 1;
let mut tab = create_new_tab(size, true);
let new_pane_id = PaneId::Terminal(2);
let other_floating_pane_id = PaneId::Terminal(3);
tab.horizontal_split(new_pane_id... |
rust_dataset_chunk_515932 | rust_dataset.txt | 515,932 | 512 | -> usize {
self.inner.get_content_y()
}
fn get_content_columns(&self) -> usize {
self.inner.get_content_columns()
}
fn get_content_rows(&self) -> usize {
self.inner.get_content_rows()
}
fn reset_size_and_position_override(&mut self) {
self.inner.reset_size_and_po... |
rust_dataset_chunk_515933 | rust_dataset.txt | 515,933 | 512 | .inner.render_terminal_title(_input_mode)
}
fn update_name(&mut self, name: &str) {
self.inner.update_name(name)
}
fn pid(&self) -> PaneId {
self.inner.pid()
}
fn reduce_height(&mut self, percent: f64) {
self.inner.reduce_height(percent)
}
fn increase_height(&mut ... |
rust_dataset_chunk_515934 | rust_dataset.txt | 515,934 | 512 | .inner.store_pane_name()
}
fn load_pane_name(&mut self) {
self.inner.load_pane_name()
}
fn set_borderless(&mut self, borderless: bool) {
self.inner.set_borderless(borderless)
}
fn borderless(&self) -> bool {
self.inner.borderless()
}
fn set_exclude_from_sync(&mut ... |
rust_dataset_chunk_515935 | rust_dataset.txt | 515,935 | 512 | .get_content_columns()
}
fn get_content_rows(&self) -> usize {
self.inner.get_content_rows()
}
fn reset_size_and_position_override(&mut self) {
self.inner.reset_size_and_position_override()
}
fn set_geom(&mut self, position_and_size: PaneGeom) {
self.inner.set_geom(positi... |
rust_dataset_chunk_515936 | rust_dataset.txt | 515,936 | 512 | self.inner.update_name(name)
}
fn pid(&self) -> PaneId {
self.inner.pid()
}
fn reduce_height(&mut self, percent: f64) {
self.inner.reduce_height(percent)
}
fn increase_height(&mut self, percent: f64) {
self.inner.increase_height(percent)
}
fn reduce_width(... |
rust_dataset_chunk_515937 | rust_dataset.txt | 515,937 | 512 | ane_name()
}
fn set_borderless(&mut self, borderless: bool) {
self.inner.set_borderless(borderless)
}
fn borderless(&self) -> bool {
self.inner.borderless()
}
fn set_exclude_from_sync(&mut self, exclude_from_sync: bool) {
self.inner.set_exclude_from_sync(exclude_from_sync... |
rust_dataset_chunk_515938 | rust_dataset.txt | 515,938 | 512 | u32,
senders: ThreadSenders,
async_reader: Box<dyn AsyncReader>,
debug: bool,
activity_flag: Arc<AtomicBool>,
}
impl TerminalBytes {
pub fn new(
terminal_id: u32,
async_reader: Box<dyn AsyncReader>,
senders: ThreadSenders,
debug: bool,
activity_flag: Arc<Ato... |
rust_dataset_chunk_515939 | rust_dataset.txt | 515,939 | 512 | ellij with `Ctrl+q`. That is because the channel
// for `Screen` will have exited already, so this send *will* fail. This isn't a problem
// per-se because the application terminates anyway, but it will print a lengthy error
// message into the log for every pane that was still active when we qu... |
rust_dataset_chunk_515940 | rust_dataset.txt | 515,940 | 512 | : Option<SenderWithContext<BackgroundJob>>,
// this is a convenience for the unit tests
// it's not advisable to set it to true in production code
pub should_silently_fail: bool,
}
impl ThreadSenders {
pub fn send_to_screen_priority(&self, instruction: ScreenInstruction) -> Result<()> {
match s... |
rust_dataset_chunk_515941 | rust_dataset.txt | 515,941 | 512 | self, instruction: ServerInstruction) -> Result<()> {
if self.should_silently_fail {
let _ = self
.to_server
.as_ref()
.map(|sender| sender.send(instruction))
.unwrap_or_else(|| Ok(()));
Ok(())
} else {
s... |
rust_dataset_chunk_515942 | rust_dataset.txt | 515,942 | 512 | self.to_pty.replace(new_pty);
}
#[allow(unused)]
pub fn replace_to_plugin(&mut self, new_to_plugin: SenderWithContext<PluginInstruction>) {
// this is mostly used for the tests, see struct
self.to_plugin.replace(new_to_plugin);
}
}
/// A container for a receiver, OS input and the send... |
rust_dataset_chunk_515943 | rust_dataset.txt | 515,943 | 512 | to_background_jobs: None,
should_silently_fail: true,
},
os_input: None,
}
}
pub fn with_priority(
mut self,
priority_receiver: channels::Receiver<(T, ErrorContext)>,
priority_sender: &SenderWithContext<ScreenInstruction>,
... |
rust_dataset_chunk_515944 | rust_dataset.txt | 515,944 | 512 | _style {
LineStyle::Single => "─",
LineStyle::Double => "═",
LineStyle::Heavy => "━",
LineStyle::Dashed => "┄",
LineStyle::HeavyDashed => "┅",
}
}
pub fn vertical(line_style: LineStyle) -> &'static str {
match line_style {
LineStyle::Single => "│",
LineSt... |
rust_dataset_chunk_515945 | rust_dataset.txt | 515,945 | 512 | => "╔",
(Corner::TopLeft, Weight::Heavy, Weight::Light) => "┍",
(Corner::TopLeft, Weight::Light, Weight::Heavy) => "┎",
(Corner::TopLeft, Weight::Heavy, Weight::Heavy) => "┏",
(Corner::TopRight, Weight::Light, Weight::Light) => "┐",
(Corner::TopRight, Weight::Double, Weight::Li... |
rust_dataset_chunk_515946 | rust_dataset.txt | 515,946 | 512 | are normalized above")
},
}
}
pub fn title_separator_left(horizontal_style: LineStyle) -> &'static str {
match weight(horizontal_style) {
Weight::Light => boundary_type::VERTICAL_LEFT,
Weight::Double => "╡",
Weight::Heavy => "┥",
}
}
pub fn title_separator_right(horizontal... |
rust_dataset_chunk_515947 | rust_dataset.txt | 515,947 | 512 | boundary_type::TOP_RIGHT_ROUND => "┓",
boundary_type::BOTTOM_LEFT => "┗",
boundary_type::BOTTOM_LEFT_ROUND => "┗",
boundary_type::BOTTOM_RIGHT => "┛",
boundary_type::BOTTOM_RIGHT_ROUND => "┛",
boundary_type::VERTICAL_LEFT => "┫",
... |
rust_dataset_chunk_515948 | rust_dataset.txt | 515,948 | 512 | Single, true),
"╭"
);
assert_eq!(
corner(Corner::TopLeft, LineStyle::Dashed, LineStyle::Dashed, true),
"╭"
);
assert_eq!(
corner(Corner::TopLeft, LineStyle::Double, LineStyle::Single, true),
"╒"
);
assert_eq!(
... |
rust_dataset_chunk_515949 | rust_dataset.txt | 515,949 | 512 | ::HORIZONTAL,
boundary_type::VERTICAL,
boundary_type::TOP_LEFT,
boundary_type::TOP_RIGHT,
boundary_type::BOTTOM_LEFT,
boundary_type::BOTTOM_RIGHT,
boundary_type::VERTICAL_LEFT,
boundary_type::VERTICAL_RIGHT,
boundary_type::H... |
rust_dataset_chunk_515950 | rust_dataset.txt | 515,950 | 512 | &str = "┐";
pub const TOP_RIGHT_ROUND: &str = "╮";
pub const VERTICAL: &str = "│";
pub const HORIZONTAL: &str = "─";
pub const TOP_LEFT: &str = "┌";
pub const TOP_LEFT_ROUND: &str = "╭";
pub const BOTTOM_RIGHT: &str = "┘";
pub const BOTTOM_RIGHT_ROUND: &str = "╯";
pub const BOTTOM_LEFT:... |
rust_dataset_chunk_515951 | rust_dataset.txt | 515,951 | 512 | .chars()
.next()
.context("no boundary symbols defined")
.with_context(|| {
format!(
"failed to convert boundary symbol {} into terminal character",
glyph
)
})?;
... |
rust_dataset_chunk_515952 | rust_dataset.txt | 515,952 | 512 | ) => {
// (┐, ┐) => Some(┐)
let boundary_type = TOP_RIGHT;
Some(BoundarySymbol {
boundary_type,
invisible,
color,
line_style,
})
},
(TOP_RIGHT, VERTICAL) | (TOP_RIGHT, BOTTOM_RIGHT) | (TOP_RIG... |
rust_dataset_chunk_515953 | rust_dataset.txt | 515,953 | 512 | })
},
(HORIZONTAL, TOP_LEFT) | (HORIZONTAL, HORIZONTAL_DOWN) => {
// (─, ┌) => Some(┬)
// (─, ┬) => Some(┬)
let boundary_type = HORIZONTAL_DOWN;
Some(BoundarySymbol {
boundary_type,
invisible,
color,
... |
rust_dataset_chunk_515954 | rust_dataset.txt | 515,954 | 512 | ┌, ┌) => Some(┌)
let boundary_type = TOP_LEFT;
Some(BoundarySymbol {
boundary_type,
invisible,
color,
line_style,
})
},
(TOP_LEFT, BOTTOM_RIGHT) | (TOP_LEFT, VERTICAL_LEFT) | (TOP_LEFT, HORIZONTAL_UP) => ... |
rust_dataset_chunk_515955 | rust_dataset.txt | 515,955 | 512 | ├) => Some(┼)
// (┘, ┬) => Some(┼)
let boundary_type = CROSS;
Some(BoundarySymbol {
boundary_type,
invisible,
color,
line_style,
})
},
(BOTTOM_LEFT, BOTTOM_LEFT) => {
// (└, └) =>... |
rust_dataset_chunk_515956 | rust_dataset.txt | 515,956 | 512 | ;
Some(BoundarySymbol {
boundary_type,
invisible,
color,
line_style,
})
},
(VERTICAL_RIGHT, HORIZONTAL_DOWN) | (VERTICAL_RIGHT, HORIZONTAL_UP) => {
// (├, ┬) => Some(┼)
// (├, ┴) => Some(┼)
... |
rust_dataset_chunk_515957 | rust_dataset.txt | 515,957 | 512 | pane_is_stacked_under: bool,
pane_is_stacked: bool,
) {
let should_skip_top_boundary = pane_is_stacked && !pane_is_on_top_of_stack;
let should_skip_bottom_boundary = pane_is_stacked && !pane_is_on_bottom_of_stack;
let content_offset = rect.get_content_offset();
if !self.is_f... |
rust_dataset_chunk_515958 | rust_dataset.txt | 515,958 | 512 | );
let last_col_coordinates = self.rect_bottom_boundary_col_end(rect);
for col in first_col_coordinates..last_col_coordinates {
let coordinates = Coordinates::new(col, boundary_y_coords);
let symbol_to_add = if col == first_col_coordinates && col != self.viewport.... |
rust_dataset_chunk_515959 | rust_dataset.txt | 515,959 | 512 | _style(border_style.right)
} else {
BoundarySymbol::new(boundary_type::VERTICAL)
.color(color)
.line_style(border_style.right)
};
let next_symbol = self
.boundary_characters
... |
rust_dataset_chunk_515960 | rust_dataset.txt | 515,960 | 512 | _style)
.unwrap_or(LineStyle::Single),
) == glyph
})
.unwrap_or(false);
if already_on_screen {
continue;
}
character_chunks.push(CharacterChunk::new(
vec![boundary_... |
rust_dataset_chunk_515961 | rust_dataset.txt | 515,961 | 512 | ully_inside_screen(&self, rect: &dyn Pane) -> bool {
rect.x() >= self.viewport.x
&& rect.x() + rect.cols() <= self.viewport.x + self.viewport.cols
&& rect.y() >= self.viewport.y
&& rect.y() + rect.rows() <= self.viewport.y + self.viewport.rows
}
}
#[cfg(test)]
mod tests ... |
rust_dataset_chunk_515962 | rust_dataset.txt | 515,962 | 512 | yled, move_to, ButtonLook, WidgetState,
};
use super::Coordinates;
use zellij_utils::data::Style;
pub fn button(
state: &WidgetState,
fields: &[String],
style: &Style,
coordinates: &Coordinates,
) -> Vec<u8> {
let label = decode_styled(fields.get(0));
let width = coordinates
.width
... |
rust_dataset_chunk_515963 | rust_dataset.txt | 515,963 | 512 | decode_text, move_to, paint, paint_text, text_width,
truncate, ButtonLook, WidgetState,
};
use super::Coordinates;
use zellij_utils::data::Style;
const MIN_WIDTH: usize = 8;
pub fn dialog(
state: &WidgetState,
fields: &[String],
style: &Style,
coordinates: &Coordinates,
) -> Vec<u8> {
let col... |
rust_dataset_chunk_515964 | rust_dataset.txt | 515,964 | 512 | paint(border_styles, "╭─ "));
output.push_str(&paint(title_styles, &title));
output.push_str(&paint(border_styles, &format!(" {}╮", "─".repeat(rest))));
}
let footer_rows = state.count("fr");
let centered = state.flag("c");
let buttons_row = height.saturating_sub(2 + footer_rows).max(1);... |
rust_dataset_chunk_515965 | rust_dataset.txt | 515,965 | 512 | 0 {
let gap = 2.min(inner_width - used);
output.push_str(&paint(body_styles, &" ".repeat(gap)));
used += gap;
}
let width = button_width(label).min(inner_width - used);
if width == 0 {
break;
}
let look = if index == selected {
... |
rust_dataset_chunk_515966 | rust_dataset.txt | 515,966 | 512 | = String::from_utf8(dialog(&state, &fields, &style, &coordinates)).unwrap();
let emphasis = bold(
colored(style.colors.text_unselected.base, None)
.foreground(Some(style.colors.text_unselected.emphasis_3.into())),
);
assert!(output.contains(&paint(emphasis, "H")));
... |
rust_dataset_chunk_515967 | rust_dataset.txt | 515,967 | 512 | _styles = if hover_emphasis && hovered && !disabled {
bold(colored(style.colors.text_unselected.emphasis_3, None))
} else if active && !hovered && !disabled {
selected_row_styles(style)
} else {
field_styles(style, active, hovered, disabled)
};
let value_styles = if state.flag("b... |
rust_dataset_chunk_515968 | rust_dataset.txt | 515,968 | 512 | matched: Vec<usize>,
emphasized: Vec<usize>,
},
}
fn indices(raw: &str) -> Vec<usize> {
raw.split(',')
.filter_map(|index| index.parse::<usize>().ok())
.collect()
}
pub fn parse_menu_row(raw: &str) -> MenuRow {
if raw == "-" {
return MenuRow::Separator;
}
le... |
rust_dataset_chunk_515969 | rust_dataset.txt | 515,969 | 512 | _styles(style);
let disabled_styles = disabled_look(plain_styles(style));
let border_styles = colored(frame_color(style, focused), None);
let separator_styles = dimmed(plain_styles(style));
let mut output = String::new();
let mut line = 0;
if border {
output.push_str(&move_to(coordinates... |
rust_dataset_chunk_515970 | rust_dataset.txt | 515,970 | 512 | line += 1;
}
if border {
output.push_str(&move_to(coordinates, line, 0));
output.push_str(&border_line(
"└",
"┘",
inner_width,
indicator(false, below),
border_styles,
indicator_styles(style, state.flag("hd")),
));
... |
rust_dataset_chunk_515971 | rust_dataset.txt | 515,971 | 512 | : usize) -> CharacterStyles {
if self.matched.contains(&index) {
self.match_styles
} else if self.emphasized.contains(&index) {
self.emphasis_styles
} else {
self.row_styles
}
}
fn paint(&self, text: &str) -> String {
if self.matched.is... |
rust_dataset_chunk_515972 | rust_dataset.txt | 515,972 | 512 | else { " " }));
output.push_str(&paint(row_styles, " "));
}
output.push_str(&label_paint.paint(&fit(label, label_width)));
if let Some(shortcut) = shortcut {
output.push_str(&paint(row_styles, " "));
output.push_str(&paint(shortcut_styles, &shortcut));
}
output.push_str(&pai... |
rust_dataset_chunk_515973 | rust_dataset.txt | 515,973 | 512 | emphasized: &[],
row_styles: row,
match_styles: row,
emphasis_styles: row,
};
assert_eq!(
render_item("ab", None, None, &label_paint, 6, row, row),
format!(
"{}{}{}",
paint(row, " "),
... |
rust_dataset_chunk_515974 | rust_dataset.txt | 515,974 | 512 | .map(|byte| byte.to_string())
.collect::<Vec<_>>()
.join(",")
}
#[test]
fn menu_rows_decode_clusters_and_keep_character_positions() {
let label = format!("{}{}", FAMILY, DECOMPOSED_E);
let row = parse_menu_row(&format!("{}:{}/5", encoded(&label), encoded(... |
rust_dataset_chunk_515975 | rust_dataset.txt | 515,975 | 512 | None,
&label_paint,
9,
row,
row
),
format!(
"{}{}{}{}{}",
paint(row, " "),
paint(row, "a "),
paint(row, " "),
paint(row, "…"),
... |
rust_dataset_chunk_515976 | rust_dataset.txt | 515,976 | 512 | &str) -> Option<WidgetRenderer> {
match component_name {
"button" => Some(button::button),
"dialog" => Some(dialog::dialog),
"dropdown" => Some(dropdown::dropdown),
"menu" => Some(menu::menu),
"scroll_indicator" => Some(scroll_indicator::scroll_indicator),
"side_menu... |
rust_dataset_chunk_515977 | rust_dataset.txt | 515,977 | 512 | the rest of the component as utf8
// encoded bytes, each one representing one cell in the table)
// 5. Each component parses its parameters, creating a String of ANSI instructions of its
// own representing instructions to create the component
// 6. Finally, we take this string, e... |
rust_dataset_chunk_515978 | rust_dataset.txt | 515,978 | 512 | component_coordinates);
parse_vte_bytes!(self, encoded_nested_list);
Ok(())
} else if component_name == &"text" {
let stringified_params = parse_text_params(params_iter)
.into_iter()
.next()
.with_context(|| format!("text must ... |
rust_dataset_chunk_515979 | rust_dataset.txt | 515,979 | 512 | .take_while(|c| FLAG_CHARS.contains(c))
.count();
if let Some(position) = stringified[..prefix_len].find(flag) {
stringified.remove(position);
true
} else {
false
}
}
fn parse_selected(stringified: &mut String) -> bool {
parse_flag(stringified, 'x')
}
fn parse_o... |
rust_dataset_chunk_515980 | rust_dataset.txt | 515,980 | 512 | let bytes = (0..hex.len())
.step_by(2)
.map(|at| u8::from_str_radix(hex.get(at..at + 2)?, 16).ok())
.collect::<Option<Vec<u8>>>()?;
let url = String::from_utf8(bytes).ok()?;
is_linkable(&url).then_some(url)
}
// The terminal decides what it will open; this only keeps out what would
// ... |
rust_dataset_chunk_515981 | rust_dataset.txt | 515,981 | 512 | bulletin = if line_item.indentation_level % 2 == 0 {
"> "
} else {
"- "
};
let text_style = if line_item.text.opaque || line_item.text.selected {
CharacterStyles::from(style_declaration)
.background(Some(style_declaration.background.into()))
... |
rust_dataset_chunk_515982 | rust_dataset.txt | 515,982 | 512 | stringified.remove(0);
indentation_level += 1;
} else {
break;
}
}
indentation_level
}
fn max_nested_item_width(contents: &Vec<NestedListItem>) -> usize {
let mut width_of_longest_line = 0;
for line_item in contents.iter() {
let line_item_text... |
rust_dataset_chunk_515983 | rust_dataset.txt | 515,983 | 512 | ,
&component_coordinates,
&declaration,
&colors,
text_style,
);
let mut stringified = component_coordinates
.map(|c| c.to_string())
.unwrap_or_else(|| String::new());
stringified.push_str(&format!(
"{}{}{}{} {} {... |
rust_dataset_chunk_515984 | rust_dataset.txt | 515,984 | 512 | let width = coordinates.width.unwrap_or(10);
let height = coordinates.height.unwrap_or(2);
let right_aligned = state.flag("r");
let mut output = String::new();
if height == 0 {
return output.into_bytes();
}
if state.flag("bar") {
let cells = scrollbar_cells(height, state.coun... |
rust_dataset_chunk_515985 | rust_dataset.txt | 515,985 | 512 | _row_styles, indicator_row, move_to,
paint, plain_styles, selected_row_styles, text_width, WidgetState,
};
use super::Coordinates;
use zellij_utils::data::Style;
pub fn side_menu(
state: &WidgetState,
fields: &[String],
style: &Style,
coordinates: &Coordinates,
) -> Vec<u8> {
let focused = stat... |
rust_dataset_chunk_515986 | rust_dataset.txt | 515,986 | 512 | (&" ".repeat(row_width)),
}
}
output.push_str(&paint(border_styles, "│"));
}
output.into_bytes()
}
--- FILE: zellij/zellij-server/src/ui/components/stepper.rs ---
use super::widget_common::{
bold, center, colored, decode_styled, decode_text, dimmed, disabled_look, field_styles,... |
rust_dataset_chunk_515987 | rust_dataset.txt | 515,987 | 512 | (value.chars().count());
let mut used = 0;
for (cluster, cluster_width, index) in text_clusters(&value) {
if used + cluster_width > inner_width {
break;
}
let styles = if cursor >= index && cursor < index + cluster.chars().count() {
rev... |
rust_dataset_chunk_515988 | rust_dataset.txt | 515,988 | 512 | } else {
style.colors.table_cell_unselected
}
};
let text_style = if cell.opaque || cell.selected {
CharacterStyles::from(declaration).background(Some(declaration.background.into()))
} else {
Charact... |
rust_dataset_chunk_515989 | rust_dataset.txt | 515,989 | 512 | coordinates: &Option<Coordinates>,
) -> BTreeMap<usize, Vec<Text>> {
let mut stringified_rows: BTreeMap<usize, Vec<Text>> = BTreeMap::new();
let mut row_width = 0;
for (_, column) in stringified_columns.into_iter() {
let max_column_width = max_table_column_width(&column);
if is_too_wide(max... |
rust_dataset_chunk_515990 | rust_dataset.txt | 515,990 | 512 | MIN_FIELD_WIDTH)
.max(MIN_FIELD_WIDTH);
let inner_width = field_width - 4;
let suffix_width = if suffix.is_empty() || text_width(&suffix) + 2 > inner_width {
0
} else {
text_width(&suffix) + 1
};
let text_area_width = inner_width - suffix_width;
let bracket_styles =
... |
rust_dataset_chunk_515991 | rust_dataset.txt | 515,991 | 512 | used_width = 0;
let mut cursor_drawn = false;
for (cluster, cluster_width, index) in text_clusters(text) {
if used_width + cluster_width > width {
break;
}
used_width += cluster_width;
let char_count = cluster.chars().count();
if cursor.map_or(false, |cursor|... |
rust_dataset_chunk_515992 | rust_dataset.txt | 515,992 | 512 | None => format!("{}{}", base_text_style, text).as_bytes().to_vec(),
};
}
let declaration = if content.selected {
style.colors.text_selected
} else {
style.colors.text_unselected
};
// Start with base style from declaration
let base_text_style = CharacterStyles::from(dec... |
rust_dataset_chunk_515993 | rust_dataset.txt | 515,993 | 512 | stringified.push_str(&link_start(url));
}
open_link = link;
}
text_width += cluster_width;
if text.selected || text.opaque {
stringified.push_str(&format!("{}", base_text_style));
}
if styled {
let cluster_with_styling =
... |
rust_dataset_chunk_515994 | rust_dataset.txt | 515,994 | 512 | we have to defer to the terminal's default here
.dim(Some(AnsiCode::On));
} else {
character_style = character_style
.bold(Some(AnsiCode::On))
.dim(Some(AnsiCode::Reset)); // default, to reset any
// possible dim/bold values
... |
rust_dataset_chunk_515995 | rust_dataset.txt | 515,995 | 512 | ,
indices: vec![],
links: BTreeMap::new(),
}
}
pub fn is_styled_at(&self, index: usize) -> bool {
self.indices
.iter()
.enumerate()
.any(|(level, indices)| !self.links.contains_key(&level) && indices.contains(&index))
}
pub fn l... |
rust_dataset_chunk_515996 | rust_dataset.txt | 515,996 | 512 | for level in self.indices.iter().skip(CUSTOM_COLOR_LEVEL) {
let Some(mark) = level.iter().find(|value| **value >= CUSTOM_COLOR_MARK) else {
continue;
};
if level.contains(&index) {
let rgb = mark - CUSTOM_COLOR_MARK;
return Some(Palett... |
rust_dataset_chunk_515997 | rust_dataset.txt | 515,997 | 512 | _text_component_is_kept() {
let mut params = vec!["z".to_owned()];
let parsed = parse_text_params(params.iter_mut());
assert_eq!(parsed.len(), 1);
assert!(parsed[0].text.is_empty());
assert!(parsed[0].opaque);
}
#[test]
fn a_custom_colour_level_paints_its_indices_in_... |
rust_dataset_chunk_515998 | rust_dataset.txt | 515,998 | 512 | hex(url),
positions.join(","),
body(text)
)
}
fn parsed(serialized: &str) -> Text {
let mut params = vec![serialized.to_owned()];
parse_text_params(params.iter_mut()).remove(0)
}
// The drawn text with its style sequences removed, keeping the link tags.... |
rust_dataset_chunk_515999 | rust_dataset.txt | 515,999 | 512 | ["l123", "lff", "lzz"] {
let text = parsed(&format!("{}{},0,1${}", "$".repeat(9), token, body("ab")));
assert!(text.links.is_empty(), "{:?}", token);
assert_eq!(text.text, "ab");
}
}
#[test]
fn older_versions_read_a_link_level_as_unstyled_positions() {
/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.