forked from ghostty-org/ghostty
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update ghostty #2
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Partially addresses ghostty-org#3381
Fixes ghostty-org#5022 The CSI SGR sequence (CSI m) is unique in that its the only CSI sequence that allows colons as delimiters between some parameters, and the colon vs. semicolon changes the semantics of the parameters. Previously, Ghostty assumed that an SGR sequence was either all colons or all semicolons, and would change its behavior based on the first delimiter it encountered. This is incorrect. It is perfectly valid for an SGR sequence to have both colons and semicolons as delimiters. For example, Kakoune sends the following: ;4:3;38;2;175;175;215;58:2::190:80:70m This is equivalent to: - unset (0) - curly underline (4:3) - foreground color (38;2;175;175;215) - underline color (58:2::190:80:70) This commit changes the behavior of Ghostty to track the delimiter per parameter, rather than per sequence. It also updates the SGR parser to be more robust and handle the various edge cases that can occur. Tests were added for the new cases.
Previously, the logic navigated to the second-to-last tab instead of the last tab due to an off-by-one error. This updates the implementation so that the index calculation to accurately target the last tab. In the `gotoLastTab` method there was a decrement in the number of max number of tabs and another increment in the `goToTab` method to get the actual tab index.
Fixes ghostty-org#3381 Note that ghostty-org#4936 will need to be merged or you'll need to rely on Gnome's default keybinding for unmaximizing a window (super+down).
Otherwise pages may have the wrong width if they were resized down with a fast path that just chanes the size without adjusting capacity at all.
This commit is quite large because it's fairly interconnected and can't be split up in a logical way. The main part of this commit is that alpha blending is now always done in the Display P3 color space, and depending on the configured `window-colorspace` colors will be converted from sRGB or assumed to already be Display P3 colors. In addition, a config option `text-blending` has been added which allows the user to configure linear blending (AKA "gamma correction"). Linear alpha blending also applies to images and makes custom shaders receive linear colors rather than sRGB. In addition, an experimental option has been added which corrects linear blending's tendency to make dark text look too thin and bright text look too thick. Essentially it's a correction curve on the alpha channel that depends on the luminance of the glyph being drawn.
By using the `CAMetalLayer`'s `backgroundColor` property instead of drawing the background color in our shader, it is always stretched to cover the full surface, even when live-resizing, and it doesn't require us to draw a frame for it to be initialized so there's no transparent flash when a new surface is created (as in a new split/tab). This commit also allows for hot reload of `background-opacity`, `window-vsync`, and `window-colorspace`.
We were returning bg colors when we shouldn't have since when we have background color transparency we need to return any bg color cells as fully transparent rather than their actual color.
Compositors can actually tell us whether they want to use CSD or SSD!
We now use a temporary function (__ghostty_bash_startup) to perform the bash startup sequence. This gives us a local function scope in which to store some temporary values (like rcfile). This way, they won't leak into the sourced files' scopes. Also, use `~/` instead of `$HOME` for home directory paths as a simpler shorthand notation.
We post-process history 1's output to extract the current command. This processing needs to strip the leading history number, an optional * character indicating whether the entry was modified (or a space), and then a space separating character. We were previously using sed(1) for this, but we can implement an equivalent transformation using bash's native parameter expansion syntax. This also results in ~4x reduction in per-prompt command overhead.
We use `trap` to bootstrap our installation function (__bp_install). We remove our code upon first execution but need to restore any preexisting trap calls. We previously used `sed` to process the trap string, but that had two downsides: 1. `sed` is an external command dependency. It needs to exist on the system, and we need to invoke it in a subshell (which has some runtime cost). 2. The regular expression pattern was imperfect and didn't handle trickier cases like `'` characters in the trap string: $ (trap "echo 'hello'" DEBUG; trap -p DEBUG) hello trap -- 'echo '\''hello'\''' DEBUG This change removes the dependency on `sed` by locally evaluating the trap string and extracting any prior trap. This works reliably because we control the format our trap string, which looks like this (with newlines expanded): __bp_trap_string="$(trap -p DEBUG)" trap - DEBUG __bp_install
Also make sure to divide alpha out before applying gamma encoding back to text color when not using linear blending.
The intention of ghostty-org#5075 was to create a less intrusive, more hermetic environment in which to source the bash startup files. This caused problems for multiple people, and I believe that's because the general expectation is that these files are sourced at global (not function) scope. For example, when a file is sourced from within a function scope, any variables that weren't explicitly exported into the global environment won't be available outside of the scope of the function. Most system and personal startup files aren't written with that constraint because it's not how bash itself loads these files. As a small improvement over the original code, `rcfile` has been renamed to `__ghostty_rcfile`. Avoiding leaking this variable while sourcing these files was a goal of ghostty-org#5075, and prefixing it make it much less of a potential issue. This change also reverts the $HOME to ~/ change. While the ~/ notation is more concise, using $HOME is more common and easier to implement safely with regard to quoting.
login(1)'s .hushlogin logic was "fixed" in macOS Sonoma 14.4, so this comment (and our workaround) is only relevant for versions earlier than that. The relevant change to login/login.c is part of system_cmds-979.100.8. > login.c: look for .hushlogin in home directory (112854361) - apple-oss-distributions/system_cmds@1bca46e - https://github.com/apple-oss-distributions/distribution-macOS/tree/macos-144
Fixes ghostty-org#5690 When we hide the app and then show it again, the previously key window is lost. This is because we are not using unhide and are manually doing it (and we're not using unhide for good reasons commented in the source already). Modify our hidden state to include what the key window was (as a weak ref) and restore it when we show the app again.
Fully reset the kitty image storage instead of using the delete handler, previously this caused a memory corruption / likely segfault due to use of undefined, since the delete handler tries to clear the tracked pins for placements, which it gets from the terminal, for which `undefined` was passed in before.
- Add J/K and arrow keys navigation in Terminal IO window
Previously, `ghostty +list-actions` would only show actions that had doc comments, making it difficult for users to discover all available actions. This change ensures all actions are listed with appropriate documentation. For actions without doc comments, we now generate a default message encouraging contribution.
The issue was caused by the documentation generation logic not writing the final buffered content.
This commit fixes two issues with the `list-actions` command: 1. Ensures all actions are listed, including those without individual documentation but sharing docs with related actions 2. Improves documentation formatting with proper indentation and grouping
…nd (ghostty-org#4974)" This reverts commit f3d0c7c, reversing changes made to 4b77a1c.
`WINDOWID` is the conventional environment variable for scripts that want to know the X11 window ID of the terminal, so that it may call tools like `xprop` or `xdotool`. We already know the window ID for window protocol handling, so we might as well throw this in for convenience.
This is just a fun change to add a bunch of alternate icons. We don't want to add too many since this increases the final bundle size but we also want to have some fun. :)
This is to facilitate the `performable:` prefix on keybinds that are implemented using app runtime actions.
…viour at edges and closeness to cursor
…ove behaviour at edges and closeness to cursor" This reverts commit bf5351e.
Caused by ghostty-org#5650 I actually don't understand how this didn't happen before or why we didn't notice it but it seems like the envmap was never freed. In the latest debug builds prior to this build GPA reports the leak. We should free the envmap when the subprocess is deinitialized. But also we can free the env map as soon as we start the subprocess which saves some small amount of memory at runtime. Additionally, we should only be freeing the envmap on error if we created it.
As pointed out by @tristan957 the standard path for including the Adwaita header file is simply "adwaita.h". While it may have been necessary in the past to use a non-standard include path, that no longer appears to be the case.
Fixes ghostty-org#5718 When a terminal is resized with text reflow (i.e. soft-wrapped text), the cursor is generally reflowed with it. For example, imagine a terminal window 5-columns wide and you type the following without pressing enter. The cursor is on the X. ``` OOOOO OOX ``` If you resize the window now to 8 or more columns, this happens, as expected: ``` OOOOOOOX ``` As expected, the cursor remains on the "X". This behaves like any other text input... Terminals also provide an escape sequence to [save the cursor (ESC 7 aka DECSC)](https://ghostty.org/docs/vt/esc/decsc). This includes, amongst other things, the cursor position. The cursor can be restored with [DECRC](https://ghostty.org/docs/vt/esc/decrc). The behavior of the position of the _saved cursor_ in the context of text reflow is unspecified and varies wildly between terminals Ghostty does this right now (as do many other terminals): ``` OOOOOOOO X ``` This commit changes the behavior so that we reflow the saved cursor.
thanks, did this with a rebase instead |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
shell-integration-features
being ignored whenshell-integration
isnone
shell-integration-features
setup_features
runs even when shell detection failstext-blending
toalpha-blending
adjust-strikethrough-position
andadjust-overline-position
list-actions
command documentation formattinglist-actions --docs
command (Fixed documentation generation inlist-actions --docs
command ghostty-org/ghostty#4974)"WINDOWID
env var for subprocesses