* utils/errors: Fix function order in `to_anyhow`
impl for `SendError`. Previously we attached the context to `anyhow!`,
which is wrong (because it doesn't create an `Err` type itself) and
leads to strange behavior where the error seemingly is immediately
panicked upon.
Instead, Wrap `anyhow!` into an `Err()` and then attach the context to
that. This achieves the intended goal and doesn't lead to premature
termination.
* server/terminal_bytes: Ignore error in `listen`
which occurs when quitting zellij with the `Ctrl+q` keybinding. At the
end of the `listen` function we break out of a loop and send a final
`Render` instruction to the Screen. However, when quitting zellij as
mentioned above, the Screen thread is likely dead already and hence we
cannot send it any Instructions. This causes an error in the async tasks
of the panes that handle reading the PTY input.
If we leave the error unhandled, we will have error messages in the log
whenever we quit zellij, even though the application exited normally.
Hence, we now send the final `Render` instruction but do not care
whether it is sent successfully or not.
This is a "workaround" for the fact that we cannot tell whether the
application is quitting or not.
* server/terminal_bytes: Add FIXME note
* changelog: Add PR #1918
don't log errors from async pane threads when quitting zellij
* cargo: Don't strip release binary
because the lack of debug symbols makes the panic backtrace completely
useless. It will show a long list of unknown locations then.
Except for a minor space saving of 3-4 MB, debug symbols don't have any
negative side-effects for our application that we're aware of.
* changelog: Add PR #1916
Don't strip debug symbols from release binaries so the backtraces
contain the function names involved.
* cargo: Explicitly keep debug symbols
and add a comment explaining why.
* Fix bat syntax colors when using mosh
Original reason for this line according to Aram:
I set this variable as part of the Sixel support to get notcurses to
work properly. I tried communicating with the notcurses maintainers
about a workaround for this, but to no avail.
* Changelog
* Improve changelog message
* Remove empty function
* server/wasm_vm: Replace `log::error!`
with better error logging by means of `non_fatal`. This preserves the
original error and allows adding context information on top. Also makes
error formatting more uniform across the application.
* server/tab: Replace `log::error!`
with better error logging by means of `non_fatal`. This preserves the
original error and allows adding context information on top. Also makes
error formatting more uniform across the application.
* server/route: Replace `log::error!`
and propagate the error to the caller instead.
* server/pty: Replace `log::error!`
with better error logging by means of `non_fatal`. This preserves the
original error and allows adding context information on top. Also makes
error formatting more uniform across the application.
Also add per-instruction error context to make it clear what we tried to
accomplish when an error occured.
* server/panes/tiled_panes: Merge dependencies
and sort them into a better order.
* server/panes/tiled_panes: Replace `log::error!`
with better error logging by means of `non_fatal`. This preserves the
original error and allows adding context information on top. Also makes
error formatting more uniform across the application.
* server/os_input_output: Merge depndencies
and sort them into a better order.
* server/logging_pipe: Replace `log::error!`
with better error logging by means of `non_fatal`. This preserves the
original error and allows adding context information on top. Also makes
error formatting more uniform across the application.
* server/os_io: Remove uses of `log::error`
* changelog: Add PR #1881
* server/os_io: Gracefully handle failing resize
for terminals IDs that don't exist, instead of propagating the error to
the user.
* server/lib: Remove leftover log message
* server/pty: Log error cause
rather than providing a hard-coded error reason which is plain wrong in
this context.
* server/screen: Remove calls to `log::error!`
and change `get_active_tab(_mut)?` to return a `Result` instead of an
`Option`. This already makes many places in the code obsolete where
previously "failed to get active tab..." was logged manually.
Rather than logging, use the `anyhow::Error`s we have, along with all
their context information, and log these instead.
* server/os_io: Redefine `ServerOsApi` result types
to use `anyhow::Result` instead. This mostly makes the need of custom
`SpawnTerminalError` obsolete (tbd in subsequent commits) and unifies
error handling across the application.
* utils/errors: Implement new `ZellijError` type
to replace any previously defined, isolated custom error types
throughout the application. Currently implements all error variants
found in `SpawnTerminalError`.
In the long term, this will allow zellij to fall back to a single error
type for all application-specific errors, instead of having different
error types per module.
* server/unit/screen: Impl new `ServerOsApi`
with updated `Result`-types.
* server/tab/unit: Impl new `ServerOsApi`
with updated `Result`-types.
* server/os_io: Impl new `ServerOsApi`
with updated `Result`-types.
* utils/ipc: Return `anyhow::Error` in `send`
rather than a `&'static str`, which isn't compatible with
`anyhow::Context`.
* server/tab: Handle `Result` in `resize_pty!`
which is returned due to the changed return types in `ServerOsApi`.
* server/tab: Handle new `Result`s
originating in the change to the `ServerOsApi` trait definition.
* server/screen: Handle new `Result`s
originating in the change to the `ServerOsApi` trait definition.
* server/panes/tiled: Handle new `Result`s
originating in the change to the `ServerOsApi` trait definition.
* server/panes/floating: Handle new `Result`s
originating in the change to the `ServerOsApi` trait definition.
* server/lib: Unwrap on new `Result`s
originating in the change to the `ServerOsApi` trait definition. The
functions here don't return a `Result` yet, this is better left to a
follow-up PR.
* server: Remove `SpawnTerminalError`
and make use of the new `ZellijError` instead. Make use of `anyhow`s
downcast capabilities to restore the underlying original errors where
necessary, as was done previously. This gives us the flexibility to
attach context information to all errors while still allowing us to
handle specific errors in greater detail.
* server/pty: Fix vars broken in rebase
* server/os_io: Remove last `SpawnTerminalError`
* changelog: Add PR #1895
* server/tab: Don't panic in `Pane::render`
and do not crash the application on failure to receive a render update
from plugins any longer. Instead, will print a simple string with a hint
to check the application logs, where a more thorough error indication
can be found.
* utils/errors: re-export `anyhow::Error`
to create ad-hoc errors with custom error types, without having to wrap
them into a `context()` before to turn the into anyhow errors.
* plugins: Check plugin version on startup
and terminate execution with a descriptive error message in case the
plugin version is incompatible with the version of zellij being run.
* server/wasm_vm: Add plugin path in version error
so the user knows which plugin to look at in case they're using custom
plugins.
* server/wasm_vm: Check plugin version for equality
Previously we would accept cases where the plugin version was newer than
the zellij version, which doesn't make a lot of sense.
* server/wasm_vm: Prettier error handling
in call to `wasmer::Function::call` in case a plugin version mismatch
can occur.
* tile: Install custom panic handler
that will print the panic message to a plugins stdout and then call a
panic handler on the host that turns it into a real application-level
panic.
* tile: Catch errors in event deserialization
and turn them into proper panics. These errors are symptomatic of an
uncaught plugin version mismatch, for example when developing from main
and compiling zellij/the plugins from source. Normal users should never
get to see this error.
* utils/errors: Improve output in `to_stdout`
for anyhow errors. The default anyhow error formatting of `{:?}` is
already very good, and we just made it worse by trying to invent our own
formatting.
* tile: Reword plugin mismatch error message
* zellij: Apply rustfmt
* changelog: Add PR #1838
Improve error handling on plugin version mismatch.
* server/wasm_vm: Rephrase error in passive voice
* zellij/commands: Prevent recursive sessions
with session names specified in layout files. A "recursive session" is
created when, while running inside some zellij session, a user attempts
to spawn zellij and make it attach to that same session.
When attaching via CLI (`zellij attach`) we explicitly check for this
condition and error out when needed.
However, besides `zellij attach` it is also possible to declare the
session to attach to in layout files like so:
```yaml
session:
name: "foo"
```
This takes a different codepath when starting zellij, and hence bypases
the checks we already have in place to avoid recursive sessions. Hence,
we implement the check in the other codepath, too, and prevent recursive
sessions from happening for good.
Fixes: #1735
* changelog: fix recursive zellij sessions
* server/tab: Check suppressed panes
when writing to a pane by ID. Previously only the tiled and floating
panes would be searched for a pane of a given ID.
Fixes: #1734
* server/tab/unit: Test writing to suppressed panes
* docs: fix server panics when writing to suppressed panes
* update vte to v0.11.0, and turn off it's default-features
* vte's default includes no_std, and in that case the osc params buffer is capped at 1024 bytes
* add changelog entry
* screen: Don't crash when first tab doesn't exist
while trying to attach a new client. Instead, check whether the first
tab does exist and if not, take the first tab index from the tabs
present in the session. If no tabs exist, panic with a better error
message.
* changelog: Add PR #1648
* add test
* fix(tabs): send actual default mode info to new tab
Co-authored-by: Thomas Linford <linford.t@gmail.com>
Co-authored-by: Aram Drevekenin <aram@poor.dev>
* Exit client on empty ipc receive
This resolves a hang when the server goes away unnoticed (e.g. when it
is killed). In some cases, this delayed system shutdown because the
client did not react to systemd's SIGTERM.
* Add newline after error report to tidy up shell prompt
* Update changelog
* feat: Attach sessions by unique name prefix (#1169)
This makes attaching to sessions more convenient since only the first character(s) of the
session name must be typed.
If this prefix matches multiple sessions and is therefore ambiguous, zellij will complain
and show all sessions names starting with these characters.
If any session name matches the given string exact, it is attached immediately, therefore
it is always possible to attach to every session, even if the set of session names is not
prefix-free.
* Add feature to changelog
* Try to fix flaky e2e test
* Remove gray from theme config and improve colors for dark themes
* improve theme usage
* Add new themes and minor fixes
* improve tokyo-night theme according to new changes
* Fix formatting
* change default black colour
* docs(CHANGELOG): #1274 improve themes