Commit Graph

114 Commits

Author SHA1 Message Date
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
Brooks Rady
1544de2665
fix(plugin): fix set_timeout() host function
fix: add missing to_plugin channel initialization (#664)
2021-08-27 03:29:04 +01:00
Tw
5403034624 fix: add missing to_plugin channel initialization (#664)
Signed-off-by: Tw <wei.tan@intel.com>
2021-08-27 09:42:46 +08:00
a-kenji
f802663067
Merge pull request #625 from a-kenji/tab-layout
Add `tabs` to `layouts`
2021-08-26 17:47:23 +02: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
Aram Drevekenin
6f2d7d0176
fix(compatibility): maintain original cursor shape (#659)
* fix(compatibility): maintain original cursor shape

* docs(changelog): document change
2021-08-25 13:43:18 +02:00
Aram Drevekenin
618c2c376b Merge branch 'tab-layout' of https://github.com/a-kenji/zellij into a-kenji-tab-layout 2021-08-24 10:58:36 +02:00
Aram Drevekenin
c8d10ee64d
fix(compatibility): only send bracketed paste to terminals requesting it (#658)
* fix(compatibility): only send bracketed paste to terminals requesting it

* docs(changelog): update change

* style(fmt): make rustfmt happy
2021-08-24 10:24:10 +02:00
a-kenji
b1906c893a
Merge pull request #622 from sagittarius-a/feature/go-to-last-tab
feat(tab): add keybind to go to last tab visited
2021-08-23 23:18:43 +02:00
Aram Drevekenin
d969bbfea7
fix(compatibility): docker-compose progress bar (#656)
* fix(compatibility): docker-compose progress bar

* docs(changelog): progress bar fix

* style(fmt): make rustfmt happy
2021-08-23 20:55:31 +02:00
Thomas Linford
94f20cfd53
Indicate to the user when text is copied to the clipboard (#642)
* Indicate to the user when text is copied to the clipboard

- broadcast CopyToClipboard event to plugins after selection has been
  copied, and InputReceived event after any input has been received.
- add new ClientToServerMsg InputReceived
- subscribe status-bar plugin to new events, modify second line after
  CopyToClipboard, reset it on InputReceived.

* remove unnecessary InputReceived ClientToServerMsg

- use existing Actions instead to know that user input has been received

* make status bar text copied hint bold green

* cleanup

* cleanup

* cleanup
2021-08-23 15:51:33 +02:00
Tw
d1b5a69918
eliminate unused imports warnings during compile (#654)
Signed-off-by: Tw <tw19881113@gmail.com>
2021-08-23 15:41:26 +02:00
a-kenji
88b4063879 Add template section in layout file
It works as follows:
```
---
template:
  direction: Horizontal
  parts:
    - direction: Vertical
      split_size:
        Fixed: 1
      run:
        plugin: tab-bar
    - direction: Vertical
      body: true
    - direction: Vertical
      split_size:
        Fixed: 2
      run:
        plugin: status-bar
tabs:
  - direction: Vertical
```

The tabs are created in the body section of the template.
2021-08-21 23:27:23 +02:00
Aram Drevekenin
a4e6e89a76
fix(compatibility): do not remove frame when clearing viewport (#652) 2021-08-20 16:04:12 +02:00
Aram Drevekenin
2100865063
fix(performance): undo degredation introduced in 646 (#651)
* fix(performance): undo degredation introduced in 646

* style(fmt): make rustfmt happy

* style(fmt): make clippy happy
2021-08-19 19:02:05 +02:00
Aram Drevekenin
e889891604
Fix scrolling (#650)
* fix(grid): scroll up on empty line

* fix(grid): line wrapping while scrolling

* style(grid): fix names

* docs(changelog): document fix
2021-08-19 13:28:08 +02:00
Tw
e477f3b5cd
fix(child-process): unexpected pane closing issue with nushell (#648)
* fix unexpected pane closing issue with nushell

nushell doesn't create a new process group when spawnning a process,
so all processes including the ones spwanned by us are in the same
foreground group. So if kernel will send signal to every member of this
group.

This patch fixes this issue by creating a new foreground process group
when spawnning a new terminal pane.

Fix #615

Signed-off-by: Tw <tw19881113@gmail.com>

* add comment about unsafe

Co-authored-by: Aram Drevekenin <aram@poor.dev>
2021-08-16 14:19:05 +02:00
Aram Drevekenin
da3f20c816
fix(compatibility): support changing index colors with osc (#646)
* fix(compatibility): support changing index colors with osc

* style(fmt): make rustfmt happy

* style(fmt): make clippy happy

* style(fmt): make rustfmt happy

* docs(changelog): document fix
2021-08-13 17:23:39 +02:00
Aram Drevekenin
a37d3e5889
feat(ui): pane frames (new pane UI) (#643)
* work

* resize working

* move focus working

* close pane working

* selection and fullscreen working

* pane title line

* titles and conditional scroll title

* whole tab resize working

* plugin frames working

* plugin splitting working

* truncate pane frame titles

* cleanup

* panes always draw their own borders - also fix gap

* toggle pane frames

* move toggle to screen and fix some bugs

* fix plugin frame toggle

* fix terminal window resize

* fix scrolling and fullscreen bugs

* unit tests passing

* e2e tests passing and new test for new frames added

* refactor: TerminalPane and PluginPane

* refactor: Tab

* refactor: moar Tab

* refactor: Boundaries

* only render and calculate boundaries when there are no pane frames

* refactor: Layout

* fix(grid): properly resize when coming back from alternative viewport

* style: remove commented code

* style: fmt

* style: fmt

* style: fmt + clippy

* docs(changelog): update change
2021-08-12 14:50:00 +02:00
Sagittarius-a
24ef96b965 fix cargo clippy lint 2021-08-03 22:16:40 +02:00
Sagittarius-a
4f482f3b63 store tab history in a stack-like data structure 2021-08-03 21:15:06 +02:00
Sagittarius-a
aff9973616 fix: fix clippy warning 2021-08-03 21:12:20 +02:00
Sagittarius-a
081c55458d fix: rename action to ToggleTab 2021-08-03 21:12:20 +02:00
Sagittarius-a
404faf0498 fix: fix toggle to previous tab when deleting tabs 2021-08-03 21:12:20 +02:00
Sagittarius-a
734636637d fix: rename variable as stated in pull request 2021-08-03 21:12:19 +02:00
Sagittarius-a
5799ea4e5d feat(tab): add keybind to go to last tab visited
Fixes #398.

Tab key is used as default for the `GoToLastTab` action.
2021-08-03 21:11:50 +02:00
a-kenji
fc7bc3cc8b Merge branch 'main' of https://github.com/zellij-org/zellij into tab-layout 2021-08-01 20:25:33 +02:00
a-kenji
542999e07f Fix plugin attribute update on inactive tab
Fixes #621

* `ScreenInstruction::SetSelectable` etc.
  were not updating correctly, if a NewTab was spawned, before
  the plugin was finished setting the attributes.

  Now the `tab_index` is used to send the instructions to
  their respective tabs and plugins.
2021-08-01 00:38:27 +02:00
Sagittarius-a
7da214fcca feat(scroll): Restore scroll position on SIGINT
Fixes #606

Currently scroll down to bottom then exits scroll mode.
2021-07-24 21:28:19 +02:00
a-kenji
f323880fb7 !fixup cargo fmt 2021-07-23 17:25:05 +02:00
a-kenji
485339c584 Merge branch 'main' of https://github.com/zellij-org/zellij into tab-layout 2021-07-23 17:24:45 +02:00
a-kenji
5ede25dc37 Add tabs to layouts
fixes #603, fixes #349

* The layout has now a unique `tabs` section,
  that can be used, like the `parts` section,
  everything that is not inside the tabs section
  is assumed to be present on every single tab
  that is opened.

  This is a BREAKING CHANGE for people that use
  custom `layouts` already, since the `tabs` section
  is not optional - for clarity and intentionality reasons.

  The functionality to specify multiple tabs is already there,
  but is still gated behind a panic, until #621 is fixed.
  So for now one tab can be specified to load on startup.

* The `NewTab` action can optionally be bound to open
  a layout that is assumed to be in the new `tabs` section

  This is a BREAKING CHANGE for people that have the
  `NewTab` action already bound in the config file:

```
- action: [NewTab, ]
  key: [F: 5,]
```
must now be specified as:
```
- action: [NewTab: ,]
  key: [F: 5,]
```
  Optionally a layout that should be opened on the new tab can be
  specified:
```
- action: [NewTab: {
  direction: Vertical,
  parts: [ {direction: Horizontal, split_size: {Percent: 50}}, {direction: Horizontal, run: {command: {cmd: "htop"}}},],
  key: [F: 6,]
```
or:
```
- action: [NewTab: {direction: Vertical, run: {command: {cmd: "htop"} }},]
  key: [F: 7,]
```
or
```
- action: [NewTab: {
  direction: Vertical,
  parts: [ {direction: Vertical, split_size: {Percent: 25},run: {plugin: "strider" }}, {direction: Horizontal}],}, MoveFocus: Left,]
  key: [F: 8,]

```
2021-07-23 17:13:35 +02:00
a-kenji
c42b0f867e fixup! merge
* Missed something while merging
2021-07-22 16:30:06 +02:00
a-kenji
c9ccfb2919
Merge branch 'main' into display-session-name 2021-07-22 16:12:35 +02:00
qepasa
290704a056
Cleanup Cargo.toml 2021-07-21 07:20:07 +02:00
qepasa
f0bc297743
Merge branch 'main' into unified-logging 2021-07-20 22:19:03 -07:00
Paweł Palenica
0cabc5f112 Read from LoggingPipe returns error 2021-07-20 22:17:26 -07:00
a-kenji
697ba09c71 Add noop for mouse actions on plugins
* Comments the `unimplemented!` macro out, in favor of a noop
  The macro is still there for easy greppability.
  It is still unimplemented, but zellij doesn't need to panic once
  a plugin does get a scroll event.
2021-07-20 15:08:38 +02:00
Brooks J Rady
7de19dc6df fix(style): bury the dead (code) 2021-07-19 20:49:23 +01:00
Brooks J Rady
6a90542ae3 chore(release): bump development version 2021-07-19 20:35:50 +01:00
Paweł Palenica
27634423d9 Minor fixes 2021-07-17 23:50:24 -07:00
Paweł Palenica
3326f521ef Fix clippy 2021-07-13 23:46:36 -07:00
Paweł Palenica
9044dbcec3 small touchups 2021-07-13 23:31:16 -07:00
Paweł Palenica
b15cfba6e1 Apply code review suggestions. Rename decorating_pipe to logging_pipe. Add plugin_id to plugin log. Move logger init from file to in-code initialization and change logging file to zellij directory. Change format of timestamp. 2021-07-13 23:29:04 -07:00
Lovecraftian Horror
eb6e49c260 Move ModeInfo::new() back to get_mode_info() 2021-07-09 15:21:47 -04:00
a-kenji
0ab00e2c6c
Merge pull request #600 from a-kenji/layout-command
Add commands to layout
2021-07-09 16:58:29 +02:00
a-kenji
261e691f9f Add commands to layout
Add the ability to run commands on loading a layout:
```
  - direction: Horizontal
    split_size:
      Percent: 50
    run:
      command: {cmd: htop}
```
or respectively:
```
  - direction: Horizontal
    split_size:
      Percent: 50
    run:
      command: {cmd: htop, args: ["-C"]}
```

In order to specify the difference of commands and
plugins now the plugins need to be under the `run` section:
```
  - direction: Vertical
    split_size:
      Fixed: 2
    run:
      plugin: status-bar
```
This also means that this is a breaking change for people
that already have a custom layout.

Example layouts:
```
---
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}
```
and:
```
---
direction: Horizontal
parts:
  - direction: Vertical
    split_size:
      Fixed: 1
    run:
      plugin: tab-bar
  - direction: Vertical
    parts:
    - direction: Vertical
      parts:
      - direction: Vertical
        split_size:
          Percent: 50
        run:
          command: {cmd: htop}
      - direction: Vertical
        split_size:
          Percent: 50
        run:
          command: {cmd: htop, args: ["-C"]}
  - direction: Vertical
    split_size:
      Fixed: 5
  - direction: Vertical
    split_size:
      Fixed: 2
    run:
      plugin: status-bar
```

closes #551, closes #284
2021-07-09 16:43:44 +02:00
qepasa
45d2992a3f
Merge branch 'main' into unified-logging 2021-07-08 22:55:50 -07:00
Paweł Palenica
3b78d7d0a4 More cleanup, remove serde from zellij-server 2021-07-08 22:01:03 -07:00
Paweł Palenica
8d864e1fbf remove one more crate from zellij-server 2021-07-08 21:53:22 -07:00