Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tabs to layouts #625

Merged
merged 35 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5ede25d
Add `tabs` to `layouts`
a-kenji Jul 9, 2021
485339c
Merge branch 'main' of https://github.com/zellij-org/zellij into tab-…
a-kenji Jul 23, 2021
f323880
!fixup cargo fmt
a-kenji Jul 23, 2021
806ffad
fixup! fix e2e fixtures
a-kenji Jul 23, 2021
fc7bc3c
Merge branch 'main' of https://github.com/zellij-org/zellij into tab-…
a-kenji Aug 1, 2021
9a5b669
Add example tab layouts
a-kenji Aug 1, 2021
2e17756
Change layout panics to errors
a-kenji Aug 2, 2021
5799ea4
feat(tab): add keybind to go to last tab visited
sagittarius-a Jul 21, 2021
7346366
fix: rename variable as stated in pull request
sagittarius-a Jul 22, 2021
404faf0
fix: fix toggle to previous tab when deleting tabs
sagittarius-a Jul 23, 2021
081c554
fix: rename action to ToggleTab
sagittarius-a Jul 23, 2021
aff9973
fix: fix clippy warning
sagittarius-a Jul 23, 2021
4f482f3
store tab history in a stack-like data structure
sagittarius-a Aug 2, 2021
24ef96b
fix cargo clippy lint
sagittarius-a Aug 3, 2021
426cee7
docs(governance): arbiter no-confidence vote
imsnif Aug 11, 2021
a37d3e5
feat(ui): pane frames (new pane UI) (#643)
imsnif Aug 12, 2021
da3f20c
fix(compatibility): support changing index colors with osc (#646)
imsnif Aug 13, 2021
e477f3b
fix(child-process): unexpected pane closing issue with nushell (#648)
tw4452852 Aug 16, 2021
fde38dc
docs(changelog): nushell fix
imsnif Aug 16, 2021
e889891
Fix scrolling (#650)
imsnif Aug 19, 2021
2100865
fix(performance): undo degredation introduced in 646 (#651)
imsnif Aug 19, 2021
a4e6e89
fix(compatibility): do not remove frame when clearing viewport (#652)
imsnif Aug 20, 2021
643b7df
fix(compatibility): properly paste multilines (#653)
imsnif Aug 20, 2021
88b4063
Add `template` section in `layout` file
a-kenji Aug 21, 2021
d1b5a69
eliminate unused imports warnings during compile (#654)
tw4452852 Aug 23, 2021
94f20cf
Indicate to the user when text is copied to the clipboard (#642)
tlinford Aug 23, 2021
01c5378
docs(changelog): copy to clipboard UI
imsnif Aug 23, 2021
d969bbf
fix(compatibility): docker-compose progress bar (#656)
imsnif Aug 23, 2021
b1906c8
Merge pull request #622 from sagittarius-a/feature/go-to-last-tab
a-kenji Aug 23, 2021
7a2f86d
docs(changelog): add `ToggleTab` action
a-kenji Aug 23, 2021
618c2c3
Merge branch 'tab-layout' of https://github.com/a-kenji/zellij into a…
imsnif Aug 24, 2021
06e3be6
test(layout): add borderless
imsnif Aug 24, 2021
cd0b011
Split tab-layout into `template` & `tabs` section
a-kenji Aug 26, 2021
8a78f9d
fixup! remove test file
a-kenji Aug 26, 2021
10abb70
fixup! adjust fixture layouts
a-kenji Aug 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
* Bound by default to `^c` in `scroll` mode, scrolls to bottom and exists the scroll mode
* Simplify deserialization slightly (https://github.com/zellij-org/zellij/pull/633)
* Fix update plugin attributes on inactive tab (https://github.com/zellij-org/zellij/pull/634)
* New pane UI: draw pane frames - can be disabled with ctrl-p + z, or through configuration (https://github.com/zellij-org/zellij/pull/643)
* Terminal compatibility: support changing index colors through OSC 4 and similar (https://github.com/zellij-org/zellij/pull/646)
* Fix various shells (eg. nushell) unexpectedly exiting when the user presses ctrl-c (https://github.com/zellij-org/zellij/pull/648)
* Fix line wrapping while scrolling (https://github.com/zellij-org/zellij/pull/650)
* Indicate to the user when text is copied to the clipboard with the mouse (https://github.com/zellij-org/zellij/pull/642)
* Terminal compatibility: fix progress bar line overflow (http://github.com/zellij-org/zellij/pull/656)
* Add action to toggle between tabs `ToggleTab`, bound by default to [TAB] in tab mode (https://github.com/zellij-org/zellij/pull/622)

## [0.15.0] - 2021-07-19
* Kill children properly (https://github.com/zellij-org/zellij/pull/601)
Expand Down
16 changes: 14 additions & 2 deletions GOVERNANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,24 @@ In case of ties, one member designated as Arbiter can break the tie. For reasons

Some decisions that should always be brought to the quorum of members:
* Adding new members to the organization
* Removing existing members from the organization
* Any decision involving money or finances
* Collaborations with outside organizations

## Role of the Arbiter
The Arbiter is a member of the quorum who serves as a tie breaker in votes and also has veto privileges for the votes themselves. Both of these should be used as seldom as possible and preferably not at all.
Once the organization reaches 10 members, a reasonable and achievable process must be established in order to replace the Arbiter if the need arises (for example: a majority vote of members can replace the Arbiter with another candidate). In any case, the Arbiter has to be an organization member.

### Arbiter no-confidence vote
It is preferable that any conflict with the Arbiter, no matter how severe, be resolved amicably. However, it is acknowledged that this is not always possible. For those cases, and for the health of Zellij and its community, this is the process in order to remove a sitting Arbiter against their will:

1. Find another willing candidate from the existing organization members
2. Email all the organization members to the addresses specified in this document, letting them know about the vote and the replacement candidate
3. All the maintainers have 2 weeks to reply (privately) with a yes (remove the Arbiter) or no (do not remove the Arbiter) vote - the sitting Arbiter does not get a vote
4. The votes should be tallied and verified by the vote initiator as well as another organization member who is not the sitting Arbiter
5. If at least two thirds (rounded up) of the respondents vote to remove - the vote succeeds and the new Arbiter is instated in place of the sitting one
6. The sitting Arbiter remains an organization member unless explicitly removed by a normal majority vote

For the removal of doubt: changing this rule itself requires a two thirds majority of maintainers as well.

## Current Organization Members
* Aram Drevekenin <aram@poor.dev> (Arbiter)
Expand All @@ -29,4 +41,4 @@ Once the organization reaches 10 members, a reasonable and achievable process mu
* Roee Shapira <ro33.sha@gmail.com>
* Alex Kenji Berthold <aks.kenji@protonmail.com>
* Kyle Sutherland-Cash <kyle.sutherlandcash@gmail.com>
* Dante Pippi <dante.dpf@gmail.com>
* Dante Pippi <dante.dpf@gmail.com>
34 changes: 28 additions & 6 deletions default-plugins/status-bar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use zellij_tile::prelude::*;
use zellij_tile_utils::style;

use first_line::{ctrl_keys, superkey};
use second_line::keybinds;
use second_line::{keybinds, text_copied_hint};

// for more of these, copy paste from: https://en.wikipedia.org/wiki/Box-drawing_character
static ARROW_SEPARATOR: &str = "";
Expand All @@ -17,6 +17,7 @@ static MORE_MSG: &str = " ... ";
#[derive(Default)]
struct State {
mode_info: ModeInfo,
diplay_text_copied_hint: bool,
}

register_plugin!(State);
Expand Down Expand Up @@ -136,12 +137,25 @@ impl ZellijPlugin for State {
set_selectable(false);
set_invisible_borders(true);
set_fixed_height(2);
subscribe(&[EventType::ModeUpdate]);
subscribe(&[
EventType::ModeUpdate,
EventType::CopyToClipboard,
EventType::InputReceived,
]);
}

fn update(&mut self, event: Event) {
if let Event::ModeUpdate(mode_info) = event {
self.mode_info = mode_info;
match event {
Event::ModeUpdate(mode_info) => {
self.mode_info = mode_info;
}
Event::CopyToClipboard => {
self.diplay_text_copied_hint = true;
}
Event::InputReceived => {
self.diplay_text_copied_hint = false;
}
_ => {}
}
}

Expand All @@ -154,10 +168,18 @@ impl ZellijPlugin for State {

let colored_elements = color_elements(self.mode_info.palette);
let superkey = superkey(colored_elements, separator);
let ctrl_keys = ctrl_keys(&self.mode_info, cols - superkey.len, separator);
let ctrl_keys = ctrl_keys(
&self.mode_info,
cols.saturating_sub(superkey.len),
separator,
);

let first_line = format!("{}{}", superkey, ctrl_keys);
let second_line = keybinds(&self.mode_info, cols);
let second_line = if self.diplay_text_copied_hint {
text_copied_hint(&self.mode_info.palette)
} else {
keybinds(&self.mode_info, cols)
};

// [48;5;238m is gray background, [0K is so that it fills the rest of the line
// [m is background reset, [0K is so that it clears the rest of the line
Expand Down
12 changes: 12 additions & 0 deletions default-plugins/status-bar/src/second_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,3 +375,15 @@ pub fn keybinds(help: &ModeInfo, max_width: usize) -> LinePart {
}
best_effort_shortcut_list(help, max_width)
}

pub fn text_copied_hint(palette: &Palette) -> LinePart {
let hint = " Text copied to clipboard";
let green_color = match palette.green {
PaletteColor::Rgb((r, g, b)) => RGB(r, g, b),
PaletteColor::EightBit(color) => Fixed(color),
};
LinePart {
part: format!("{}", Style::new().fg(green_color).bold().paint(hint)),
len: hint.len(),
}
}
6 changes: 3 additions & 3 deletions default-plugins/strider/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ impl FsEntry {
FsEntry::Dir(_, s) => s.to_string(),
FsEntry::File(_, s) => pb::convert(*s as f64),
};
let space = width - info.len();
let space = width.saturating_sub(info.len());
let name = self.name();
if space - 1 < name.len() {
[&name[..space - 2], &info].join("~ ")
if space.saturating_sub(1) < name.len() {
[&name[..space.saturating_sub(2)], &info].join("~ ")
} else {
let padding = " ".repeat(space - name.len());
[name, padding, info].concat()
Expand Down
6 changes: 3 additions & 3 deletions default-plugins/tab-bar/src/line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub fn tab_line(
&mut tabs_before_active,
&mut tabs_after_active,
&mut tabs_to_render,
cols - prefix.len,
cols.saturating_sub(prefix.len),
);

let mut tab_line: Vec<LinePart> = vec![];
Expand All @@ -200,7 +200,7 @@ pub fn tab_line(
&mut tabs_before_active,
&mut tabs_to_render,
&mut tab_line,
cols - prefix.len,
cols.saturating_sub(prefix.len),
palette,
tab_separator(capabilities),
);
Expand All @@ -210,7 +210,7 @@ pub fn tab_line(
add_next_tabs_msg(
&mut tabs_after_active,
&mut tab_line,
cols - prefix.len,
cols.saturating_sub(prefix.len),
palette,
tab_separator(capabilities),
);
Expand Down
87 changes: 87 additions & 0 deletions example/layouts/multiple_tabs_layout.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
template:
direction: Horizontal
parts:
- direction: Vertical
split_size:
Fixed: 1
run:
plugin: tab-bar
borderless: true
- direction: Vertical
body: true
- direction: Vertical
split_size:
Fixed: 2
run:
plugin: status-bar
borderless: true

tabs:
- direction: Vertical
parts:
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
- direction: Vertical
parts:
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
parts:
- direction: Vertical
split_size:
Percent: 50
- direction: Horizontal
split_size:
Percent: 50
parts:
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
- direction: Vertical
- direction: Vertical
- direction: Vertical
parts:
- direction: Vertical
split_size:
Percent: 20
run:
plugin: strider
- direction: Horizontal
split_size:
Percent: 80
parts:
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
parts:
- direction: Vertical
split_size:
Percent: 40
- direction: Horizontal
split_size:
Percent: 60
parts:
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
split_size:
Percent: 50
90 changes: 90 additions & 0 deletions example/layouts/multiple_tabs_layout_htop_command.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
template:
direction: Horizontal
parts:
- direction: Vertical
split_size:
Fixed: 1
run:
plugin: tab-bar
borderless: true
- direction: Vertical
body: true
- direction: Vertical
split_size:
Fixed: 2
run:
plugin: status-bar
borderless: true

tabs:
- direction: Vertical
parts:
- direction: Vertical
split_size:
Percent: 50
run:
command: {cmd: htop}
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
parts:
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
parts:
- direction: Vertical
split_size:
Percent: 50
- direction: Horizontal
split_size:
Percent: 50
parts:
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
- direction: Vertical
run:
command: {cmd: htop, args: ["-C"]}
- direction: Vertical
- direction: Vertical
parts:
- direction: Vertical
split_size:
Percent: 20
run:
plugin: strider
- direction: Horizontal
split_size:
Percent: 80
parts:
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
parts:
- direction: Vertical
split_size:
Percent: 40
- direction: Horizontal
split_size:
Percent: 60
parts:
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
split_size:
Percent: 50
21 changes: 21 additions & 0 deletions example/layouts/run_htop_layout.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
tabs:
- direction: Vertical
parts:
- direction: Horizontal
split_size:
Percent: 50
parts:
- direction: Vertical
split_size:
Percent: 50
- direction: Vertical
split_size:
Percent: 50
run:
command: {cmd: htop}
- direction: Horizontal
split_size:
Percent: 50
run:
command: {cmd: htop}
Loading