summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrooks J Rady <b.j.rady@gmail.com>2021-04-13 16:17:40 +0100
committerBrooks J Rady <b.j.rady@gmail.com>2021-04-13 16:17:40 +0100
commit0e73227fe2418c3a4945f493afbc64ab66dcb763 (patch)
treee46256e314b2a70a5dc8f7281519695bf2a5ffad
parentd2a7d100acdbcf85664fb10a04805325abd10a6c (diff)
parent313ac9f41474222133b344c1c0d8827b4dc2fa50 (diff)
merge(main): update branch with changes from main
-rw-r--r--Cargo.lock14
-rw-r--r--Cargo.toml2
-rw-r--r--GOVERNANCE.md3
-rw-r--r--README.md38
-rw-r--r--assets/completions/_zellij81
-rw-r--r--assets/completions/zellij.bash56
-rw-r--r--assets/completions/zellij.fish7
-rw-r--r--assets/plugins/status-bar.wasmbin413293 -> 416418 bytes
-rw-r--r--assets/plugins/strider.wasmbin517363 -> 517533 bytes
-rw-r--r--assets/plugins/tab-bar.wasmbin407199 -> 407327 bytes
-rw-r--r--default-tiles/status-bar/src/first_line.rs4
-rw-r--r--default-tiles/status-bar/src/main.rs4
-rw-r--r--default-tiles/status-bar/src/second_line.rs131
-rw-r--r--default-tiles/strider/src/main.rs2
-rw-r--r--example/config.yaml26
-rw-r--r--src/cli.rs17
-rw-r--r--src/client/boundaries.rs4
-rw-r--r--src/client/mod.rs1
-rw-r--r--src/client/pane_resizer.rs508
-rw-r--r--src/client/panes/plugin_pane.rs16
-rw-r--r--src/client/panes/terminal_character.rs64
-rw-r--r--src/client/panes/terminal_pane.rs85
-rw-r--r--src/client/tab.rs294
-rw-r--r--src/common/command_is_executing.rs4
-rw-r--r--src/common/errors.rs16
-rw-r--r--src/common/input/actions.rs9
-rw-r--r--src/common/input/config.rs158
-rw-r--r--src/common/input/handler.rs92
-rw-r--r--src/common/input/keybinds.rs635
-rw-r--r--src/common/input/mod.rs3
-rw-r--r--src/common/input/unit/keybinds_test.rs135
-rw-r--r--src/common/mod.rs58
-rw-r--r--src/common/os_input_output.rs40
-rw-r--r--src/common/pty_bus.rs92
-rw-r--r--src/common/screen.rs18
-rw-r--r--src/common/utils/shared.rs13
-rw-r--r--src/main.rs1
-rw-r--r--src/tests/fakes.rs38
-rw-r--r--src/tests/integration/close_pane.rs2
-rw-r--r--src/tests/integration/mod.rs1
-rw-r--r--src/tests/integration/snapshots/zellij__tests__integration__terminal_window_resize__window_height_increase_with_one_pane.snap25
-rw-r--r--src/tests/integration/snapshots/zellij__tests__integration__terminal_window_resize__window_width_and_height_decrease_with_one_pane.snap25
-rw-r--r--src/tests/integration/snapshots/zellij__tests__integration__terminal_window_resize__window_width_decrease_with_one_pane.snap25
-rw-r--r--src/tests/integration/snapshots/zellij__tests__integration__terminal_window_resize__window_width_increase_with_one_pane.snap25
-rw-r--r--src/tests/integration/terminal_window_resize.rs127
-rw-r--r--src/tests/possible_tty_inputs.rs9
-rw-r--r--src/tests/tty_inputs.rs46
-rw-r--r--src/tests/utils.rs1
-rw-r--r--zellij-tile/src/data.rs7
49 files changed, 2414 insertions, 548 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 792a355e3..471408e23 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -132,7 +132,7 @@ dependencies = [
"event-listener",
"futures-lite",
"once_cell",
- "signal-hook 0.3.8",
+ "signal-hook",
"winapi",
]
@@ -1408,16 +1408,6 @@ dependencies = [
[[package]]
name = "signal-hook"
-version = "0.1.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7e31d442c16f047a671b5a71e2161d6e68814012b7f5379d269ebd915fac2729"
-dependencies = [
- "libc",
- "signal-hook-registry",
-]
-
-[[package]]
-name = "signal-hook"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef33d6d0cd06e0840fba9985aab098c147e67e05cee14d412d3345ed14ff30ac"
@@ -2221,7 +2211,7 @@ dependencies = [
"serde",
"serde_json",
"serde_yaml",
- "signal-hook 0.1.17",
+ "signal-hook",
"strip-ansi-escapes",
"structopt",
"strum",
diff --git a/Cargo.toml b/Cargo.toml
index 06fb0c25c..a581dda67 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,7 +21,7 @@ nom = "6.0.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_yaml = "0.8"
-signal-hook = "0.1.10"
+signal-hook = "0.3"
strip-ansi-escapes = "0.1.0"
structopt = "0.3"
termion = "1.5.0"
diff --git a/GOVERNANCE.md b/GOVERNANCE.md
index 2928cd601..b405d29db 100644
--- a/GOVERNANCE.md
+++ b/GOVERNANCE.md
@@ -26,3 +26,6 @@ Once the organization reaches 10 members, a reasonable and achievable process mu
* Denis Maximov <denis_maxim0v@protonmail.com>
* Kunal Mohan <kunalmohan99@gmail.com>
* Henil Dedania <dedaniahenil@gmail.com>
+* Roee Shapira <ro33.sha@gmail.com>
+* Alex Kenji Berthold <aks.kenji@protonmail.com>
+* Kyle Sutherland-Cash <kyle.sutherlandcash@gmail.com>
diff --git a/README.md b/README.md
index 004ac9eab..8b05e1f58 100644
--- a/README.md
+++ b/README.md
@@ -40,6 +40,44 @@ The status bar on the bottom should guide you through the possible keyboard shor
For more build commands, take a look at [`Contributing.md`](CONTRIBUTING.md).
+# Configuration
+It is possible to configure keyboard shortcuts and their actions in a yaml file.
+An example file can be found under `example/config.yaml`.
+
+Zellij will look for a file `/zellij/config.yaml` in the default configuration location of your os.
+
+To pass a config file directly to zellij run it either with:
+`cargo run -- config [FILE]` or `zellij config [FILE]`.
+
+The structure is as follows:
+```
+keybinds:
+ normal:
+ - action: []
+ key: []
+```
+`normal` is one of the `modes` zellij can be in.
+It is possible to bind a sequence of actions to numerous keys at the same time.
+Here a reference to the [Key](https://docs.rs/termion/1.5.6/termion/event/enum.Key.html) format that is used.
+
+For example:
+```
+keybinds:
+ normal:
+ - action: [ NewTab, GoToTab: 1,]
+ key: [ Char: 'c',]
+```
+Will create a new tab and then switch to tab number 1 on pressing the
+`c` key.
+Whereas:
+```
+keybinds:
+ normal:
+ - action: [ NewTab,]
+ key: [ Char: 'c', Char: 'd',]
+```
+Will create a new tab on pressing either the `c` or the `d` key.
+
# What is the current status of the project?
Zellij is in the last stages of being VT compatible. As much as modern terminals are.
diff --git a/assets/completions/_zellij b/assets/completions/_zellij
index 64bd538cd..fc1cd00f2 100644
--- a/assets/completions/_zellij
+++ b/assets/completions/_zellij
@@ -30,16 +30,93 @@ _zellij() {
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
+":: :_zellij_commands" \
+"*::: :->zellij" \
&& ret=0
-
+ case $state in
+ (zellij)
+ words=($line[1] "${words[@]}")
+ (( CURRENT += 1 ))
+ curcontext="${curcontext%:*:*}:zellij-command-$line[1]:"
+ case $line[1] in
+ (c)
+_arguments "${_arguments_options[@]}" \
+'--clean[Disables loading of configuration file at default location]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+'::path:_files' \
+&& ret=0
+;;
+(c)
+_arguments "${_arguments_options[@]}" \
+'--clean[Disables loading of configuration file at default location]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+'::path:_files' \
+&& ret=0
+;;
+(config)
+_arguments "${_arguments_options[@]}" \
+'--clean[Disables loading of configuration file at default location]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+'::path:_files' \
+&& ret=0
+;;
+(help)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+ esac
+ ;;
+esac
}
(( $+functions[_zellij_commands] )) ||
_zellij_commands() {
local commands; commands=(
-
+ "config:Path to the configuration yaml file" \
+"help:Prints this message or the help of the given subcommand(s)" \
)
_describe -t commands 'zellij commands' commands "$@"
}
+(( $+functions[_c_commands] )) ||
+_c_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'c commands' commands "$@"
+}
+(( $+functions[_zellij__c_commands] )) ||
+_zellij__c_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'zellij c commands' commands "$@"
+}
+(( $+functions[_zellij__config_commands] )) ||
+_zellij__config_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'zellij config commands' commands "$@"
+}
+(( $+functions[_zellij__help_commands] )) ||
+_zellij__help_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'zellij help commands' commands "$@"
+}
_zellij "$@" \ No newline at end of file
diff --git a/assets/completions/zellij.bash b/assets/completions/zellij.bash
index a921e7c99..10c18d532 100644
--- a/assets/completions/zellij.bash
+++ b/assets/completions/zellij.bash
@@ -13,6 +13,15 @@ _zellij() {
cmd="zellij"
;;
+ c)
+ cmd+="__c"
+ ;;
+ config)
+ cmd+="__config"
+ ;;
+ help)
+ cmd+="__help"
+ ;;
*)
;;
esac
@@ -20,7 +29,7 @@ _zellij() {
case "${cmd}" in
zellij)
- opts=" -m -d -h -V -s -o -l --move-focus --debug --help --version --split --open-file --max-panes --layout "
+ opts=" -m -d -h -V -s -o -l --move-focus --debug --help --version --split --open-file --max-panes --layout config help c c"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -63,6 +72,51 @@ _zellij() {
return 0
;;
+ zellij__c)
+ opts=" -h -V --clean --help --version <path> "
+ if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ fi
+ case "${prev}" in
+
+ *)
+ COMPREPLY=()
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ ;;
+ zellij__config)
+ opts=" -h -V --clean --help --version <path> "
+ if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ fi
+ case "${prev}" in
+
+ *)
+ COMPREPLY=()
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ ;;
+ zellij__help)
+ opts=" -h -V --help --version "
+ if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ fi
+ case "${prev}" in
+
+ *)
+ COMPREPLY=()
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ ;;
esac
}
diff --git a/assets/completions/zellij.fish b/assets/completions/zellij.fish
index e902823fc..36bab1924 100644
--- a/assets/completions/zellij.fish
+++ b/assets/completions/zellij.fish
@@ -6,3 +6,10 @@ complete -c zellij -n "__fish_use_subcommand" -s m -l move-focus -d 'Send "move
complete -c zellij -n "__fish_use_subcommand" -s d -l debug
complete -c zellij -n "__fish_use_subcommand" -s h -l help -d 'Prints help information'
complete -c zellij -n "__fish_use_subcommand" -s V -l version -d 'Prints version information'
+complete -c zellij -n "__fish_use_subcommand" -f -a "config" -d 'Path to the configuration yaml file'
+complete -c zellij -n "__fish_use_subcommand" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
+complete -c zellij -n "__fish_seen_subcommand_from config" -l clean -d 'Disables loading of configuration file at default location'
+complete -c zellij -n "__fish_seen_subcommand_from config" -s h -l help -d 'Prints help information'
+complete -c zellij -n "__fish_seen_subcommand_from config" -s V -l version -d 'Prints version information'
+complete -c zellij -n "__fish_seen_subcommand_from help" -s h -l help -d 'Prints help information'
+complete -c zellij -n "__fish_seen_subcommand_from help" -s V -l version -d 'Prints version information'
diff --git a/assets/plugins/status-bar.wasm b/assets/plugins/status-bar.wasm
index 7650d577c..5dba9a50f 100644
--- a/assets/plugins/status-bar.wasm
+++ b/assets/plugins/status-bar.wasm
Binary files differ
diff --git a/assets/plugins/strider.wasm b/assets/plugins/strider.wasm
index 085e11f1a..e9024abba 100644
--- a/assets/plugins/strider.wasm
+++ b/assets/plugins/strider.wasm
Binary files differ
diff --git a/assets/plugins/tab-bar.wasm b/assets/plugins/tab-bar.wasm
index 141e47ba4..cc2f9eefb 100644
--- a/assets/plugins/tab-bar.wasm
+++ b/assets/plugins/tab-bar.wasm
Binary files differ
diff --git a/default-tiles/status-bar/src/first_line.rs b/default-tiles/status-bar/src/first_line.rs
index 0e4ec53b4..ea48cb1b8 100644
--- a/default-tiles/status-bar/src/first_line.rs
+++ b/default-tiles/status-bar/src/first_line.rs
@@ -99,7 +99,7 @@ fn unselected_mode_shortcut(letter: char, text: &str) -> LinePart {
suffix_separator,
])
.to_string(),
- len: text.chars().count() + 6, // 2 for the arrows, 3 for the char separators, 1 for the character
+ len: text.chars().count() + 7, // 2 for the arrows, 3 for the char separators, 1 for the character, 1 for the text padding
}
}
@@ -129,7 +129,7 @@ fn selected_mode_shortcut(letter: char, text: &str) -> LinePart {
suffix_separator,
])
.to_string(),
- len: text.chars().count() + 6, // 2 for the arrows, 3 for the char separators, 1 for the character
+ len: text.chars().count() + 7, // 2 for the arrows, 3 for the char separators, 1 for the character, 1 for the text padding
}
}
diff --git a/default-tiles/status-bar/src/main.rs b/default-tiles/status-bar/src/main.rs
index 8daa158ed..ee4d17635 100644
--- a/default-tiles/status-bar/src/main.rs
+++ b/default-tiles/status-bar/src/main.rs
@@ -63,8 +63,8 @@ impl ZellijTile for State {
let second_line = keybinds(&self.mode_info, cols);
// [48;5;238m is gray background, [0K is so that it fills the rest of the line
- // [48;5;16m is black 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
println!("{}\u{1b}[48;5;238m\u{1b}[0K", first_line);
- println!("{}\u{1b}[48;5;16m\u{1b}[0K", second_line);
+ println!("\u{1b}[m{}\u{1b}[0K", second_line);
}
}
diff --git a/default-tiles/status-bar/src/second_line.rs b/default-tiles/status-bar/src/second_line.rs
index ebcb93dd4..48a82c6c3 100644
--- a/default-tiles/status-bar/src/second_line.rs
+++ b/default-tiles/status-bar/src/