275 Commits

Author SHA1 Message Date
Mitchell Hashimoto
d64fa6d9db termio: shell integration uses arena 2024-05-07 19:57:26 -07:00
Jon Parise
73b3560e62 shell-integration: automatic bash integration
This change adds automatic bash shell detection and integration.

Unlike our other shell integrations, bash doesn't provide a built-in
mechanism for injecting our ghostty.bash script into the new shell
environment.

Instead, we start bash in POSIX mode and use the ENV environment
variable to load our integration script, and the rest of the bash
startup sequence becomes the responsibility of our script to emulate
(along with disabling POSIX mode).
2024-05-05 13:59:52 -07:00
Mitchell Hashimoto
3f9e3c39a4 terminal: track dirty state of palette and reverse colors 2024-05-01 20:31:49 -07:00
Jon Parise
54f6abf1cf termio: pass full command to shell integration
This will allow the shell integration code to inspect the full command
string rather than just the first component (shell binary).
2024-04-21 09:53:27 -07:00
Mitchell Hashimoto
be0d52a4f2 config: rename "wcswidth" to "legacy" for "grapheme-width-method"
We don't actually use libc wcswidth to determine width and even if we
did some terminals use wcwidth (which behaves differently), some use
the Python wcswidth library (which behaves differently), etc. The
reality is there is no real consistency on "legacy" behavior so by
naming it "legacy" we show that we're doing our best but also gives us
wiggle room to change our behavior in the future.

Functionally nothing changes with this commit.
2024-04-19 09:56:22 -07:00
Mitchell Hashimoto
8dbedeb76c fix breaking changes with latest zig 2024-04-17 20:50:50 -07:00
Qwerasd
4c9e238c3f fix(termio/exec): avoid overflow in setCursorRow/ColRelative
Using a saturating addition here just to avoid overflow, since setCursorPos handles proper clamping to the screen size so we don't need to duplicate that logic.
2024-03-29 13:15:24 -04:00
Mitchell Hashimoto
1c57bbabda termio/exec: clear screen should erase rows and shift up 2024-03-22 20:28:12 -07:00
Mitchell Hashimoto
26321dc1c9 termio/exec: only clear above cursor if cursor is not on y=0 2024-03-22 20:28:12 -07:00
Mitchell Hashimoto
0a6735d05d terminal: jump to prompt 2024-03-22 20:28:00 -07:00
Mitchell Hashimoto
49e8acbcd2 core: configurable scrollback limit 2024-03-22 20:27:59 -07:00
Mitchell Hashimoto
25d84d697a termio/exec: get compiler errors gone 2024-03-22 20:27:44 -07:00
Mitchell Hashimoto
9b4ab0e209 zig build test with renamed terminal package 2024-03-22 20:27:44 -07:00
Mitchell Hashimoto
b7bf59d772 update zig 2024-03-22 11:15:26 -07:00
Krzysztof Wolicki
af842591c5 Update usage of std.os.O 2024-02-12 20:11:02 +01:00
Mitchell Hashimoto
62ce93dcff terminal: use SIMD w/ Neon to find ESC in VT streams 2024-02-05 21:22:25 -08:00
Mitchell Hashimoto
7aeb7c1a58 terminal: rename theme to color_scheme for dsr 2024-02-02 13:20:59 -08:00
Mitchell Hashimoto
ae8f5f3ceb core: colorSchemeCallback on surface, can report 2024-02-02 12:51:20 -08:00
Mitchell Hashimoto
3c26828a3f terminal: distinguish between DSRs with "?" and not 2024-02-02 12:42:22 -08:00
Mitchell Hashimoto
eb653907d6 config: grapheme-width-method sets mode 2027
Fixes #1403

This changes the behavior of `grapheme-width-method = unicode` to change
the default state of mode 2027 to true. Prior to this, setting this
config would force grapheme clustering regardless of mode 2027. Now,
this only sets the default and running TUI programs can disable it if
they want.
2024-02-02 12:13:13 -08:00
Mitchell Hashimoto
c2e0cff1d2 termio/exec: only add ghostty path if it isn't already in path 2024-01-31 18:57:42 -08:00
Mitchell Hashimoto
577b12430c termio/exec: always put ghostty bin dir in GHOSTTY_BIN_DIR env var 2024-01-31 18:50:50 -08:00
Allan Calix
e11d5940ba Automatically inject ghostty cli to end of $PATH 2024-01-31 16:24:15 -08:00
Mitchell Hashimoto
c871140419 terminal: handle SCOSC/SCORC
Fixes #1401

SCOSC is ambiguous with regards to DECSLRM. This commit copies the logic
of xterm: if left/right mode is enabled, then CSI S is always DECSLRM.
But if left/right mode is disabled then CSI S empty always uses SCOSC.

SCORC always works.
2024-01-28 08:04:14 -08:00
Mitchell Hashimoto
33bc424d7e config: introduce wait-after-command 2024-01-17 08:40:21 -08:00
Mitchell Hashimoto
adb7958f61 remove tracy usage from all files 2024-01-13 15:06:08 -08:00
widberg
de71e992ec Use WINDIR instead of hardcoding C:\Windows 2024-01-11 11:57:40 -08:00
Mitchell Hashimoto
60b1b0a8de termio/exec: assign arena last so we capture allocations 2024-01-10 09:26:10 -08:00
Mitchell Hashimoto
4b6c2f86a7 termio/exec: remove a bunch of state that is duplicated on StreamHandler
A lot of the state that we put on Exec is just there to copy to
StreamHandler, but we already have it in DerivedConfig. I think this
whole copy copy copy is just legacy cruft since termio.Exec is one of
the older parts of the source code.

This rearchitects the Exec struct to act more like Surface and Renderer
where it stores its derived config. This lets us avoid a few extra
allocations and removes a LOT of struct member noise from termio.Exec.

For pointer lifetimes, the memory allocated is now owned by
DerivedConfig. When changeConfig is called, its the only time BOTH are
still alive, so we can safely swap pointers and deinit without having to
duplicate across threads. This is the same as renderer/surface.
2024-01-10 09:15:55 -08:00
Jeffrey C. Ollie
3c2dfd4a84 change name of config entry and variables, add lock for safety during config update 2024-01-09 10:07:32 -06:00
Jeffrey C. Ollie
342b5e9d06 implement enquiry 2024-01-07 23:50:58 -06:00
Mitchell Hashimoto
48f316ebd2 termio: support XDG data dirs greater than 4k for fish shell integration
Fixes #1228
2024-01-05 14:27:12 -08:00
Mitchell Hashimoto
38c5258d6e termio/exec: small change 2024-01-04 19:48:08 -08:00
widberg
2e79b5c63d Use cmd.exe instead of sh on Windows 2024-01-04 21:24:24 -05:00
Mitchell Hashimoto
797da2f737 termio/exec: avoid potential deadlock with surface message
Fixes #1198

This adds a fix similar to what we discovered with termio messages: we
attempt to send a surface message but if the queue is full we unlock the
terminal state and try again waiting forever.

In all cases, its safe to unlock the mutex while sending the message, no
scenario we send a surface message requires this lock to be held.
2024-01-02 15:34:20 -08:00
Mitchell Hashimoto
0eee66f21b termio/exec: stylistic change on abnormal exit 2023-12-30 21:47:34 -08:00
Mitchell Hashimoto
134327c1a3 termio/exec: reorder member since we like alloc on top 2023-12-30 21:46:27 -08:00
Mitchell Hashimoto
aef93a5420 config: make abnormal runtime threshold a u32 2023-12-30 21:45:16 -08:00
Jeffrey C. Ollie
4ef8d099a7 Make the abnormal runtime threshold configurable. 2023-12-30 22:52:47 -06:00
Jeffrey C. Ollie
792284fb69 Add exit code and runtime to abnormal exit error message. 2023-12-30 22:24:25 -06:00
Mitchell Hashimoto
730343c600 termio/exec: pass code and runtime to error but don't show it yet 2023-12-30 19:37:38 -08:00
Mitchell Hashimoto
53dffc8e18 termio/exec: style the exec failure error better 2023-12-30 19:34:45 -08:00
Mitchell Hashimoto
f3aaa884c6 termio/exec: use message to writer thread so we can output failed cmd 2023-12-30 17:51:34 -08:00
Mitchell Hashimoto
aaded1f311 termio/exec: use arraylist to build up message for error 2023-12-30 15:52:26 -08:00
Mitchell Hashimoto
fc963064c6 termio/exec: abnormal exit can use exit code on linux 2023-12-30 15:43:50 -08:00
Mitchell Hashimoto
3fae05e2dc termio/exec: detect abnormally short runtime and show an error message 2023-12-30 15:35:35 -08:00
Mitchell Hashimoto
2ed75d47b5 termio/exec: detect exec failure and show an error message 2023-12-30 15:07:23 -08:00
Mitchell Hashimoto
85c386f45d termio: remove old warning log statement used for debugging 2023-12-29 21:25:07 -08:00
Mitchell Hashimoto
a69ec2127e termio/exec: use bash instead of zsh for shell launching 2023-12-29 15:41:11 -08:00
Matthew Winter
992888d4bd Ensure the cwd is not changed, whilst remaining a logon shell 2023-12-30 05:40:07 +11:00