summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordenis <denismaximov98@gmail.com>2021-04-24 09:18:37 +0300
committerdenis <denismaximov98@gmail.com>2021-04-24 09:18:37 +0300
commit47a918a53c6f48ab075bdc1a6fd7b52095067f91 (patch)
tree313e75ec6a78a9d0e2a70543244277781d0a2d42
parentae3537957b7b1a580e7e4920bfc4d5cbb27ca97c (diff)
parent83c7e5622b6fb243c4422af87b50b353a0645e2a (diff)
wip: merge main
-rw-r--r--.github/workflows/release.yml99
-rw-r--r--CHANGELOG.md7
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--src/client/layout.rs31
-rw-r--r--src/client/panes/plugin_pane.rs24
-rw-r--r--src/client/panes/terminal_pane.rs22
-rw-r--r--src/client/tab.rs32
-rw-r--r--src/common/input/keybinds.rs1
-rw-r--r--src/tests/integration/basic.rs13
-rw-r--r--src/tests/integration/close_pane.rs13
-rw-r--r--src/tests/integration/compatibility.rs20
-rw-r--r--src/tests/integration/layouts.rs1
-rw-r--r--src/tests/integration/move_focus_down.rs4
-rw-r--r--src/tests/integration/move_focus_left.rs4
-rw-r--r--src/tests/integration/move_focus_right.rs4
-rw-r--r--src/tests/integration/move_focus_up.rs4
-rw-r--r--src/tests/integration/resize_down.rs13
-rw-r--r--src/tests/integration/resize_left.rs13
-rw-r--r--src/tests/integration/resize_right.rs13
-rw-r--r--src/tests/integration/resize_up.rs13
-rw-r--r--src/tests/integration/snapshots/zellij__tests__integration__move_focus_down__move_focus_down_to_the_largest_overlap.snap2
-rw-r--r--src/tests/integration/snapshots/zellij__tests__integration__move_focus_down__move_focus_down_to_the_most_recently_used_pane.snap25
-rw-r--r--src/tests/integration/snapshots/zellij__tests__integration__move_focus_left__move_focus_left_to_the_largest_overlap.snap4
-rw-r--r--src/tests/integration/snapshots/zellij__tests__integration__move_focus_left__move_focus_left_to_the_most_recently_used_pane.snap25
-rw-r--r--src/tests/integration/snapshots/zellij__tests__integration__move_focus_right__move_focus_right_to_the_largest_overlap.snap4
-rw-r--r--src/tests/integration/snapshots/zellij__tests__integration__move_focus_right__move_focus_right_to_the_most_recently_used_pane.snap25
-rw-r--r--src/tests/integration/snapshots/zellij__tests__integration__move_focus_up__move_focus_up_to_the_largest_overlap.snap2
-rw-r--r--src/tests/integration/snapshots/zellij__tests__integration__move_focus_up__move_focus_up_to_the_most_recently_used_pane.snap25
-rw-r--r--src/tests/integration/tabs.rs8
-rw-r--r--src/tests/integration/terminal_window_resize.rs8
-rw-r--r--src/tests/integration/toggle_fullscreen.rs2
32 files changed, 335 insertions, 130 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
deleted file mode 100644
index 012d17d38..000000000
--- a/.github/workflows/release.yml
+++ /dev/null
@@ -1,99 +0,0 @@
-name: Packaging
-
-on:
- push:
- tags:
- - 'v*.*.*'
-
-jobs:
- publish:
- name: Publish on ${{ matrix.os }} for ${{ matrix.target }}
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- target:
- - x86_64-unknown-linux-gnu
- - x86_64-unknown-linux-musl
- - x86_64-apple-darwin
-
- include:
- - os: ubuntu-18.04
- target: x86_64-unknown-linux-gnu
- client_artifact_name: target/x86_64-unknown-linux-gnu/release/mosaic
- client_release_name: mosaic-x86_64-unknown-linux-gnu
- strip: true
-
- - os: ubuntu-18.04
- target: x86_64-unknown-linux-musl
- client_artifact_name: target/x86_64-unknown-linux-musl/release/mosaic
- client_release_name: mosaic-x86_64-unknown-linux-musl
- strip: true
-
- - os: macos-latest
- target: x86_64-apple-darwin
- client_artifact_name: target/x86_64-apple-darwin/release/mosaic
- client_release_name: mosaic-x86_64-macos-darwin
- strip: true
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v2
-
- - name: Setup Rust toolchain
- uses: actions-rs/toolchain@v1
- with:
- toolchain: stable
- target: ${{ matrix.target }}
- override: true
-
- - name: Install musl
- if: matrix.target == 'x86_64-unknown-linux-musl'
- run: |
- sudo apt update
- sudo apt install musl-tools -y
-
- - name: cargo build
- uses: actions-rs/cargo@v1
- with:
- command: build
- args: --release --locked --target=${{ matrix.target }}
-
-
- - name: Compress client
- uses: svenstaro/upx-action@v2
- with:
- file: ${{ matrix.client_artifact_name }}
- args: --lzma
- strip: ${{ matrix.strip }}
-
-
- # TODO?
- # - name: Get CHANGELOG.md entry
- # id: changelog_reader
- # uses: mindsers/changelog-reader-action@v1.2.0
- # with:
- # path: ./CHANGELOG.md
-
- - name: Upload client binaries to release
- uses: svenstaro/upload-release-action@v2
- with:
- repo_token: ${{ secrets.GITHUB_TOKEN }}
- file: ${{ matrix.client_artifact_name }}
- asset_name: ${{ matrix.client_release_name }}
- tag: ${{ github.ref }}
-
- deb-build:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@master
- - name: Deb Build
- uses: ebbflow-io/cargo-deb-amd64-ubuntu@1.0
-
- - name: Upload deb to release
- uses: svenstaro/upload-release-action@v2
- with:
- repo_token: ${{ secrets.GITHUB_TOKEN }}
- file: target/x86_64-unknown-linux-musl/debian/mosaic*
- asset_name: mosaic-amd64.deb
- tag: ${{ github.ref }}
- file_glob: true
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d3ac461d0..ed90c8a1d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,12 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
## [Unreleased]
+* Doesn't quit anymore on single `q` press while in tab mode (https://github.com/zellij-org/zellij/pull/342)
+
+## [0.5.1] - 2021-04-23
* Change config to flag (https://github.com/zellij-org/zellij/pull/300)
* Add ZELLIJ environment variable on startup (https://github.com/zellij-org/zellij/pull/305)
* Terminal fix: do not clear line if it's not there (https://github.com/zellij-org/zellij/pull/289)
* Do not allow opening new pane on the status bar (https://github.com/zellij-org/zellij/pull/314)
* Allow scrolling by full pages (https://github.com/zellij-org/zellij/pull/298)
-* Reduce crate size by 4.8MB using `cargo diet`, to 77kB (https://github.com/zellij-org/zellij/pull/293)
+* Reduce crate size by 4.8MB using `cargo diet`, to 77kB (https://github.com/zellij-org/zellij/pull/293)
+* Draw UI properly when instantiated as the default terminal command (https://github.com/zellij-org/zellij/pull/323)
+* Resolve ambiguous pane movements by their activity history (https://github.com/zellij-org/zellij/pull/294)
## [0.5.0] - 2021-04-20
Beta release with all the things
diff --git a/Cargo.lock b/Cargo.lock
index 534410c74..7c5efaa07 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2217,7 +2217,7 @@ dependencies = [
[[package]]
name = "zellij"
-version = "0.5.0"
+version = "0.6.0"
dependencies = [
"ansi_term 0.12.1",
"async-std",
diff --git a/Cargo.toml b/Cargo.toml
index 53eb0cd1a..618b49d9b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "zellij"
-version = "0.5.0"
+version = "0.6.0"
authors = ["Aram Drevekenin <aram@poor.dev>"]
edition = "2018"
description = "A terminal workspace with batteries included"
diff --git a/src/client/layout.rs b/src/client/layout.rs
index e82f90458..e28058ba4 100644
--- a/src/client/layout.rs
+++ b/src/client/layout.rs
@@ -17,14 +17,17 @@ fn split_space_to_parts_vertically(
// First fit in the parameterized sizes
for size in sizes {
- let columns = match size {
+ let (columns, max_columns) = match size {
Some(SplitSize::Percent(percent)) => {
- (max_width as f32 * (percent as f32 / 100.0)) as usize
+ ((max_width as f32 * (percent as f32 / 100.0)) as usize, None)
} // TODO: round properly
- Some(SplitSize::Fixed(size)) => size as usize,
+ Some(SplitSize::Fixed(size)) => (size as usize, Some(size as usize)),
None => {
parts_to_grow.push(current_x_position);
- 1 // This is grown later on
+ (
+ 1, // This is grown later on
+ None,
+ )
}
};
split_parts.push(PositionAndSize {
@@ -32,6 +35,8 @@ fn split_space_to_parts_vertically(
y: space_to_split.y,
columns,
rows: space_to_split.rows,
+ max_columns,
+ ..Default::default()
});
current_width += columns;
current_x_position += columns + 1; // 1 for gap
@@ -80,14 +85,18 @@ fn split_space_to_parts_horizontally(
let mut parts_to_grow = Vec::new();
for size in sizes {
- let rows = match size {
- Some(SplitSize::Percent(percent)) => {
- (max_height as f32 * (percent as f32 / 100.0)) as usize
- } // TODO: round properly
- Some(SplitSize::Fixed(size)) => size as usize,
+ let (rows, max_rows) = match size {
+ Some(SplitSize::Percent(percent)) => (
+ (max_height as f32 * (percent as f32 / 100.0)) as usize,
+ None,
+ ), // TODO: round properly
+ Some(SplitSize::Fixed(size)) => (size as usize, Some(size as usize)),
None => {
parts_to_grow.push(current_y_position);
- 1 // This is grown later on
+ (
+ 1, // This is grown later on
+ None,
+ )
}
};
split_parts.push(PositionAndSize {
@@ -95,6 +104,8 @@ fn split_space_to_parts_horizontally(
y: current_y_position,
columns: space_to_split.columns,
rows,
+ max_rows,
+ ..Default::default()
});
current_height += rows;
current_y_position += rows + 1; // 1 for gap
diff --git a/src/client/panes/plugin_pane.rs b/src/client/panes/plugin_pane.rs
index 24daec08a..21480ac22 100644
--- a/src/client/panes/plugin_pane.rs
+++ b/src/client/panes/plugin_pane.rs
@@ -1,9 +1,10 @@
use crate::{common::SenderWithContext, pty_bus::VteBytes, tab::Pane, wasm_vm::PluginInstruction};
-use std::{sync::mpsc::channel, unimplemented};
-
use crate::panes::{PaneId, PositionAndSize};
+use std::time::Instant;
+use std::{sync::mpsc::channel, unimplemented};
+
pub struct PluginPane {
pub pid: u32,
pub should_render: bool,
@@ -13,6 +14,8 @@ pub struct PluginPane {
pub position_and_size_override: Option<PositionAndSize>,
pub send_plugin_instructions: SenderWithContext<PluginInstruction>,
pub max_height: Option<usize>,
+ pub max_width: Option<usize>,
+ pub active_at: Instant,
}
impl PluginPane {
@@ -30,6 +33,8 @@ impl PluginPane {
position_and_size_override: None,
send_plugin_instructions,
max_height: None,
+ max_width: None,
+ active_at: Instant::now(),
}
}
}
@@ -73,6 +78,7 @@ impl Pane for PluginPane {
y,
rows: size.rows,
columns: size.columns,
+ ..Default::default()
};
self.position_and_size_override = Some(position_and_size_override);
self.should_render = true;
@@ -108,6 +114,9 @@ impl Pane for PluginPane {
fn set_max_height(&mut self, max_height: usize) {
self.max_height = Some(max_height);
}
+ fn set_max_width(&mut self, max_width: usize) {
+ self.max_width = Some(max_width);
+ }
fn render(&mut self) -> Option<String> {
// if self.should_render {
if true {
@@ -195,7 +204,18 @@ impl Pane for PluginPane {
fn max_height(&self) -> Option<usize> {
self.max_height
}
+ fn max_width(&self) -> Option<usize> {
+ self.max_width
+ }
fn invisible_borders(&self) -> bool {
self.invisible_borders
}
+
+ fn active_at(&self) -> Instant {
+ self.active_at
+ }
+
+ fn set_active_at(&mut self, time: Instant) {
+ self.active_at = time;
+ }
}
diff --git a/src/client/panes/terminal_pane.rs b/src/client/panes/terminal_pane.rs
index 5d63a1009..ddb108893 100644
--- a/src/client/panes/terminal_pane.rs
+++ b/src/client/panes/terminal_pane.rs
@@ -2,6 +2,7 @@ use crate::tab::Pane;
use ::nix::pty::Winsize;
use ::std::os::unix::io::RawFd;
use std::fmt::Debug;
+use std::time::Instant;
use crate::panes::grid::Grid;
use crate::panes::terminal_character::{
@@ -23,6 +24,8 @@ pub struct PositionAndSize {
pub y: usize,
pub rows: usize,
pub columns: usize,
+ pub max_rows: Option<usize>,
+ pub max_columns: Option<usize>,
}
impl From<Winsize> for PositionAndSize {
@@ -42,6 +45,8 @@ pub struct TerminalPane {
pub position_and_size: PositionAndSize,
pub position_and_size_override: Option<PositionAndSize>,
pub max_height: Option<usize>,
+ pub max_width: Option<usize>,
+ pub active_at: Instant,
vte_parser: vte::Parser,
}
@@ -73,6 +78,7 @@ impl Pane for TerminalPane {
y,
rows: size.rows,
columns: size.columns,
+ ..Default::default()
};
self.position_and_size_override = Some(position_and_size_override);
self.reflow_lines();
@@ -147,12 +153,18 @@ impl Pane for TerminalPane {
fn set_max_height(&mut self, max_height: usize) {
self.max_height = Some(max_height);
}
+ fn set_max_width(&mut self, max_width: usize) {
+ self.max_width = Some(max_width);
+ }
fn set_invisible_borders(&mut self, _invisible_borders: bool) {
unimplemented!();
}
fn max_height(&self) -> Option<usize> {
self.max_height
}
+ fn max_width(&self) -> Option<usize> {
+ self.max_width
+ }
fn render(&mut self) -> Option<String> {
// FIXME:
// the below conditional is commented out because it causes several bugs:
@@ -272,6 +284,14 @@ impl Pane for TerminalPane {
self.grid.reset_viewport();
self.grid.should_render = true;
}
+
+ fn active_at(&self) -> Instant {
+ self.active_at
+ }
+
+ fn set_active_at(&mut self, time: Instant) {
+ self.active_at = time;
+ }
}
impl TerminalPane {
@@ -284,7 +304,9 @@ impl TerminalPane {
position_and_size,
position_and_size_override: None,
max_height: None,
+ max_width: None,
vte_parser: vte::Parser::new(),
+ active_at: Instant::now(),
}
}
pub fn get_x(&self) -> usize {
diff --git a/src/client/tab.rs b/src/client/tab.rs
index 656c60933..3346428ed 100644
--- a/src/client/tab.rs
+++ b/src/client/tab.rs
@@ -12,6 +12,7 @@ use crate::wasm_vm::PluginInstruction;
use crate::{boundaries::Boundaries, panes::PluginPane};
use serde::{Deserialize, Serialize};
use std::os::unix::io::RawFd;
+use std::time::Instant;
use std::{
cmp::Reverse,
collections::{BTreeMap, HashSet},
@@ -107,6 +108,7 @@ pub trait Pane {
fn set_selectable(&mut self, selectable: bool);
fn set_invisible_borders(&mut self, invisible_borders: bool);
fn set_max_height(&mut self, max_height: usize);
+ fn set_max_width(&mut self, max_width: usize);
fn render(&mut self) -> Option<String>;
fn pid(&self) -> PaneId;
fn reduce_height_down(&mut self, count: usize);
@@ -124,6 +126,8 @@ pub trait Pane {
fn scroll_up(&mut self, count: usize);
fn scroll_down(&mut self, count: usize);
fn clear_scroll(&mut self);
+ fn active_at(&self) -> Instant;
+ fn set_active_at(&mut self, instant: Instant);
fn right_boundary_x_coords(&self) -> usize {
self.x() + self.columns()
@@ -173,6 +177,7 @@ pub trait Pane {
y: self.y(),
columns: self.columns(),
rows: self.rows(),
+ ..Default::default()
}
}
fn can_increase_height_by(&self, increase_by: usize) -> bool {
@@ -267,6 +272,7 @@ impl Tab {
y: 0,
rows: self.full_screen_ws.rows,
columns: self.full_screen_ws.columns,
+ ..Default::default()
};
self.panes_to_hide.clear();
let positions_in_layout = layout.position_panes_in_space(&free_space);
@@ -277,6 +283,12 @@ impl Tab {
match positions_and_size.next() {
Some((_, position_and_size)) => {
terminal_pane.reset_size_and_position_override();
+ if let Some(max_rows) = position_and_size.max_rows {
+ terminal_pane.set_max_height(max_rows);
+ }
+ if let Some(max_columns) = position_and_size.max_columns {
+ terminal_pane.set_max_width(max_columns);
+ }
terminal_pane.change_pos_and_size(&position_and_size);
self.os_api.set_terminal_size_using_fd(
*pid,
@@ -301,11 +313,17 @@ impl Tab {
.send(PluginInstruction::Load(pid_tx, plugin.clone()))
.unwrap();
let pid = pid_rx.recv().unwrap();
- let new_plugin = PluginPane::new(
+ let mut new_plugin = PluginPane::new(
pid,
*position_and_size,
self.send_plugin_instructions.clone(),
);
+ if let Some(max_rows) = position_and_size.max_rows {
+ new_plugin.set_max_height(max_rows);
+ }
+ if let Some(max_columns) = position_and_size.max_columns {
+ new_plugin.set_max_width(max_columns);
+ }
self.panes.insert(PaneId::Plugin(pid), Box::new(new_plugin));
// Send an initial mode update to the newly loaded plugin only!
self.send_plugin_instructions
@@ -388,6 +406,7 @@ impl Tab {
columns: terminal_to_split.columns(),
x: terminal_to_split.x(),
y: terminal_to_split.y(),
+ ..Default::default()
};
if terminal_to_split.rows() * CURSOR_HEIGHT_WIDTH_RATIO > terminal_to_split.columns()
&& terminal_to_split.rows() > terminal_to_split.min_height() * 2
@@ -466,6 +485,7 @@ impl Tab {
y: active_pane.y(),
rows: active_pane.rows(),
columns: active_pane.columns(),
+ ..Default::default()
};
let (top_winsize, bottom_winsize) = split_horizontally_with_gap(&terminal_ws);
@@ -522,6 +542,7 @@ impl Tab {
y: active_pane.y(),
rows: active_pane.rows(),
columns: active_pane.columns(),
+ ..Default::default()
};
let (left_winsize, right_winsize) = split_vertically_with_gap(&terminal_ws);
@@ -689,6 +710,7 @@ impl Tab {
if !self.panes_to_hide.contains(&