Commit Graph

142 Commits

Author SHA1 Message Date
Aram Drevekenin
0fec10b08b chore(release): v0.20.1 2021-11-10 17:54:39 +01:00
a-kenji
abbe3b237a
add(feature): toggle boolean options with cli flag (#855)
add the ability to toggle boolean options with a cli flag:

example:
    if the pane frames are turned off in the config file,
    then passing in the `--no-pane-frames` flag will toggle the
    pane frames on
2021-11-10 13:31:37 +01:00
Ken Matsui
6d60d83e58
fix(envs): Unify operation of Zellij environment variables (#842) 2021-11-10 09:02:17 +01:00
Jae-Heon Ji
4838f0b52c
feat: add initial session name to layout template (#789)
* feat: add session configuration to layout template

WIP: prototyping for issue #611

* test(layout): add session name

* feat(layout): add cond flow to check session name

* feat(layout): update session

* feat: add function to attach a session

* fix(layout): update feedback

* attach option only works when layout template exists.

* feat(layout): add conditional for session-layout

* update default attach value
2021-11-08 19:43:51 +01:00
Aram Drevekenin
b232326dc2 chore(version): bump development version 2021-11-08 15:42:46 +01:00
oromate
8f06f119fd
feat(scrolling): half-page scroll actions (#813)
* Half-page scroll actions #794

* fix(performance): do not hang when resizing large line wraps (#814)

* fix(performance): do not hang when resizing large line wraps

* style(fmt): make rustfmt happy

* style(clippy): make clippy happy

* docs(changelog): scroll fix

* fix(compatibility): home and end key fix (#815)

* fix(compatibility): handle home/end keys properly from terminfo

* style(fmt): make rustfmt happy

* style(fmt): remove unused import

* docs(changelog): home end key fix

* docs(changelog): fix link

* fix(typo): Correct typo from `occured` to `occurred` (#821)

* docs(changelog): fix a typo

* fix(docs): fix wrong arguments for `cargo make run` given in CONTRIBUTING.md (#819)

* docs(changelog): update `cargo-make` for `v0.35.3`

* fix(warning): Fix an unused import warning of std::fs on macos (#820)

* docs(changelog): fix unused import on darwin

* add: `WriteChars` action (#825)

* Behaves like the `Write` action, but one can specify
  strings themselves instead of their bytecodes.

  Usage:

  WriteChars: "cargo make test",

* docs(changelog): Add `WriteChars` action

* fix(docs): Fix a typo and some grammatical errors in bug_report.md (#826)

* docs(changelog): fix typo bug_report template

* add: `rust-version` (msrv) field to `Cargo.toml` (#828)

* specifies the minimum version the package can be compiled with,
  may be ignored with `--ignore-rust-version` option

  ref: https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-rust-version-field

* docs(changelog): add `rust-version` to `Cargo.toml`

* fix(unix): forkpty => openpty (#830)

* fix(unix): forkpty => openpty

* style(fmt): make rustfmt happy

* docs(changelog): forkpty => openpty

* Fix: move `colors_transform` to `colorsys` (#832)

* `colors_transform` is deprecated and superceded by `colorsys`

  ref: https://crates.io/crates/colors-transform

* docs(changelog): `colors_transform` to `colorsys`

* feat(ui): add right-click support to plugins

* chore(docs): update changelog

* chore(warnings): remove unused imports (#833)

* rename var sroll_rows and review snapshots

* style(fmt): make rustfmt happy

Co-authored-by: Aram Drevekenin <aram@poor.dev>
Co-authored-by: Ken Matsui <26405363+ken-matsui@users.noreply.github.com>
Co-authored-by: a-kenji <aks.kenji@protonmail.com>
Co-authored-by: Tw <tw19881113@gmail.com>
Co-authored-by: Brooks Rady <b.j.rady@gmail.com>
2021-11-08 15:05:47 +01:00
a-kenji
808458ec7b Merge branch 'support-first-option-in-attach-subcommand-to-attach-the-first-session' of https://github.com/ken-matsui/zellij into ken-matsui-support-first-option-in-attach-subcommand-to-attach-the-first-session 2021-11-05 21:57:01 +01:00
Ken Matsui
4acb2458d2
feat(attach): Support --index option to choose specific session by provided number in active sessions ordered by creation date, resolve #823
feat(attach): Support `--first` option for `attach` sub-command to let zellij choose the alphabetically first session; resolve #823

fix(attach-first): Fix `--first` option to choose the first created session in the existent sessions

feat(attach): Support `--index` option to choose the session indexed by provided number like -t option of tmux

feat(attach): Support listing active sessions with index when a provided number is not found in the active sessions

feat(attach): Support listing active sessions with index when a provided number is not found in the active sessions

feat: Add anyhow to uniformly treat error types and avoid panics
2021-11-06 05:15:09 +09:00
Ken Matsui
f9cb23af65
fix(errors): Introduce thiserror to make error types simpler (#836) 2021-11-05 20:45:57 +01:00
Ken Matsui
8ef1d10df9
fix(errors): Add colored crate to replace primitive color formatting (#837) 2021-11-05 20:39:14 +01:00
Henil Dedania
4ac9344085
feature(resize): Non directional resize (#520)
* feature(resize): Non directional resize

* Implement special cases

* fix resizing for panes that have `+` cross section

* fix resizing for panes that have `T` cross section

* fix panics

* Add Nondirection resize keys to plugin

* fix formatting

* fix: clippy warnings

* fix the last edge case

* implemented some of the suggested changes

* Remove helper function and elevate comment to top of function

* Use `=` to keep it consistent with Normal mode mapping as its easier to use

* Remove extra reference borrowing

* fix an edge case

* add test for nondirectional resize increase/decrease

* fix(controls): add + to resize

* refactor(resize): simplify methods

* fix(resize): properly resize opposite corner pane

Co-authored-by: Aram Drevekenin <aram@poor.dev>
2021-11-05 09:29:45 +01:00
a-kenji
f62ccd2a5c
add: try_from for ConfigFromYaml -> Config (#835) 2021-11-03 19:58:40 +01:00
Tw
9ea3dc0dbe
feat(ui): add right-click support to plugins 2021-11-02 18:49:10 +00:00
a-kenji
070de7a4d1
Fix: move colors_transform to colorsys (#832)
* `colors_transform` is deprecated and superceded by `colorsys`

  ref: https://crates.io/crates/colors-transform
2021-11-02 11:46:06 +01:00
a-kenji
d2b81293df
add: WriteChars action (#825)
* Behaves like the `Write` action, but one can specify
  strings themselves instead of their bytecodes.

  Usage:

  WriteChars: "cargo make test",
2021-11-01 08:52:55 +01:00
Ken Matsui
f902f3ed1d
fix(typo): Correct typo from occured to occurred (#821) 2021-10-31 20:39:57 +01:00
Aram Drevekenin
6d47d360e1
fix(compatibility): home and end key fix (#815)
* fix(compatibility): handle home/end keys properly from terminfo

* style(fmt): make rustfmt happy

* style(fmt): remove unused import
2021-10-29 15:28:36 +02:00
Kunal Mohan
164eb6a5b7
Feature: Rotate Pane locations (#802)
fix #165
2021-10-26 09:54:05 +05:30
a-kenji
a2a0299ea5
add(setup): change the links to be hyperlinks (#768)
- change the links in the setup command to be viable hyperlinks
  according to:
  https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
2021-10-25 20:08:30 +02:00
Brooks J Rady
e0d7212c2a chore(rust): move to 2021 edition
Get with the times, kiddo (and all hail disjoint captures)
2021-10-22 02:21:16 +01:00
Aram Drevekenin
3b2d8f692c chore(version): bump development version 2021-10-20 15:00:32 +02:00
Kunal Mohan
d90e3d4cac
Feature: Move panes directionally (#762)
* Feature: Move panes directionally

* change keybinds

* Fix active pane after move

* Add a separate 'Move' mode

* Add tests

* Add more tests

* Send resize message to pty

* wrap set_terminal_size_using_fd() in macro

* change keybind for Move mode

* cargo fmt

* fix test

* move render functions from tab.rs to screen.rs

* undo wrong keybinds
2021-10-19 20:20:28 +05:30
Thomas Linford
76a96b538b
logging: remove unused log functions, change log file const to new file (#779) 2021-10-18 10:52:58 +02:00
Thomas Linford
45af3e4279
Preserve current umask (#777)
* preserve umask when starting server

* make sure log files are created with explicit permissions
2021-10-12 18:11:16 +05:30
Jae-Heon Ji
0ca5c18729
feat(cli): add kill-session command (#745)
* feat: add kill-session command

* style: apply formatting rules

* feat: add new instruction for kill-session

* feat: update feedback of kill-session

* separation of command `kill-session` and `kill-all-sessions` function.
* Add information to various situations
* Add a question (yes or no) when executing the `kill-all-sessions`
  command.

* chore: adjust clippy warning

* fix warning wording

* make rustfmt happy

Co-authored-by: Aram Drevekenin <aram@poor.dev>
2021-10-11 16:57:56 +02:00
Aram Drevekenin
f2401d0b25
refactor(clients): support multiple clients in tab/screen rendering infra (#770) 2021-10-07 15:22:20 +02:00
a-kenji
46a9ead668
add(config): add information to the config file (#766)
- add information to configuration directly to the config file
2021-10-05 20:08:00 +02:00
a-kenji
0ca28486a5
fix(setup): switch setup order (#765)
- commands that don't use the config file now wont throw an error on
  malformed config files
2021-10-05 13:43:05 +02:00
a-kenji
d667dc2a87
feat(config): Allow empty config files (#720)
Fix #714

Allow empty `config` and `layout` files

- Currently empty files are parsed as yaml documents, since they
  are empty they are invalid yaml files and a deseralization error would
  follow.

  Now we ignore the incorrect yaml on an empty document and treat it as
  an empty yaml document.

  Eg:
  ```
  ```
  and
  ```
  ---
  ```

  Are now treated equally.

Alternative: Keep treating the files as `yaml` documents.
2021-10-01 21:49:47 +02:00
Aram Drevekenin
79fa3594e3 chore(version): bump development version 2021-09-30 11:39:04 +02:00
Aram Drevekenin
3df362d046 chore(version): bump development version 2021-09-30 11:13:33 +02:00
Aram Drevekenin
d7e4ec65db
hotfix(stdin): poll for mouse hold in the stdin thread (#752)
* hotfix(stdin): poll for mouse hold in the stdin thread

* add missing dont panic

* style(fmt): make rustfmt happy
2021-09-30 10:25:48 +02:00
Aram Drevekenin
8d72013d4d chore(version): bump development version 2021-09-29 15:23:22 +02:00
Aram Drevekenin
5c54bf18c2
feat(sessions): mirrored sessions (#740)
* feat(sessions): mirrored sessions

* fix(tests): input units

* style(fmt): make rustfmt happy

* fix(tests): make mirrored sessions e2e test more robust

* refactor(sessions): remove force attach

* style(fmt): rustfmtify

* docs(changelog): update change

* fix(e2e): retry on all errors
2021-09-27 11:29:13 +02:00
spacemaison
c9372212f6
feat(plugin): add manifest to allow for plugin configuration (#660)
* feat(plugins-manifest): Add a plugins manifest to allow for more configuration of plugins

* refactor(plugins-manifest): Better storage of plugin metadata in wasm_vm

* fix(plugins-manifest): Inherit permissions from run configuration

* refactor(plugins-manifest): Rename things for more clarity

- The Plugins/Plugin structs had "Config" appended to them to clarify
  that they're metadata about plugins, and not the plugins themselves.

- The PluginType::OncePerPane variant was renamed to be just
  PluginType::Pane, and the documentation clarified to explain what it
  is.

- The "service" nomenclature was completely removed in favor of
  "headless".

* refactor(plugins-manifest): Move security warning into start plugin

* refactor(plugins-manifest): Remove hack in favor of standard method

* refactor(plugins-manifest): Change display of plugin location

The only time that a plugin location is displayed in Zellij is the
border of the pane. Having `zellij:strider` display instead of just
`strider` was a little annoying, so we're stripping out the scheme
information from a locations display.

* refactor(plugins-manifest): Add a little more documentation

* fix(plugins-manifest): Formatting

Co-authored-by: Jesse Tuchsen <not@disclosing>
2021-09-22 18:13:21 +01:00
a-kenji
bbe2583904
feat(layout): specify only tab name in tabs section (#722)
Allow specifying only the tab name in the `tabs` section

- For example this is now possible:
```
tabs:
  - name: first
    parts:
      - direction: Vertical
      - direction: Vertical
  - name: second
  - name: third
```
  For that the tab section defaults the direction to
  `direction::Horizontal`

- Adds an error upon specifying a tab name inside the `parts` section
  of the tab-layout
2021-09-21 16:39:37 +02:00
GPery
b761a28702
Implement attach --create subcommand flag to create session if one does not exist (#731)
* Implement attach --create

* fixup! Implement attach --create

* fixup! Implement attach --create

* fixup! Implement attach --create

* fixup! Implement attach --create
2021-09-19 18:17:52 +05:30
Aram Drevekenin
0f3590adb5 chore(version): bump development version 2021-09-15 16:41:07 +02:00
Aram Drevekenin
b1f17a624c fix(keys): bring back ctrl-n to get from scroll mode to resize mode 2021-09-15 14:03:55 +02:00
a-kenji
9a5a315aee
Add options subcommand to attach (#718)
fixes #688

- the `options` subcommand of `attach` functions the same,
  as the `options` subcommand of creating the normal session,
  but not every option will have an effect on reattaching,
  for example the `default_mode` setting would make no sense
  to switch.

  In the future it would make sense to be able to hot swap some
  of the options on reattach, but we are not able to do that yet,
  for example the `default_shell` one.

  Eg:

  ```
  zellij attach <session-name> options --theme <theme>
  ```
2021-09-13 16:23:22 +02:00
a-kenji
2771b247ac
Improve handling of empty valid yaml files (#716)
Improves the way empty valid `yaml` files are handled.
When deserializing a `config` or `layout` file, that is
an empty valid `yaml` file, eg:

```
---
```

We now assume the default configuration is desired.
2021-09-13 12:24:19 +02:00
Tw
da2a9b5c18
feat(screen): support specifying tab's name in layout (#715)
Signed-off-by: Tw <tw19881113@gmail.com>
2021-09-13 11:56:33 +02:00
Paulo Coelho
aae9c9c807
Calculate width with unicode-width in tab-bar and utils (#709)
* fix(tab-bar): calculate string width using unicode-width

* fix(utils): calculate ansi_len using unicode-width
2021-09-12 20:29:07 +02:00
spacemaison
4f94f95c90
feat(cwd-pane): Keeping the cwd when opening new panes (#691)
* feat(cwd-pane): Add a new trait to get the cwd of a given pid

Co-authored-by: Quentin Rasmont <qrasmont@gmail.com>

* feat(cwd-pane): Allow for setting the cwd when spawning a new terminal

Co-authored-by: Quentin Rasmont <qrasmont@gmail.com>

* feat(cwd-pane): Add an active_pane field to the Pty struct

Co-authored-by: Quentin Rasmont <qrasmont@gmail.com>

* feat(cwd-pane): Update Pty with Tab's active pane id

Co-authored-by: Quentin Rasmont <qrasmont@gmail.com>

* feat(cwd-pane): Refactor spawn_terminal to use cwd by default

Co-authored-by: Quentin Rasmont <qrasmont@gmail.com>

* feat(cwd-pane): Fix tests and lints

Co-authored-by: Quentin Rasmont <qrasmont@gmail.com>

* feat(cwd-pane): Fix formatting

* feat(cwd-pane): Refactor child pid fetching to handle errors better

Instead of panicking when transfering the process id of the forked child
command we just return an empty process id.

* feat(cwd-pane): Add non Linux/MacOS targets for the get_cwd method.

This will allow Zellij to compile on non Linux/MacOS targets without
having an inherited cwd.

* feat(cwd-pane): Refactor spawn_terminal method to use ChildId struct.

The spawn_terminal methods been refactored to use the ChildId struct in
order to clarify what the Pid's returned by it are. The documentation
for the ChildId struct was improved as well.

* feat(cwd-pane): Fix tests/lints

Co-authored-by: Jesse Tuchsen <not@disclosing>
Co-authored-by: Quentin Rasmont <qrasmont@gmail.com>
2021-09-10 17:35:06 +02:00
Tw
19b3f8366f
feat(plugin): add exec_cmd helper for executing command in host
Signed-off-by: Tw <wei.tan@intel.com>
Signed-off-by: Tw <tw19881113@gmail.com>
2021-09-09 11:45:03 +01:00
Paulo Coelho
6d0c5a56f5
style(clippy): various fixes (#704)
* test: fix clippy unused_io_amount

* chore(clippy): various clippy fixes

needless_borrow, let_and_return, vec_init_then_push, unit_arg,
useless_format, field_reassign_with_default, redundant_clone
2021-09-09 10:24:03 +02:00
Aram Drevekenin
7c075ac7e3 chore(version): bump development version 2021-08-31 11:36:09 +02:00
Brooks Rady
a51f500c17
fix(ui): change resize binding to Ctrl-n
* fix(ui): change resize binding to Ctrl-n

* Fix tests?

* Actually update the keybind in tests

* Cowardly refuse to fix the E2E testing issue
2021-08-30 18:02:14 +01:00
Brooks Rady
76a5bc8a05
feat(ui): overhauled resize and layout systems
* refactor(panes): move to parametric pane sizes

* Fixed the simpler errors by casting to usize

* The least I can do is pass the formatting check...

* Move to stable toolchain

* Well, it compiles?

* And now it doesn't! ;)

* Baseline functionality with the new Dimension type

* Working POC for percent-based resizing

* REVERT THIS COMMIT – DELETES TESTS

* Perfected the discrete resize algorithm

* Fixed fixed-size panes

* Basic bidirectional resize

* feat(resize): finalised parametric resize algorithm

* Reduce the logging level a bit

* Fixed nested layouts using percents

* Bug squishing for implicit sizing

* Here is a funky (read: rubbish) rounding approach

* And now it's gone again!

* Improve discretisation algorithm to fix rounding errors

* Fix the last layout bug (maybe?)

* Mixed explicit and implied percents work now

* Let's pretend that didn't happen...

* Make things a bit less crashy

* Crash slightly more for now (to find bugs)

* Manaually splitting of panes works now

* Start moving to percent-based resizes

* Everything but fullscreen seems to be working

* Fix compilatation errors

* Culled a massive amount of border code

* Why not pause to please rustfmt?

* Turns out I was still missing a few tests...

* Bringing back even more tests!

* Fix tests and pane boarders

* Fix the resize system without gaps

* Fix content offset

* Fixed a bug with pane closing

* Add a hack to fix setting of the viewport

* Fix toggling between shared borders and frames

* fix(tests): make e2e properly use PaneGeom

* style(fmt): make rustfmt happy

* Revert unintentional rounding of borders

* Purge some old borderless stuff

* Fix busted tab-bar shrinking

* Update E2E tests

* Finish implementing fullscreen!

* Don't crash anymore?

* Fix (almost) all tests

* Fix a lack of tab-stops

* All tests passing

* I really can't be bothered to debug a CI issue

* Tie up loose ends

* Knock out some lingering FIXMEs

* Continue to clean things up

* Change some naming and address FIXMEs

* Cull more code + FIXMEs

* Refactor of the resize system + polish

* Only draw frames when absolutely necessary

* Fix the tab-bar crash

* Fix rendering of boarders on reattach

* Fix resizing at small pane sizes

* Deduplicate code in the layout system

* Update tab-bar WASM

* Fixed the pinching of panes during resize

* Unexpose needlessly public type

* Add back a lost test

* Re-add tab tests and get them to compile

* All tabs need layouts

* Start fixing tests + bug in main

* Stabilize the resize algorithm rounding

* All tests from main are now passing

* Cull more dead code
2021-08-28 17:46:24 +01:00
a-kenji
cd0b0119a0 Split tab-layout into template & tabs section
* adjust example layouts and move them from `./example` to
  `./example/layouts`

* simplify the deserialization of the layout

* layouts are now constructed as follows:

```
---
template:
  direction: Horizontal
  parts:
    - direction: Vertical
      borderless: true
      split_size:
        Fixed: 1
      run:
        plugin: tab-bar
    - direction: Vertical
      body: true # <== The body section specifies the position of the
      # inserted tab
    - direction: Vertical
      borderless: true
      split_size:
        Fixed: 2
      run:
        plugin: status-bar
tabs:
  - direction: Vertical
  - direction: Vertical
```
2021-08-26 15:06:59 +02:00