Fixes#2462
This sets up a listener for screen parameter changes. This only triggers
when a screen is added, removed, or a parameter such as its resolution
changes. This doesn't trigger when a window is simply moved from one
screen to another.
On parameter change, we ensure that the window is within the bounds of
the screen. As an exception, if the window was previously already
outside the bounds of the screen, we don't move it back in.
In particular when configured to replace several ranges with multiple fonts.
Given the following `font-codepoint-map` config:
```
font-codepoint-map=U+0030-U+0039=Monaco # 0-9
font-codepoint-map=U+0040=mononoki # @
font-codepoint-map=U+0041-U+005a=Pixel Code # A-Z
font-codepoint-map=U+0061-U+007a=Victor Mono # a-z
```
I noticed a couple of unexpected behavior:
1. Codepoint ranges were assigned the wrong font
2. The declaration order had a direct impact on the font assignment
(seemed to be rotating in some fashion)
If my understanding of the current implementation is correct, for a
given range index `n` in the `MultiArrayList` `CodepointMap.get(…)`
returns the font descriptor at index `len - n - 1`. In other words, it
returns the descriptor symmetrically opposite relative to the middle of
the list.
I've added a couple test cases that I would expect to pass if my
understanding of the expected behavior is correct, verified that they
were broken under the current behavior, and updated the implementation
of `CodepointMap.get(…)` accordingly.
My understanding of the original intent is to give priority to the
latest range match in the list (which is a use case already tested by
the `codepointmap` test, but which I believe happened to pass "by
accident"), so I opted for a reverse traversal of the codepoint list.
Mode 2048 and CSI 14 t are size report control sequences which contain
the text area size in pixels. The text area is defined to be the extents
of the grid (rows and columns). Ghostty calculates the available size
for the text area by setting the available padding, and then filling as
much of the remaining space as possible. However, if there are remainder
pixels these are still reported as part of the text area size.
Pass the cell_size geometry through so that we can always report the
correct value: columns * cell width and rows * cell height.
As suggested: https://github.com/ghostty-org/ghostty/discussions/2363#discussioncomment-10824847
This allows users of non-US keyboard layouts to continue to use the
right option key for input methods, while still being able to use the
the left option key as alt for keybindings.
This is a bit of an experiment to see if this is a good default for
everyone. This is in response to very common confusion of US keyboard
layouts where "alt" doesn't work along with the very common use of
non-US layouts where the right option key is used for input methods.
I think this will strike the right balance for most users.
This fixes a regression from #2454. In that PR, we added an error when
positional arguments are detected. I believe that's correct, but we
were silently relying on the previous behavior in the CLI commands.
This commit changes the CLI commands to use a new argsIterator function
that creates an iterator that skips the first argument (argv0). This is
the same behavior that the config parsing does and now uses this shared
logic.
This also makes it so the argsIterator ignores actions (`+things`)
and we document that we expect those to be handled earlier.
Rather than storing a list of errors we now store a list of
"diagnostics." Each diagnostic has a richer set of structured
information, including a message, a key, the location where it occurred.
This lets us show more detailed messages, more human friendly messages, and
also let's us filter by key or location. We don't take advantage of
all of this capability in this initial commit, but we do use every field
for something.
This continues our work to improve the amount of explicit error sets
we use in the codebase. Explicit error sets make it easier to understand
possible failure scenarios, allow us to use exhaustive matching, create
compiler errors if errors are unexpectedly added or removed, etc.
The goal eventually is 100% coverage but we're not even close yet.
This just moves us a little closer.
If the apprt is GTK add the GTK and the libadwaita version info to the
`+version` action. This information is available in the log but it may
be more accessible here.