The only way to reach the terminal inside a BufferedTerminal was
terminal(&mut self), so code holding a shared reference could not ask
it for anything, including its size. dimensions(), reached through
Deref<Target = Surface>, is the size of the cached surface and only
changes when check_for_resize is called.
terminal_ref(&self) is the shared-reference counterpart to terminal(),
so callers can use the now &self Terminal::get_screen_size to get the
real size.
No implementation needs mutable access to report the size. The Unix
version issues TIOCGWINSZ on the fd, the Windows version calls
GetConsoleScreenBufferInfo on the handle, and the mux and ssh
implementations copy a cached value.
The &mut requirement came from the UnixTty::get_size and
ConsoleOutputHandle::get_buffer_info helpers, which are both read-only
queries, so they take &self too.
This is a breaking change for implementors of Terminal. Callers are
unaffected, since &mut T coerces to &T.
`wezterm-gui`'s `build.rs` uses `anyhow` on windows and macos. On other
platforms, such as Linux, it produces a warning about the unused build
dependency.
`wezterm-gui` already needs it as a dependency, so removing it as a
build dependency doesn't really help anything.
Thus, rather than encode the targets that use it, add a
```rust
use anyhow as _;
```
to suppress the warning by making it "used" everywhere.
Clearing ime_text before interpretKeyEvents makes hasMarkedText()
answer NO while a composition is active. AppKit consults it when
applying text that an input method commits during the key event,
and discards commit text arriving together with a function key.
Korean IMEs finalize the composing syllable when an arrow key is
pressed, so that syllable was lost instead of being committed.
ime_text is maintained by setMarkedText/insertText/unmarkText, so
removing the pre-clear leaves the state correct.
refs: #6907
The compiled terminfo is reduced to a single artifact that CI checks
against its text source, failing on any drift.
Tests load the embedded entry and cover an XTGETTCAP response.
sccache 0.17 and later expand cargo's rustc argfile and then spawn
rustc with the full command line, which exceeds the Windows limit when
building `mux` ("The filename or extension is too long", os error 206).
v0.16.0 passes the argfile through to rustc instead.
See https://github.com/mozilla/sccache/issues/2787
- Move the derivation into `nix/package.nix` as a callPackage
function, deriving its version from the flake revision.
- Derive the per-system list from nixpkgs instead of `flake-utils`.
- Reuse the package's build inputs in the devShell via `inputsFrom`,
keeping only the dlopened runtime libraries explicit.
Reuse live content-addressed blobs instead of replacing them.
This avoids ERROR_ACCESS_DENIED when a reader still has the existing
file open and keeps the reference count balanced.
---------
Co-authored-by: Tomauskasz <tomas.bitvinskas@gmail.com>
Other terminals do this when enabling focus tracking, and some programs
behave much better when they get it.
For instance, vim enables focus tracking when resumed after being
backgrounded, and then processes things on the focus event, such as
noticing if a file was changed.
Without this patch: saving a file in vim, Ctrl-Z, `cargo fmt --all`,
and `fg`; vim doesn't immediately notice the file was changed to reload it. (and then, you might edit the file further, and get a conflict later
when vim notices)
With this patch: vim notices the changes right away, making for a
smoother experience.
Track alternate screen state for panes connected to a mux domain. This
enables mouse wheel events to translate correctly to cursor movement
for alt screen applications.
closes: https://github.com/wezterm/wezterm/issues/4922
The OSC parser splits the whole sequence on `;`, so a hyperlink whose
URI contains a `;` (for example `data:text/plain;base64,...` or a URL
with `;` in its path or query) arrived with more than three parameters
and was rejected.
The link was then dropped and the OSC was tracked as Unspecified.
`;` is a valid URI character, so treat everything after the params as
the URI.
MuxNotification::AssignClipboard was picking any window for clipboard
ownership. With 2+ windows open, OSC 52 from a pane in a newer window
set the clipboard owner as being an unrelated window.
Resolve the pane to its mux window and use the window that owns it,
only using the first/any window if the pane has no associated gui window
(e.g. a non-current workspace).
update_selection_owner asserted ownership using self.copy_and_paste.time
That field only advances on key and button events delivered to that
particular window, so a window the user has not touched recently carries
a timestamp that predates the selection's lastTimeChanged.
The X server ignores SetSelectionOwner in that case, so the assertion was
previously dropped.
Use X's CURRENT_TIME constant instead which is always accepted.
This mirrors what focus() already does for the same underlying reason.
refs: #5917
Add mouse and focus accessors to TerminalState so downstream programs
using wezterm-term crate can introspect the state and act in it.
---------
Co-authored-by: Mark Shamis <mark.shamis@gmail.com>
Co-authored-by: Benoit de Chezelles <benoit.dechezelles@gmail.com>
Avoid creating a `&[u8]` reference over Windows _shared_ memory.
Instead, copy the mapped data directly with `ptr::copy_nonoverlapping`,
preventing aliasing violations.
refs: #8051