mirror of
https://github.com/zellij-org/zellij.git
synced 2024-11-23 08:57:14 +03:00
chore(clippy): needless_borrow
This commit is contained in:
parent
3313634fe9
commit
b3b9175081
@ -292,7 +292,7 @@ fn full_shortcut_list(help: &ModeInfo) -> LinePart {
|
|||||||
_ => {
|
_ => {
|
||||||
let mut line_part = LinePart::default();
|
let mut line_part = LinePart::default();
|
||||||
for (i, (letter, description)) in help.keybinds.iter().enumerate() {
|
for (i, (letter, description)) in help.keybinds.iter().enumerate() {
|
||||||
let shortcut = full_length_shortcut(i == 0, &letter, &description, help.palette);
|
let shortcut = full_length_shortcut(i == 0, letter, description, help.palette);
|
||||||
line_part.len += shortcut.len;
|
line_part.len += shortcut.len;
|
||||||
line_part.part = format!("{}{}", line_part.part, shortcut,);
|
line_part.part = format!("{}{}", line_part.part, shortcut,);
|
||||||
}
|
}
|
||||||
@ -311,7 +311,7 @@ fn shortened_shortcut_list(help: &ModeInfo) -> LinePart {
|
|||||||
_ => {
|
_ => {
|
||||||
let mut line_part = LinePart::default();
|
let mut line_part = LinePart::default();
|
||||||
for (i, (letter, description)) in help.keybinds.iter().enumerate() {
|
for (i, (letter, description)) in help.keybinds.iter().enumerate() {
|
||||||
let shortcut = first_word_shortcut(i == 0, &letter, &description, help.palette);
|
let shortcut = first_word_shortcut(i == 0, letter, description, help.palette);
|
||||||
line_part.len += shortcut.len;
|
line_part.len += shortcut.len;
|
||||||
line_part.part = format!("{}{}", line_part.part, shortcut,);
|
line_part.part = format!("{}{}", line_part.part, shortcut,);
|
||||||
}
|
}
|
||||||
@ -344,7 +344,7 @@ fn best_effort_shortcut_list(help: &ModeInfo, max_len: usize) -> LinePart {
|
|||||||
_ => {
|
_ => {
|
||||||
let mut line_part = LinePart::default();
|
let mut line_part = LinePart::default();
|
||||||
for (i, (letter, description)) in help.keybinds.iter().enumerate() {
|
for (i, (letter, description)) in help.keybinds.iter().enumerate() {
|
||||||
let shortcut = first_word_shortcut(i == 0, &letter, &description, help.palette);
|
let shortcut = first_word_shortcut(i == 0, letter, description, help.palette);
|
||||||
if line_part.len + shortcut.len + MORE_MSG.chars().count() > max_len {
|
if line_part.len + shortcut.len + MORE_MSG.chars().count() > max_len {
|
||||||
// TODO: better
|
// TODO: better
|
||||||
line_part.part = format!("{}{}", line_part.part, MORE_MSG);
|
line_part.part = format!("{}{}", line_part.part, MORE_MSG);
|
||||||
|
@ -21,7 +21,7 @@ fn populate_tabs_in_tab_line(
|
|||||||
if tabs_before_active.is_empty() && tabs_after_active.is_empty() {
|
if tabs_before_active.is_empty() && tabs_after_active.is_empty() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let current_title_len = get_current_title_len(&tabs_to_render);
|
let current_title_len = get_current_title_len(tabs_to_render);
|
||||||
if current_title_len >= cols {
|
if current_title_len >= cols {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ fn add_previous_tabs_msg(
|
|||||||
palette: Palette,
|
palette: Palette,
|
||||||
separator: &str,
|
separator: &str,
|
||||||
) {
|
) {
|
||||||
while get_current_title_len(&tabs_to_render)
|
while get_current_title_len(tabs_to_render)
|
||||||
+ left_more_message(tabs_before_active.len(), palette, separator).len
|
+ left_more_message(tabs_before_active.len(), palette, separator).len
|
||||||
>= cols
|
>= cols
|
||||||
{
|
{
|
||||||
@ -134,7 +134,7 @@ fn add_next_tabs_msg(
|
|||||||
palette: Palette,
|
palette: Palette,
|
||||||
separator: &str,
|
separator: &str,
|
||||||
) {
|
) {
|
||||||
while get_current_title_len(&title_bar)
|
while get_current_title_len(title_bar)
|
||||||
+ right_more_message(tabs_after_active.len(), palette, separator).len
|
+ right_more_message(tabs_after_active.len(), palette, separator).len
|
||||||
>= cols
|
>= cols
|
||||||
{
|
{
|
||||||
@ -160,7 +160,7 @@ pub fn tab_separator(capabilities: PluginCapabilities) -> &'static str {
|
|||||||
if !capabilities.arrow_fonts {
|
if !capabilities.arrow_fonts {
|
||||||
ARROW_SEPARATOR
|
ARROW_SEPARATOR
|
||||||
} else {
|
} else {
|
||||||
&""
|
""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ impl InputHandler {
|
|||||||
self.dispatch_action(action);
|
self.dispatch_action(action);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for action in Keybinds::key_to_actions(&key, raw_bytes, &self.mode, keybinds) {
|
for action in Keybinds::key_to_actions(key, raw_bytes, &self.mode, keybinds) {
|
||||||
let should_exit = self.dispatch_action(action);
|
let should_exit = self.dispatch_action(action);
|
||||||
if should_exit {
|
if should_exit {
|
||||||
self.should_exit = true;
|
self.should_exit = true;
|
||||||
|
@ -278,7 +278,7 @@ pub fn start_client(
|
|||||||
ClientInstruction::Render(output) => {
|
ClientInstruction::Render(output) => {
|
||||||
let mut stdout = os_input.get_stdout_writer();
|
let mut stdout = os_input.get_stdout_writer();
|
||||||
stdout
|
stdout
|
||||||
.write_all(&output.as_bytes())
|
.write_all(output.as_bytes())
|
||||||
.expect("cannot write to stdout");
|
.expect("cannot write to stdout");
|
||||||
stdout.flush().expect("could not flush");
|
stdout.flush().expect("could not flush");
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ impl Tab {
|
|||||||
match positions_and_size.next() {
|
match positions_and_size.next() {
|
||||||
Some((_, position_and_size)) => {
|
Some((_, position_and_size)) => {
|
||||||
terminal_pane.reset_size_and_position_override();
|
terminal_pane.reset_size_and_position_override();
|
||||||
terminal_pane.change_pos_and_size(&position_and_size);
|
terminal_pane.change_pos_and_size(position_and_size);
|
||||||
self.os_api.set_terminal_size_using_fd(
|
self.os_api.set_terminal_size_using_fd(
|
||||||
*pid,
|
*pid,
|
||||||
position_and_size.cols as u16,
|
position_and_size.cols as u16,
|
||||||
@ -872,14 +872,14 @@ impl Tab {
|
|||||||
fn panes_top_aligned_with_pane(&self, pane: &dyn Pane) -> Vec<&dyn Pane> {
|
fn panes_top_aligned_with_pane(&self, pane: &dyn Pane) -> Vec<&dyn Pane> {
|
||||||
self.panes
|
self.panes
|
||||||
.keys()
|
.keys()
|
||||||
.map(|t_id| self.panes.get(&t_id).unwrap().as_ref())
|
.map(|t_id| self.panes.get(t_id).unwrap().as_ref())
|
||||||
.filter(|terminal| terminal.pid() != pane.pid() && terminal.y() == pane.y())
|
.filter(|terminal| terminal.pid() != pane.pid() && terminal.y() == pane.y())
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
fn panes_bottom_aligned_with_pane(&self, pane: &dyn Pane) -> Vec<&dyn Pane> {
|
fn panes_bottom_aligned_with_pane(&self, pane: &dyn Pane) -> Vec<&dyn Pane> {
|
||||||
self.panes
|
self.panes
|
||||||
.keys()
|
.keys()
|
||||||
.map(|t_id| self.panes.get(&t_id).unwrap().as_ref())
|
.map(|t_id| self.panes.get(t_id).unwrap().as_ref())
|
||||||
.filter(|terminal| {
|
.filter(|terminal| {
|
||||||
terminal.pid() != pane.pid()
|
terminal.pid() != pane.pid()
|
||||||
&& terminal.y() + terminal.rows() == pane.y() + pane.rows()
|
&& terminal.y() + terminal.rows() == pane.y() + pane.rows()
|
||||||
@ -889,7 +889,7 @@ impl Tab {
|
|||||||
fn panes_right_aligned_with_pane(&self, pane: &dyn Pane) -> Vec<&dyn Pane> {
|
fn panes_right_aligned_with_pane(&self, pane: &dyn Pane) -> Vec<&dyn Pane> {
|
||||||
self.panes
|
self.panes
|
||||||
.keys()
|
.keys()
|
||||||
.map(|t_id| self.panes.get(&t_id).unwrap().as_ref())
|
.map(|t_id| self.panes.get(t_id).unwrap().as_ref())
|
||||||
.filter(|terminal| {
|
.filter(|terminal| {
|
||||||
terminal.pid() != pane.pid()
|
terminal.pid() != pane.pid()
|
||||||
&& terminal.x() + terminal.columns() == pane.x() + pane.columns()
|
&& terminal.x() + terminal.columns() == pane.x() + pane.columns()
|
||||||
@ -899,7 +899,7 @@ impl Tab {
|
|||||||
fn panes_left_aligned_with_pane(&self, pane: &dyn Pane) -> Vec<&dyn Pane> {
|
fn panes_left_aligned_with_pane(&self, pane: &dyn Pane) -> Vec<&dyn Pane> {
|
||||||
self.panes
|
self.panes
|
||||||
.keys()
|
.keys()
|
||||||
.map(|t_id| self.panes.get(&t_id).unwrap().as_ref())
|
.map(|t_id| self.panes.get(t_id).unwrap().as_ref())
|
||||||
.filter(|terminal| terminal.pid() != pane.pid() && terminal.x() == pane.x())
|
.filter(|terminal| terminal.pid() != pane.pid() && terminal.x() == pane.x())
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
@ -1350,20 +1350,20 @@ impl Tab {
|
|||||||
}
|
}
|
||||||
fn reduce_pane_and_surroundings_up(&mut self, id: &PaneId, count: usize) {
|
fn reduce_pane_and_surroundings_up(&mut self, id: &PaneId, count: usize) {
|
||||||
let mut terminals_below = self
|
let mut terminals_below = self
|
||||||
.pane_ids_directly_below(&id)
|
.pane_ids_directly_below(id)
|
||||||
.expect("can't reduce pane size up if there are no terminals below");
|
.expect("can't reduce pane size up if there are no terminals below");
|
||||||
let terminal_borders_below: HashSet<usize> = terminals_below
|
let terminal_borders_below: HashSet<usize> = terminals_below
|
||||||
.iter()
|
.iter()
|
||||||
.map(|t| self.panes.get(t).unwrap().x())
|
.map(|t| self.panes.get(t).unwrap().x())
|
||||||
.collect();
|
.collect();
|
||||||
let (left_resize_border, terminals_to_the_left) =
|
let (left_resize_border, terminals_to_the_left) =
|
||||||
self.bottom_aligned_contiguous_panes_to_the_left(&id, &terminal_borders_below);
|
self.bottom_aligned_contiguous_panes_to_the_left(id, &terminal_borders_below);
|
||||||
let (right_resize_border, terminals_to_the_right) =
|
let (right_resize_border, terminals_to_the_right) =
|
||||||
self.bottom_aligned_contiguous_panes_to_the_right(&id, &terminal_borders_below);
|
self.bottom_aligned_contiguous_panes_to_the_right(id, &terminal_borders_below);
|
||||||
terminals_below.retain(|t| {
|
terminals_below.retain(|t| {
|
||||||
self.pane_is_between_vertical_borders(t, left_resize_border, right_resize_border)
|
self.pane_is_between_vertical_borders(t, left_resize_border, right_resize_border)
|
||||||
});
|
});
|
||||||
self.reduce_pane_height_up(&id, count);
|
self.reduce_pane_height_up(id, count);
|
||||||
for terminal_id in terminals_below {
|
for terminal_id in terminals_below {
|
||||||
self.increase_pane_height_up(&terminal_id, count);
|
self.increase_pane_height_up(&terminal_id, count);
|
||||||
}
|
}
|
||||||
@ -1371,25 +1371,25 @@ impl Tab {
|
|||||||
.iter()
|
.iter()
|
||||||
.chain(terminals_to_the_right.iter())
|
.chain(terminals_to_the_right.iter())
|
||||||
{
|
{
|
||||||
self.reduce_pane_height_up(&terminal_id, count);
|
self.reduce_pane_height_up(terminal_id, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn reduce_pane_and_surroundings_down(&mut self, id: &PaneId, count: usize) {
|
fn reduce_pane_and_surroundings_down(&mut self, id: &PaneId, count: usize) {
|
||||||
let mut terminals_above = self
|
let mut terminals_above = self
|
||||||
.pane_ids_directly_above(&id)
|
.pane_ids_directly_above(id)
|
||||||
.expect("can't reduce pane size down if there are no terminals above");
|
.expect("can't reduce pane size down if there are no terminals above");
|
||||||
let terminal_borders_above: HashSet<usize> = terminals_above
|
let terminal_borders_above: HashSet<usize> = terminals_above
|
||||||
.iter()
|
.iter()
|
||||||
.map(|t| self.panes.get(t).unwrap().x())
|
.map(|t| self.panes.get(t).unwrap().x())
|
||||||
.collect();
|
.collect();
|
||||||
let (left_resize_border, terminals_to_the_left) =
|
let (left_resize_border, terminals_to_the_left) =
|
||||||
self.top_aligned_contiguous_panes_to_the_left(&id, &terminal_borders_above);
|
self.top_aligned_contiguous_panes_to_the_left(id, &terminal_borders_above);
|
||||||
let (right_resize_border, terminals_to_the_right) =
|
let (right_resize_border, terminals_to_the_right) =
|
||||||
self.top_aligned_contiguous_panes_to_the_right(&id, &terminal_borders_above);
|
self.top_aligned_contiguous_panes_to_the_right(id, &terminal_borders_above);
|
||||||
terminals_above.retain(|t| {
|
terminals_above.retain(|t| {
|
||||||
self.pane_is_between_vertical_borders(t, left_resize_border, right_resize_border)
|
self.pane_is_between_vertical_borders(t, left_resize_border, right_resize_border)
|
||||||
});
|
});
|
||||||
self.reduce_pane_height_down(&id, count);
|
self.reduce_pane_height_down(id, count);
|
||||||
for terminal_id in terminals_above {
|
for terminal_id in terminals_above {
|
||||||
self.increase_pane_height_down(&terminal_id, count);
|
self.increase_pane_height_down(&terminal_id, count);
|
||||||
}
|
}
|
||||||
@ -1397,71 +1397,71 @@ impl Tab {
|
|||||||
.iter()
|
.iter()
|
||||||
.chain(terminals_to_the_right.iter())
|
.chain(terminals_to_the_right.iter())
|
||||||
{
|
{
|
||||||
self.reduce_pane_height_down(&terminal_id, count);
|
self.reduce_pane_height_down(terminal_id, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn reduce_pane_and_surroundings_right(&mut self, id: &PaneId, count: usize) {
|
fn reduce_pane_and_surroundings_right(&mut self, id: &PaneId, count: usize) {
|
||||||
let mut terminals_to_the_left = self
|
let mut terminals_to_the_left = self
|
||||||
.pane_ids_directly_left_of(&id)
|
.pane_ids_directly_left_of(id)
|
||||||
.expect("can't reduce pane size right if there are no terminals to the left");
|
.expect("can't reduce pane size right if there are no terminals to the left");
|
||||||
let terminal_borders_to_the_left: HashSet<usize> = terminals_to_the_left
|
let terminal_borders_to_the_left: HashSet<usize> = terminals_to_the_left
|
||||||
.iter()
|
.iter()
|
||||||
.map(|t| self.panes.get(t).unwrap().y())
|
.map(|t| self.panes.get(t).unwrap().y())
|
||||||
.collect();
|
.collect();
|
||||||
let (top_resize_border, terminals_above) =
|
let (top_resize_border, terminals_above) =
|
||||||
self.left_aligned_contiguous_panes_above(&id, &terminal_borders_to_the_left);
|
self.left_aligned_contiguous_panes_above(id, &terminal_borders_to_the_left);
|
||||||
let (bottom_resize_border, terminals_below) =
|
let (bottom_resize_border, terminals_below) =
|
||||||
self.left_aligned_contiguous_panes_below(&id, &terminal_borders_to_the_left);
|
self.left_aligned_contiguous_panes_below(id, &terminal_borders_to_the_left);
|
||||||
terminals_to_the_left.retain(|t| {
|
terminals_to_the_left.retain(|t| {
|
||||||
self.pane_is_between_horizontal_borders(t, top_resize_border, bottom_resize_border)
|
self.pane_is_between_horizontal_borders(t, top_resize_border, bottom_resize_border)
|
||||||
});
|
});
|
||||||
self.reduce_pane_width_right(&id, count);
|
self.reduce_pane_width_right(id, count);
|
||||||
for terminal_id in terminals_to_the_left {
|
for terminal_id in terminals_to_the_left {
|
||||||
self.increase_pane_width_right(&terminal_id, count);
|
self.increase_pane_width_right(&terminal_id, count);
|
||||||
}
|
}
|
||||||
for terminal_id in terminals_above.iter().chain(terminals_below.iter()) {
|
for terminal_id in terminals_above.iter().chain(terminals_below.iter()) {
|
||||||
self.reduce_pane_width_right(&terminal_id, count);
|
self.reduce_pane_width_right(terminal_id, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn reduce_pane_and_surroundings_left(&mut self, id: &PaneId, count: usize) {
|
fn reduce_pane_and_surroundings_left(&mut self, id: &PaneId, count: usize) {
|
||||||
let mut terminals_to_the_right = self
|
let mut terminals_to_the_right = self
|
||||||
.pane_ids_directly_right_of(&id)
|
.pane_ids_directly_right_of(id)
|
||||||
.expect("can't reduce pane size left if there are no terminals to the right");
|
.expect("can't reduce pane size left if there are no terminals to the right");
|
||||||
let terminal_borders_to_the_right: HashSet<usize> = terminals_to_the_right
|
let terminal_borders_to_the_right: HashSet<usize> = terminals_to_the_right
|
||||||
.iter()
|
.iter()
|
||||||
.map(|t| self.panes.get(t).unwrap().y())
|
.map(|t| self.panes.get(t).unwrap().y())
|
||||||
.collect();
|
.collect();
|
||||||
let (top_resize_border, terminals_above) =
|
let (top_resize_border, terminals_above) =
|
||||||
self.right_aligned_contiguous_panes_above(&id, &terminal_borders_to_the_right);
|
self.right_aligned_contiguous_panes_above(id, &terminal_borders_to_the_right);
|
||||||
let (bottom_resize_border, terminals_below) =
|
let (bottom_resize_border, terminals_below) =
|
||||||
self.right_aligned_contiguous_panes_below(&id, &terminal_borders_to_the_right);
|
self.right_aligned_contiguous_panes_below(id, &terminal_borders_to_the_right);
|
||||||
terminals_to_the_right.retain(|t| {
|
terminals_to_the_right.retain(|t| {
|
||||||
self.pane_is_between_horizontal_borders(t, top_resize_border, bottom_resize_border)
|
self.pane_is_between_horizontal_borders(t, top_resize_border, bottom_resize_border)
|
||||||
});
|
});
|
||||||
self.reduce_pane_width_left(&id, count);
|
self.reduce_pane_width_left(id, count);
|
||||||
for terminal_id in terminals_to_the_right {
|
for terminal_id in terminals_to_the_right {
|
||||||
self.increase_pane_width_left(&terminal_id, count);
|
self.increase_pane_width_left(&terminal_id, count);
|
||||||
}
|
}
|
||||||
for terminal_id in terminals_above.iter().chain(terminals_below.iter()) {
|
for terminal_id in terminals_above.iter().chain(terminals_below.iter()) {
|
||||||
self.reduce_pane_width_left(&terminal_id, count);
|
self.reduce_pane_width_left(terminal_id, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn increase_pane_and_surroundings_up(&mut self, id: &PaneId, count: usize) {
|
fn increase_pane_and_surroundings_up(&mut self, id: &PaneId, count: usize) {
|
||||||
let mut terminals_above = self
|
let mut terminals_above = self
|
||||||
.pane_ids_directly_above(&id)
|
.pane_ids_directly_above(id)
|
||||||
.expect("can't increase pane size up if there are no terminals above");
|
.expect("can't increase pane size up if there are no terminals above");
|
||||||
let terminal_borders_above: HashSet<usize> = terminals_above
|
let terminal_borders_above: HashSet<usize> = terminals_above
|
||||||
.iter()
|
.iter()
|
||||||
.map(|t| self.panes.get(t).unwrap().x())
|
.map(|t| self.panes.get(t).unwrap().x())
|
||||||
.collect();
|
.collect();
|
||||||
let (left_resize_border, terminals_to_the_left) =
|
let (left_resize_border, terminals_to_the_left) =
|
||||||
self.top_aligned_contiguous_panes_to_the_left(&id, &terminal_borders_above);
|
self.top_aligned_contiguous_panes_to_the_left(id, &terminal_borders_above);
|
||||||
let (right_resize_border, terminals_to_the_right) =
|
let (right_resize_border, terminals_to_the_right) =
|
||||||
self.top_aligned_contiguous_panes_to_the_right(&id, &terminal_borders_above);
|
self.top_aligned_contiguous_panes_to_the_right(id, &terminal_borders_above);
|
||||||
terminals_above.retain(|t| {
|
terminals_above.retain(|t| {
|
||||||
self.pane_is_between_vertical_borders(t, left_resize_border, right_resize_border)
|
self.pane_is_between_vertical_borders(t, left_resize_border, right_resize_border)
|
||||||
});
|
});
|
||||||
self.increase_pane_height_up(&id, count);
|
self.increase_pane_height_up(id, count);
|
||||||
for terminal_id in terminals_above {
|
for terminal_id in terminals_above {
|
||||||
self.reduce_pane_height_up(&terminal_id, count);
|
self.reduce_pane_height_up(&terminal_id, count);
|
||||||
}
|
}
|
||||||
@ -1469,25 +1469,25 @@ impl Tab {
|
|||||||
.iter()
|
.iter()
|
||||||
.chain(terminals_to_the_right.iter())
|
.chain(terminals_to_the_right.iter())
|
||||||
{
|
{
|
||||||
self.increase_pane_height_up(&terminal_id, count);
|
self.increase_pane_height_up(terminal_id, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn increase_pane_and_surroundings_down(&mut self, id: &PaneId, count: usize) {
|
fn increase_pane_and_surroundings_down(&mut self, id: &PaneId, count: usize) {
|
||||||
let mut terminals_below = self
|
let mut terminals_below = self
|
||||||
.pane_ids_directly_below(&id)
|
.pane_ids_directly_below(id)
|
||||||
.expect("can't increase pane size down if there are no terminals below");
|
.expect("can't increase pane size down if there are no terminals below");
|
||||||
let terminal_borders_below: HashSet<usize> = terminals_below
|
let terminal_borders_below: HashSet<usize> = terminals_below
|
||||||
.iter()
|
.iter()
|
||||||
.map(|t| self.panes.get(t).unwrap().x())
|
.map(|t| self.panes.get(t).unwrap().x())
|
||||||
.collect();
|
.collect();
|
||||||
let (left_resize_border, terminals_to_the_left) =
|
let (left_resize_border, terminals_to_the_left) =
|
||||||
self.bottom_aligned_contiguous_panes_to_the_left(&id, &terminal_borders_below);
|
self.bottom_aligned_contiguous_panes_to_the_left(id, &terminal_borders_below);
|
||||||
let (right_resize_border, terminals_to_the_right) =
|
let (right_resize_border, terminals_to_the_right) =
|
||||||
self.bottom_aligned_contiguous_panes_to_the_right(&id, &terminal_borders_below);
|
self.bottom_aligned_contiguous_panes_to_the_right(id, &terminal_borders_below);
|
||||||
terminals_below.retain(|t| {
|
terminals_below.retain(|t| {
|
||||||
self.pane_is_between_vertical_borders(t, left_resize_border, right_resize_border)
|
self.pane_is_between_vertical_borders(t, left_resize_border, right_resize_border)
|
||||||
});
|
});
|
||||||
self.increase_pane_height_down(&id, count);
|
self.increase_pane_height_down(id, count);
|
||||||
for terminal_id in terminals_below {
|
for terminal_id in terminals_below {
|
||||||
self.reduce_pane_height_down(&terminal_id, count);
|
self.reduce_pane_height_down(&terminal_id, count);
|
||||||
}
|
}
|
||||||
@ -1495,53 +1495,53 @@ impl Tab {
|
|||||||
.iter()
|
.iter()
|
||||||
.chain(terminals_to_the_right.iter())
|
.chain(terminals_to_the_right.iter())
|
||||||
{
|
{
|
||||||
self.increase_pane_height_down(&terminal_id, count);
|
self.increase_pane_height_down(terminal_id, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn increase_pane_and_surroundings_right(&mut self, id: &PaneId, count: usize) {
|
fn increase_pane_and_surroundings_right(&mut self, id: &PaneId, count: usize) {
|
||||||
let mut terminals_to_the_right = self
|
let mut terminals_to_the_right = self
|
||||||
.pane_ids_directly_right_of(&id)
|
.pane_ids_directly_right_of(id)
|
||||||
.expect("can't increase pane size right if there are no terminals to the right");
|
.expect("can't increase pane size right if there are no terminals to the right");
|
||||||
let terminal_borders_to_the_right: HashSet<usize> = terminals_to_the_right
|
let terminal_borders_to_the_right: HashSet<usize> = terminals_to_the_right
|
||||||
.iter()
|
.iter()
|
||||||
.map(|t| self.panes.get(t).unwrap().y())
|
.map(|t| self.panes.get(t).unwrap().y())
|
||||||
.collect();
|
.collect();
|
||||||
let (top_resize_border, terminals_above) =
|
let (top_resize_border, terminals_above) =
|
||||||
self.right_aligned_contiguous_panes_above(&id, &terminal_borders_to_the_right);
|
self.right_aligned_contiguous_panes_above(id, &terminal_borders_to_the_right);
|
||||||
let (bottom_resize_border, terminals_below) =
|
let (bottom_resize_border, terminals_below) =
|
||||||
self.right_aligned_contiguous_panes_below(&id, &terminal_borders_to_the_right);
|
self.right_aligned_contiguous_panes_below(id, &terminal_borders_to_the_right);
|
||||||
terminals_to_the_right.retain(|t| {
|
terminals_to_the_right.retain(|t| {
|
||||||
self.pane_is_between_horizontal_borders(t, top_resize_border, bottom_resize_border)
|
self.pane_is_between_horizontal_borders(t, top_resize_border, bottom_resize_border)
|
||||||
});
|
});
|
||||||
self.increase_pane_width_right(&id, count);
|
self.increase_pane_width_right(id, count);
|
||||||
for terminal_id in terminals_to_the_right {
|
for terminal_id in terminals_to_the_right {
|
||||||
self.reduce_pane_width_right(&terminal_id, count);
|
self.reduce_pane_width_right(&terminal_id, count);
|
||||||
}
|
}
|
||||||
for terminal_id in terminals_above.iter().chain(terminals_below.iter()) {
|
for terminal_id in terminals_above.iter().chain(terminals_below.iter()) {
|
||||||
self.increase_pane_width_right(&terminal_id, count);
|
self.increase_pane_width_right(terminal_id, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn increase_pane_and_surroundings_left(&mut self, id: &PaneId, count: usize) {
|
fn increase_pane_and_surroundings_left(&mut self, id: &PaneId, count: usize) {
|
||||||
let mut terminals_to_the_left = self
|
let mut terminals_to_the_left = self
|
||||||
.pane_ids_directly_left_of(&id)
|
.pane_ids_directly_left_of(id)
|
||||||
.expect("can't increase pane size right if there are no terminals to the right");
|
.expect("can't increase pane size right if there are no terminals to the right");
|
||||||
let terminal_borders_to_the_left: HashSet<usize> = terminals_to_the_left
|
let terminal_borders_to_the_left: HashSet<usize> = terminals_to_the_left
|
||||||
.iter()
|
.iter()
|
||||||
.map(|t| self.panes.get(t).unwrap().y())
|
.map(|t| self.panes.get(t).unwrap().y())
|
||||||
.collect();
|
.collect();
|
||||||
let (top_resize_border, terminals_above) =
|
let (top_resize_border, terminals_above) =
|
||||||
self.left_aligned_contiguous_panes_above(&id, &terminal_borders_to_the_left);
|
self.left_aligned_contiguous_panes_above(id, &terminal_borders_to_the_left);
|
||||||
let (bottom_resize_border, terminals_below) =
|
let (bottom_resize_border, terminals_below) =
|
||||||
self.left_aligned_contiguous_panes_below(&id, &terminal_borders_to_the_left);
|
self.left_aligned_contiguous_panes_below(id, &terminal_borders_to_the_left);
|
||||||
terminals_to_the_left.retain(|t| {
|
terminals_to_the_left.retain(|t| {
|
||||||
self.pane_is_between_horizontal_borders(t, top_resize_border, bottom_resize_border)
|
self.pane_is_between_horizontal_borders(t, top_resize_border, bottom_resize_border)
|
||||||
});
|
});
|
||||||
self.increase_pane_width_left(&id, count);
|
self.increase_pane_width_left(id, count);
|
||||||
for terminal_id in terminals_to_the_left {
|
for terminal_id in terminals_to_the_left {
|
||||||
self.reduce_pane_width_left(&terminal_id, count);
|
self.reduce_pane_width_left(&terminal_id, count);
|
||||||
}
|
}
|
||||||
for terminal_id in terminals_above.iter().chain(terminals_below.iter()) {
|
for terminal_id in terminals_above.iter().chain(terminals_below.iter()) {
|
||||||
self.increase_pane_width_left(&terminal_id, count);
|
self.increase_pane_width_left(terminal_id, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn can_increase_pane_and_surroundings_right(
|
fn can_increase_pane_and_surroundings_right(
|
||||||
@ -1560,7 +1560,7 @@ impl Tab {
|
|||||||
let mut new_pos_and_size_for_pane = pane.position_and_size();
|
let mut new_pos_and_size_for_pane = pane.position_and_size();
|
||||||
new_pos_and_size_for_pane.cols += increase_by;
|
new_pos_and_size_for_pane.cols += increase_by;
|
||||||
|
|
||||||
if let Some(panes_to_the_right) = self.pane_ids_directly_right_of(&pane_id) {
|
if let Some(panes_to_the_right) = self.pane_ids_directly_right_of(pane_id) {
|
||||||
return panes_to_the_right.iter().all(|id| {
|
return panes_to_the_right.iter().all(|id| {
|
||||||
let p = self.panes.get(id).unwrap();
|
let p = self.panes.get(id).unwrap();
|
||||||
p.columns() > increase_by && p.columns() - increase_by >= p.min_width()
|
p.columns() > increase_by && p.columns() - increase_by >= p.min_width()
|
||||||
@ -1585,7 +1585,7 @@ impl Tab {
|
|||||||
let mut new_pos_and_size_for_pane = pane.position_and_size();
|
let mut new_pos_and_size_for_pane = pane.position_and_size();
|
||||||
new_pos_and_size_for_pane.x = new_pos_and_size_for_pane.x.saturating_sub(increase_by);
|
new_pos_and_size_for_pane.x = new_pos_and_size_for_pane.x.saturating_sub(increase_by);
|
||||||
|
|
||||||
if let Some(panes_to_the_left) = self.pane_ids_directly_left_of(&pane_id) {
|
if let Some(panes_to_the_left) = self.pane_ids_directly_left_of(pane_id) {
|
||||||
return panes_to_the_left.iter().all(|id| {
|
return panes_to_the_left.iter().all(|id| {
|
||||||
let p = self.panes.get(id).unwrap();
|
let p = self.panes.get(id).unwrap();
|
||||||
p.columns() > increase_by && p.columns() - increase_by >= p.min_width()
|
p.columns() > increase_by && p.columns() - increase_by >= p.min_width()
|
||||||
@ -1610,7 +1610,7 @@ impl Tab {
|
|||||||
let mut new_pos_and_size_for_pane = pane.position_and_size();
|
let mut new_pos_and_size_for_pane = pane.position_and_size();
|
||||||
new_pos_and_size_for_pane.rows += increase_by;
|
new_pos_and_size_for_pane.rows += increase_by;
|
||||||
|
|
||||||
if let Some(panes_below) = self.pane_ids_directly_below(&pane_id) {
|
if let Some(panes_below) = self.pane_ids_directly_below(pane_id) {
|
||||||
return panes_below.iter().all(|id| {
|
return panes_below.iter().all(|id| {
|
||||||
let p = self.panes.get(id).unwrap();
|
let p = self.panes.get(id).unwrap();
|
||||||
p.rows() > increase_by && p.rows() - increase_by >= p.min_height()
|
p.rows() > increase_by && p.rows() - increase_by >= p.min_height()
|
||||||
@ -1631,7 +1631,7 @@ impl Tab {
|
|||||||
let mut new_pos_and_size_for_pane = pane.position_and_size();
|
let mut new_pos_and_size_for_pane = pane.position_and_size();
|
||||||
new_pos_and_size_for_pane.y = new_pos_and_size_for_pane.y.saturating_sub(increase_by);
|
new_pos_and_size_for_pane.y = new_pos_and_size_for_pane.y.saturating_sub(increase_by);
|
||||||
|
|
||||||
if let Some(panes_above) = self.pane_ids_directly_above(&pane_id) {
|
if let Some(panes_above) = self.pane_ids_directly_above(pane_id) {
|
||||||
return panes_above.iter().all(|id| {
|
return panes_above.iter().all(|id| {
|
||||||
let p = self.panes.get(id).unwrap();
|
let p = self.panes.get(id).unwrap();
|
||||||
p.rows() > increase_by && p.rows() - increase_by >= p.min_height()
|
p.rows() > increase_by && p.rows() - increase_by >= p.min_height()
|
||||||
@ -1648,7 +1648,7 @@ impl Tab {
|
|||||||
if !can_reduce_pane_size {
|
if !can_reduce_pane_size {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(panes_to_the_left) = self.pane_ids_directly_left_of(&pane_id) {
|
if let Some(panes_to_the_left) = self.pane_ids_directly_left_of(pane_id) {
|
||||||
return panes_to_the_left.iter().all(|id| {
|
return panes_to_the_left.iter().all(|id| {
|
||||||
let p = self.panes.get(id).unwrap();
|
let p = self.panes.get(id).unwrap();
|
||||||
p.max_width()
|
p.max_width()
|
||||||
@ -1667,7 +1667,7 @@ impl Tab {
|
|||||||
if !can_reduce_pane_size {
|
if !can_reduce_pane_size {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(panes_to_the_right) = self.pane_ids_directly_right_of(&pane_id) {
|
if let Some(panes_to_the_right) = self.pane_ids_directly_right_of(pane_id) {
|
||||||
return panes_to_the_right.iter().all(|id| {
|
return panes_to_the_right.iter().all(|id| {
|
||||||
let p = self.panes.get(id).unwrap();
|
let p = self.panes.get(id).unwrap();
|
||||||
p.max_width()
|
p.max_width()
|
||||||
@ -1686,7 +1686,7 @@ impl Tab {
|
|||||||
if !can_reduce_pane_size {
|
if !can_reduce_pane_size {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(panes_above) = self.pane_ids_directly_above(&pane_id) {
|
if let Some(panes_above) = self.pane_ids_directly_above(pane_id) {
|
||||||
return panes_above.iter().all(|id| {
|
return panes_above.iter().all(|id| {
|
||||||
let p = self.panes.get(id).unwrap();
|
let p = self.panes.get(id).unwrap();
|
||||||
p.max_height()
|
p.max_height()
|
||||||
@ -1705,7 +1705,7 @@ impl Tab {
|
|||||||
if !can_reduce_pane_size {
|
if !can_reduce_pane_size {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(panes_below) = self.pane_ids_directly_below(&pane_id) {
|
if let Some(panes_below) = self.pane_ids_directly_below(pane_id) {
|
||||||
return panes_below.iter().all(|id| {
|
return panes_below.iter().all(|id| {
|
||||||
let p = self.panes.get(id).unwrap();
|
let p = self.panes.get(id).unwrap();
|
||||||
p.max_height()
|
p.max_height()
|
||||||
@ -2147,7 +2147,7 @@ impl Tab {
|
|||||||
pane.can_increase_width_by(pane_to_close_width + 1)
|
pane.can_increase_width_by(pane_to_close_width + 1)
|
||||||
}) {
|
}) {
|
||||||
for pane_id in panes.iter() {
|
for pane_id in panes.iter() {
|
||||||
self.increase_pane_width_right(&pane_id, pane_to_close_width + 1);
|
self.increase_pane_width_right(pane_id, pane_to_close_width + 1);
|
||||||
// 1 for the border
|
// 1 for the border
|
||||||
}
|
}
|
||||||
self.panes.remove(&id);
|
self.panes.remove(&id);
|
||||||
@ -2163,7 +2163,7 @@ impl Tab {
|
|||||||
pane.can_increase_width_by(pane_to_close_width + 1)
|
pane.can_increase_width_by(pane_to_close_width + 1)
|
||||||
}) {
|
}) {
|
||||||
for pane_id in panes.iter() {
|
for pane_id in panes.iter() {
|
||||||
self.increase_pane_width_left(&pane_id, pane_to_close_width + 1);
|
self.increase_pane_width_left(pane_id, pane_to_close_width + 1);
|
||||||
// 1 for the border
|
// 1 for the border
|
||||||
}
|
}
|
||||||
self.panes.remove(&id);
|
self.panes.remove(&id);
|
||||||
@ -2179,7 +2179,7 @@ impl Tab {
|
|||||||
pane.can_increase_height_by(pane_to_close_height + 1)
|
pane.can_increase_height_by(pane_to_close_height + 1)
|
||||||
}) {
|
}) {
|
||||||
for pane_id in panes.iter() {
|
for pane_id in panes.iter() {
|
||||||
self.increase_pane_height_down(&pane_id, pane_to_close_height + 1);
|
self.increase_pane_height_down(pane_id, pane_to_close_height + 1);
|
||||||
// 1 for the border
|
// 1 for the border
|
||||||
}
|
}
|
||||||
self.panes.remove(&id);
|
self.panes.remove(&id);
|
||||||
@ -2195,7 +2195,7 @@ impl Tab {
|
|||||||
pane.can_increase_height_by(pane_to_close_height + 1)
|
pane.can_increase_height_by(pane_to_close_height + 1)
|
||||||
}) {
|
}) {
|
||||||
for pane_id in panes.iter() {
|
for pane_id in panes.iter() {
|
||||||
self.increase_pane_height_up(&pane_id, pane_to_close_height + 1);
|
self.increase_pane_height_up(pane_id, pane_to_close_height + 1);
|
||||||
// 1 for the border
|
// 1 for the border
|
||||||
}
|
}
|
||||||
self.panes.remove(&id);
|
self.panes.remove(&id);
|
||||||
|
@ -33,7 +33,7 @@ impl<'a> PaneResizer<'a> {
|
|||||||
Ordering::Greater => {
|
Ordering::Greater => {
|
||||||
let increase_by = new_size.cols - current_size.cols;
|
let increase_by = new_size.cols - current_size.cols;
|
||||||
if let Some(panes_to_resize) = find_increasable_vertical_chain(
|
if let Some(panes_to_resize) = find_increasable_vertical_chain(
|
||||||
&self.panes,
|
self.panes,
|
||||||
increase_by,
|
increase_by,
|
||||||
current_size.cols,
|
current_size.cols,
|
||||||
current_size.rows,
|
current_size.rows,
|
||||||
@ -50,7 +50,7 @@ impl<'a> PaneResizer<'a> {
|
|||||||
Ordering::Less => {
|
Ordering::Less => {
|
||||||
let reduce_by = current_size.cols - new_size.cols;
|
let reduce_by = current_size.cols - new_size.cols;
|
||||||
if let Some(panes_to_resize) = find_reducible_vertical_chain(
|
if let Some(panes_to_resize) = find_reducible_vertical_chain(
|
||||||
&self.panes,
|
self.panes,
|
||||||
reduce_by,
|
reduce_by,
|
||||||
current_size.cols,
|
current_size.cols,
|
||||||
current_size.rows,
|
current_size.rows,
|
||||||
@ -67,7 +67,7 @@ impl<'a> PaneResizer<'a> {
|
|||||||
Ordering::Greater => {
|
Ordering::Greater => {
|
||||||
let increase_by = new_size.rows - current_size.rows;
|
let increase_by = new_size.rows - current_size.rows;
|
||||||
if let Some(panes_to_resize) = find_increasable_horizontal_chain(
|
if let Some(panes_to_resize) = find_increasable_horizontal_chain(
|
||||||
&self.panes,
|
self.panes,
|
||||||
increase_by,
|
increase_by,
|
||||||
current_size.cols,
|
current_size.cols,
|
||||||
current_size.rows,
|
current_size.rows,
|
||||||
@ -81,7 +81,7 @@ impl<'a> PaneResizer<'a> {
|
|||||||
Ordering::Less => {
|
Ordering::Less => {
|
||||||
let reduce_by = current_size.rows - new_size.rows;
|
let reduce_by = current_size.rows - new_size.rows;
|
||||||
if let Some(panes_to_resize) = find_reducible_horizontal_chain(
|
if let Some(panes_to_resize) = find_reducible_horizontal_chain(
|
||||||
&self.panes,
|
self.panes,
|
||||||
reduce_by,
|
reduce_by,
|
||||||
current_size.cols,
|
current_size.cols,
|
||||||
current_size.rows,
|
current_size.rows,
|
||||||
|
@ -20,7 +20,7 @@ const fn system_default_data_dir() -> &'static str {
|
|||||||
if let Some(data_dir) = std::option_env!("PREFIX") {
|
if let Some(data_dir) = std::option_env!("PREFIX") {
|
||||||
data_dir
|
data_dir
|
||||||
} else {
|
} else {
|
||||||
&"/usr"
|
"/usr"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ impl TryFrom<&CliArgs> for Config {
|
|||||||
|
|
||||||
fn try_from(opts: &CliArgs) -> ConfigResult {
|
fn try_from(opts: &CliArgs) -> ConfigResult {
|
||||||
if let Some(ref path) = opts.config {
|
if let Some(ref path) = opts.config {
|
||||||
return Config::new(&path);
|
return Config::new(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(Command::Setup(ref setup)) = opts.command {
|
if let Some(Command::Setup(ref setup)) = opts.command {
|
||||||
@ -96,7 +96,7 @@ impl TryFrom<&CliArgs> for Config {
|
|||||||
impl Config {
|
impl Config {
|
||||||
/// Uses defaults, but lets config override them.
|
/// Uses defaults, but lets config override them.
|
||||||
pub fn from_yaml(yaml_config: &str) -> ConfigResult {
|
pub fn from_yaml(yaml_config: &str) -> ConfigResult {
|
||||||
let config_from_yaml: ConfigFromYaml = serde_yaml::from_str(&yaml_config)?;
|
let config_from_yaml: ConfigFromYaml = serde_yaml::from_str(yaml_config)?;
|
||||||
let keybinds = Keybinds::get_default_keybinds_with_config(config_from_yaml.keybinds);
|
let keybinds = Keybinds::get_default_keybinds_with_config(config_from_yaml.keybinds);
|
||||||
let options = Options::from_yaml(config_from_yaml.options);
|
let options = Options::from_yaml(config_from_yaml.options);
|
||||||
let themes = config_from_yaml.themes;
|
let themes = config_from_yaml.themes;
|
||||||
|
@ -69,8 +69,8 @@ impl Layout {
|
|||||||
layout_dir: Option<PathBuf>,
|
layout_dir: Option<PathBuf>,
|
||||||
) -> Option<Layout> {
|
) -> Option<Layout> {
|
||||||
let layout_result = layout
|
let layout_result = layout
|
||||||
.map(|p| Layout::from_dir(&p, layout_dir.as_ref()))
|
.map(|p| Layout::from_dir(p, layout_dir.as_ref()))
|
||||||
.or_else(|| layout_path.map(|p| Layout::new(&p)))
|
.or_else(|| layout_path.map(|p| Layout::new(p)))
|
||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
Some(Layout::from_dir(
|
Some(Layout::from_dir(
|
||||||
&std::path::PathBuf::from("default"),
|
&std::path::PathBuf::from("default"),
|
||||||
@ -138,7 +138,7 @@ impl Layout {
|
|||||||
&self,
|
&self,
|
||||||
space: &PositionAndSize,
|
space: &PositionAndSize,
|
||||||
) -> Vec<(Layout, PositionAndSize)> {
|
) -> Vec<(Layout, PositionAndSize)> {
|
||||||
split_space(space, &self)
|
split_space(space, self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ fn split_space(
|
|||||||
for (i, part) in layout.parts.iter().enumerate() {
|
for (i, part) in layout.parts.iter().enumerate() {
|
||||||
let part_position_and_size = split_parts.get(i).unwrap();
|
let part_position_and_size = split_parts.get(i).unwrap();
|
||||||
if !part.parts.is_empty() {
|
if !part.parts.is_empty() {
|
||||||
let mut part_positions = split_space(&part_position_and_size, part);
|
let mut part_positions = split_space(part_position_and_size, part);
|
||||||
pane_positions.append(&mut part_positions);
|
pane_positions.append(&mut part_positions);
|
||||||
} else {
|
} else {
|
||||||
pane_positions.push((part.clone(), *part_position_and_size));
|
pane_positions.push((part.clone(), *part_position_and_size));
|
||||||
|
@ -70,7 +70,7 @@ impl Options {
|
|||||||
|
|
||||||
pub fn from_cli(&self, other: Option<Command>) -> Options {
|
pub fn from_cli(&self, other: Option<Command>) -> Options {
|
||||||
if let Some(Command::Options(options)) = other {
|
if let Some(Command::Options(options)) = other {
|
||||||
Options::merge(&self, options)
|
Options::merge(self, options)
|
||||||
} else {
|
} else {
|
||||||
self.to_owned()
|
self.to_owned()
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ pub fn get_layout_dir(config_dir: Option<PathBuf>) -> Option<PathBuf> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn dump_asset(asset: &[u8]) -> std::io::Result<()> {
|
pub fn dump_asset(asset: &[u8]) -> std::io::Result<()> {
|
||||||
std::io::stdout().write_all(&asset)?;
|
std::io::stdout().write_all(asset)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ impl Setup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if self.check {
|
if self.check {
|
||||||
Setup::check_defaults_config(&opts)?;
|
Setup::check_defaults_config(opts)?;
|
||||||
std::process::exit(0);
|
std::process::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,14 +163,14 @@ impl Setup {
|
|||||||
if let Some(config_dir) = config_dir {
|
if let Some(config_dir) = config_dir {
|
||||||
message.push_str(&format!("[CONFIG DIR]: {:?}\n", config_dir));
|
message.push_str(&format!("[CONFIG DIR]: {:?}\n", config_dir));
|
||||||
} else {
|
} else {
|
||||||
message.push_str(&"[CONFIG DIR]: Not Found\n");
|
message.push_str("[CONFIG DIR]: Not Found\n");
|
||||||
let mut default_config_dirs = default_config_dirs()
|
let mut default_config_dirs = default_config_dirs()
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|p| p.clone())
|
.filter_map(|p| p.clone())
|
||||||
.collect::<Vec<PathBuf>>();
|
.collect::<Vec<PathBuf>>();
|
||||||
default_config_dirs.dedup();
|
default_config_dirs.dedup();
|
||||||
message.push_str(
|
message.push_str(
|
||||||
&" On your system zellij looks in the following config directories by default:\n",
|
" On your system zellij looks in the following config directories by default:\n",
|
||||||
);
|
);
|
||||||
for dir in default_config_dirs {
|
for dir in default_config_dirs {
|
||||||
message.push_str(&format!(" {:?}\n", dir));
|
message.push_str(&format!(" {:?}\n", dir));
|
||||||
@ -180,11 +180,11 @@ impl Setup {
|
|||||||
use crate::input::config::Config;
|
use crate::input::config::Config;
|
||||||
message.push_str(&format!("[CONFIG FILE]: {:?}\n", config_file));
|
message.push_str(&format!("[CONFIG FILE]: {:?}\n", config_file));
|
||||||
match Config::new(&config_file) {
|
match Config::new(&config_file) {
|
||||||
Ok(_) => message.push_str(&"[CONFIG FILE]: Well defined.\n"),
|
Ok(_) => message.push_str("[CONFIG FILE]: Well defined.\n"),
|
||||||
Err(e) => message.push_str(&format!("[CONFIG ERROR]: {}\n", e)),
|
Err(e) => message.push_str(&format!("[CONFIG ERROR]: {}\n", e)),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
message.push_str(&"[CONFIG FILE]: Not Found\n");
|
message.push_str("[CONFIG FILE]: Not Found\n");
|
||||||
message.push_str(&format!(
|
message.push_str(&format!(
|
||||||
" By default zellij looks for a file called [{}] in the configuration directory\n",
|
" By default zellij looks for a file called [{}] in the configuration directory\n",
|
||||||
CONFIG_NAME
|
CONFIG_NAME
|
||||||
@ -196,12 +196,12 @@ impl Setup {
|
|||||||
message.push_str(&format!("[SYSTEM DATA DIR]: {:?}\n", system_data_dir));
|
message.push_str(&format!("[SYSTEM DATA DIR]: {:?}\n", system_data_dir));
|
||||||
|
|
||||||
message.push_str(&format!("[ARROW SEPARATOR]: {}\n", ARROW_SEPARATOR));
|
message.push_str(&format!("[ARROW SEPARATOR]: {}\n", ARROW_SEPARATOR));
|
||||||
message.push_str(&" Is the [ARROW_SEPARATOR] displayed correctly?\n");
|
message.push_str(" Is the [ARROW_SEPARATOR] displayed correctly?\n");
|
||||||
message.push_str(&" If not you may want to either start zellij with a compatible mode 'zellij options --simplified-ui'\n");
|
message.push_str(" If not you may want to either start zellij with a compatible mode 'zellij options --simplified-ui'\n");
|
||||||
message.push_str(&" Or check the font that is in use:\n https://zellij.dev/documentation/compatibility.html#the-status-bar-fonts-dont-render-correctly\n");
|
message.push_str(" Or check the font that is in use:\n https://zellij.dev/documentation/compatibility.html#the-status-bar-fonts-dont-render-correctly\n");
|
||||||
|
|
||||||
message.push_str(&format!("[FEATURES]: {:?}\n", FEATURES));
|
message.push_str(&format!("[FEATURES]: {:?}\n", FEATURES));
|
||||||
message.push_str(&"[DOCUMENTATION]: zellij.dev/documentation/\n");
|
message.push_str("[DOCUMENTATION]: zellij.dev/documentation/\n");
|
||||||
|
|
||||||
std::io::stdout().write_all(message.as_bytes())?;
|
std::io::stdout().write_all(message.as_bytes())?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user