Commit Graph

339 Commits

Author SHA1 Message Date
Kunal Mohan
0bd05cbcb4 Make session-name option in attach command
If only one session is running, attach to it.
Otherwise list the active sessions (if any)
2021-05-29 00:32:06 +05:30
Kunal Mohan
ee4e619b80 fix(tests): Add SLEEP to top_and_quit test 2021-05-28 20:37:33 +05:30
KOVACS Tamas
8ccf3d61a0 fix: use bounded queue between pty and screen
Pty reads a command's output and feeds it to Screen using an unbounded
queue.

However, if the command produces output faster than what `Screen` can
render, `Pty` still pushes it on the queue, causing it to grow
indefinitely, resulting in high memory usage and latency.

This patch fixes this by using a bounded queue between Pty and Screen,
so if Screen can't keep up with Pty, the queue will fill up, exerting
back pressure on Pty, making it read the command's output only as fast
as Screen renders it.

The unbounded queue is kept between Screen and producers other than Pty
to avoid a deadlock such as this scenario:
* pty thread filling up screen queue as soon as screen thread pops
  something from it
* wasm thread is processing a Render instruction, blocking on the screen
  queue
* screen thread is trying to render a plugin pane. It attempts to send a
  Render insturction to the blocked wasm thread running the plugin.

This patch also adds a generous amount of sleeps to the integration
tests as having backpressure changes the timing of how instructions are
processed.

Fixes #525.
2021-05-27 23:42:15 +02:00
kxt
0c0355dbc6
refactors for #525 (#534)
* refactor(fakes): clean up add_terminal_input

* refactor(fakes): append whole buf to output_buffer in FakeStdoutWriter::write

* refactor(fakes): append whole buf to output_buffer in FakeInputOutput::write_to_tty_stdin

* fix(fakes): allow partial reads in read_from_tty_stdout

This patch fixes two bugs in read_from_tty_stdout:
* if there was a partial read (ie. `bytes.read_position` is not 0 but
less than `bytes.content.len()`), subsequent calls to would fill `buf`
starting at index `bytes.read_position` instead of 0, leaving range
0..`bytes.read_position` untouched.
* if `buf` was smaller than `bytes.content.len()`, a panic would occur.

* refactor(channels): use crossbeam instead of mpsc

This patch replaces mpsc with crossbeam channels because crossbeam
supports selecting on multiple channels which will be necessary in a
subsequent patch.

* refactor(threadbus): allow multiple receivers in Bus

This patch changes Bus to use multiple receivers. Method `recv` returns
data from all of them. This will be used in a subsequent patch for
receiving from bounded and unbounded queues at the same time.

* refactor(channels): remove SenderType enum

This enum has only one variant, so the entire enum can be replaced with
the innards of said variant.

* refactor(channels): remove Send+Sync trait implementations

The implementation of these traits is not necessary, as
SenderWithContext is automatically Send and Sync for every T and
ErrorContext that's Send and Sync.
2021-05-27 16:28:28 +02:00
Kunal Mohan
cb3072066d hotfix(publish): Move install module and asset_map to main zellij package. publish should hopefully work now. 2021-05-27 15:30:14 +05:30
Aram Drevekenin
44d67de187
fix(compatibility): support wide characters (#535)
* fix(compatibility): support wide characters

* style(fmt): rustfmt

* style(fmt): make clippy happy
2021-05-26 18:05:43 +02:00
Kunal Mohan
2bca7e007a
Merge pull request #531 from zellij-org/detach-sessions
Feature: Detachable/Persistent sessions
2021-05-25 17:30:40 +05:30
Kunal Mohan
df6d6cb3a7 check for residual socket files and clean them 2021-05-25 16:26:31 +05:30
kxt
2168793dc7
fix(pty): use async io to avoid polling (#523)
This patch fixes #509 by using async read instead of polling a
non-blocking fd. This reduces CPU usage when the ptys are idle.
2021-05-24 15:00:49 +02:00
Kunal Mohan
cba7c07cd6 rename list_sessions file to sessions 2021-05-22 22:34:00 +05:30
Kunal Mohan
0621ba8f34 Allow user to specify session name 2021-05-22 22:21:26 +05:30
Kunal Mohan
1162d40ea0 check if session exists before attaching 2021-05-22 22:19:50 +05:30
Kunal Mohan
fa0a7e05c3 Add ability to attach to sessions 2021-05-22 22:19:50 +05:30
Kunal Mohan
61aa104576 Add ability to detach a session 2021-05-22 22:19:50 +05:30
Kunal Mohan
2487256664 Mark current session in the output of list-sessions 2021-05-22 22:19:50 +05:30
Kunal Mohan
d231d28d7c Implement the minimal list-sessions command 2021-05-22 22:19:50 +05:30
Kunal Mohan
d6fc7b04d1 add attach and list sessions subcommand to CliArgs 2021-05-22 22:19:50 +05:30
Kunal Mohan
b20ac47d68
Merge pull request #522 from zellij-org/re-export-dependencies
Re-export common dependencies from zellij-utils
2021-05-19 11:21:33 +05:30
Kunal Mohan
040d10df0f Re-export common dependencies from zellij-utils 2021-05-19 01:35:53 +05:30
kxt
68445af63f
refactor(IO): random fixes (#521)
* refactor(os_input_output): use Pid for child process

* fix(debug): change debug_to_file to write &[u8]

This patch changes debug_to_file to write entire slices in one call, to
avoid the overhead of opening and closing files for each byte written.

* refactor(ServerOsApi): remove unnecessary muts from methods

Co-authored-by: KOVACS Tamas <ktamas@fastmail.fm>
2021-05-18 17:39:36 +02:00
a-kenji
79e7c414b7 Fix clean flag
* The setup subcommand was exiting the programm no matter what
  even if the `clean` flag was provided.
  Now it returns to the
  main function on encountering the clean flag.
2021-05-18 11:12:57 +02:00
a-kenji
bcbde9fbb5 Merge branch 'main' of https://github.com/zellij-org/zellij into layout-path-506 2021-05-18 10:05:15 +02:00
a-kenji
dc067580f3 Fix Clippy Suggestions 2021-05-18 09:45:03 +02:00
Aram Drevekenin
a3f42b19a9
Osc implementation (#517)
* fix(compatibility): implement most osc methods

* style(fmt): rustfmt

* style(fmt): remove cargo warnings

* style(fmt): make clippy happy

* style(fmt): fix formatting after my clippy fixes broke it again ;P

* fix(grid): fix tests
2021-05-17 18:13:05 +02:00
Kunal Mohan
a872362328 fmt and clippy 2021-05-16 22:25:32 +05:30
Kunal Mohan
2038947a14 Big refactor: separate crates for client, server and utilities 2021-05-16 21:41:56 +05:30
Thomas Linford
28212f5430
handle error on termios initialization (#511) 2021-05-16 17:00:22 +01:00
a-kenji
197f318756 Merge branch 'main' of https://github.com/zellij-org/zellij into layout-path-506 2021-05-16 12:44:56 +02:00
a-kenji
abf0a2d0c6 Split Layout Flag
* Split Layout Flag into `layout` that searches in default layout
directories and `layout-path` that takes a path to a layout file

Close  #506.
2021-05-16 12:43:50 +02:00
Kunal Mohan
050d846b5e clean and exit on window close 2021-05-15 22:18:29 +05:30
Kunal Mohan
07ca0cbb11 Fix after rebase 2021-05-15 22:14:35 +05:30
Kunal Mohan
378dd90f8f Do not pass config_options while spawning server process 2021-05-15 22:14:35 +05:30
Kunal Mohan
41212dc0e8 Fix after rebase 2021-05-15 22:14:34 +05:30
Kunal Mohan
e203f96d78 fix testing 2021-05-15 22:14:34 +05:30
Kunal Mohan
c5675e965b Use ClientToServerMsg and ServerToClientMsg for IPC 2021-05-15 22:14:34 +05:30
Kunal Mohan
f2c43ac577 Fix memory overflow error and add panic hook for server 2021-05-15 22:14:34 +05:30
Kunal Mohan
0d792e26f2 Switch to multiprocess model: Not looking good 2021-05-15 22:14:34 +05:30
Matthias Beyer
fd42119219 Remove unused import
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2021-05-15 14:31:54 +02:00
a-kenji
fef150c8ff docs(changelog): Invert Asset Installation 2021-05-15 13:17:35 +02:00
a-kenji
ba206b1f29 Invert Assets Installation Feature
* changed `enable_automatic_asset_installation` to
`disable_automatic_asset_installation`

This ensures that people by default get the
asset installation and need to opt out at
compile time, rather than opt in.

* removed default features

Not needed anymore.
2021-05-15 12:45:24 +02:00
a-kenji
26cd36720b
Merge pull request #503 from a-kenji/check-setup
Add `check` flag to the setup subcommand
2021-05-14 11:57:57 +02:00
a-kenji
d667e5ed81 Add check flag to the setup subcommand
* The check option communicates default and config options to the user
  as well as optional compile time features

* Move generate-completion from a subcommand to a flag in the setup
  subcommand
2021-05-14 11:45:19 +02:00
Aram Drevekenin
8cdc7fbb69
fix(input): forward unknown keys to active terminal (#501)
* fix(input): forward unknown keys to active terminal

* docs(changelog): update change
2021-05-13 17:15:13 +02:00
Aram Drevekenin
b93e51cf88
fix(compatibility): implement device reports (#500)
* fix(compatibility): implement device reports

* docs(changelog): update change
2021-05-13 16:09:07 +02:00
a-kenji
4134c952f6 Merge branch 'main' of https://github.com/zellij-org/zellij into set-data-dir 2021-05-12 20:03:04 +02:00
a-kenji
ffd8f17a94 Add Complile Time System Directories
closes #380

* --features disable_automatic_asset_installation

disables automatic installation of the `data_dir`

* a set PREFIX env will use `$PREFIX/zellij` as its `data_dir`
2021-05-12 19:51:29 +02:00
a-kenji
db592cc840 Merge branch 'main' of https://github.com/zellij-org/zellij into fix-simplified-ui 2021-05-12 15:36:50 +02:00
a-kenji
776a2c5151 Fix Simplified Ui
Propagate the config now, in all the places, as opposed to
fallback to a default.
2021-05-12 15:27:28 +02:00
Aram Drevekenin
3f1ec7c295
fix(ui): handle pasted text properly (#494)
* fix(ui): handle pasted text properly

* style(fmt): rustfmt
2021-05-12 14:22:15 +02:00
Aram Drevekenin
9bb300e1c0
fix(compatibility): properly fill viewport with styles when clearing it (#493) 2021-05-12 11:27:53 +02:00