#!/usr/bin/env dub
/+ dub.sdl:
name "anchored_overlays_place_reference"
targetPath "build"
dependency "sparkles:ui" path="../../../.."
dflags "-preview=in" "-preview=dip1000"
buildType "checked" {
buildOptions "optimize" "inline" "debugInfo"
}
+/
/**
* The reference placement pipeline — `place()` as the catalog concluded it must
* be: **one `@safe pure nothrow @nogc` function over Regular values that returns
* geometry _metadata_, not a point.**
*
* Returning only an offset is the mistake this survey identified in the field
* and in this repo. [../compose.md](../compose.md) records the cost precisely:
* because Compose's `PopupPositionProvider` returns an `IntOffset` and nothing
* else, drawing a caret cost "a downcast, an extra frame and a duplicated clamp
* that does not agree with the original". [../proposal.md](../proposal.md) § 3.2
* makes the counter-requirement — the solver reports the resolved **side**, the
* resolved **alignment** and the **arrow cell** alongside the rect, because a
* cell backend picks the border cap and the arrow glyph from the side at paint
* time, and the static-HTML emitter picks them at emit time with no later
* measurement pass available at all.
*
* What this program demonstrates, one case per section, each rendered as cells:
*
* 1. the axis split — **flip on the main axis, slide on the cross axis,
* resize last** ([../proposal.md](../proposal.md) § 3.3, GTK4's
* `GdkAnchorHints` / `xdg_positioner`'s `constraint_adjustment`);
* 2. the **start-edge pin**: when the content is larger than the boundary the
* start edge wins and the end overflows (Textual's `translate_inside`,
* react-aria's `getDelta`, GPUI's right-then-left clamp);
* 3. the pin is against the **boundary**, never against the coordinate
* origin. That is the defect [../features-people-forget.md](../features-people-forget.md)
* § 11 found in *both* this repo's `clampOrigin`
* (`libs/twoslash/src/sparkles/twoslash/render_widgets.d:430`, which floors
* at `0`) and Avalonia's `ManagedPopupPositioner.cs:182` (which subtracts
* `X` from `bounds.Width` instead of from `bounds.Right`, so it is correct
* only when the work area starts at the origin). Case 9 asserts it, and
* prints what `clampOrigin` would have produced;
* 4. the **arrow cell** as an overlay-local index that is clamped into the
* edge's interior and reports whether it reached the anchor's centre — the
* datum `BoxStyle.arrow`/`arrowOffset` already declares and nothing in
* `sparkles:ui` produces today;
* 5. **RTL as a pre-solver resolution**, never a flag inside the solver
* (the Angular CDK bug in [../proposal.md](../proposal.md) § 2's dimension
* notes: CDK resolves `start`/`end` through `_isRtl()` in two places and
* forgets it in a third);
* 6. `anchorHidden` as a **hide verdict, not a close**.
*
* Every case is checked by `checkInvariants` before it is printed, so the
* program is a self-checking oracle rather than a printer: the placed rect is
* inside the boundary whenever it fits, its origin is never below the
* boundary's origin (the anti-clamp-to-zero invariant), the arrow cell is
* strictly inside the attached edge, and **placement is idempotent** — feeding
* the resolved side and alignment back in reproduces the same rect and reports
* no further flip.
*
* Companion to [../proposal.md](../proposal.md) § 3.2–3.3 and
* [../concepts.md](../concepts.md) § "Collision geometry".
*
* Run with: dub run --single place-reference.d
*
* Portability: pure integer geometry — no clock, no display, no terminal.
* Deterministic everywhere. Build `checked`, never `release`: the invariants
* below are `assert`s, and `-release` would delete them.
*
* Note: `Point`/`Size` are `Vector`-backed unions, so a named-field read is not
* available in CTFE (`libs/ui/src/sparkles/ui/geometry.d:34-40`). Everything
* here is therefore a *runtime* demonstration; nothing is a `static assert`.
*/
module (module) anchored_overlays_place_referenceThe reference placement pipeline — place() as the catalog concluded it must
be: one @safe pure nothrow @nogc function over Regular values that returns
geometry metadata_, not a point.
Returning only an offset is the mistake this survey identified in the field
and in this repo. ../compose.md records the cost precisely:
because Compose's PopupPositionProvider returns an IntOffset and nothing
else, drawing a caret cost "a downcast, an extra frame and a duplicated clamp
that does not agree with the original". ../proposal.md § 3.2
makes the counter-requirement — the solver reports the resolved side, the
resolved alignment and the arrow cell alongside the rect, because a
cell backend picks the border cap and the arrow glyph from the side at paint
time, and the static-HTML emitter picks them at emit time with no later
measurement pass available at all.
What this program demonstrates, one case per section, each rendered as cells:
the axis split — flip on the main axis, slide on the cross axis,
resize last (../proposal.md § 3.3, GTK4's
GdkAnchorHints / xdg_positioner's constraint_adjustment);
the start-edge pin: when the content is larger than the boundary the
start edge wins and the end overflows (Textual's translate_inside,
react-aria's getDelta, GPUI's right-then-left clamp);
the pin is against the boundary, never against the coordinate
origin. That is the defect ../features-people-forget.md
§ 11 found in both this repo's clampOrigin
(libs/twoslash/src/sparkles/twoslash/render_widgets.d:430, which floors
at 0) and Avalonia's ManagedPopupPositioner.cs:182 (which subtracts
X from bounds.Width instead of from bounds.Right, so it is correct
only when the work area starts at the origin). Case 9 asserts it, and
prints what clampOrigin would have produced;
the arrow cell as an overlay-local index that is clamped into the
edge's interior and reports whether it reached the anchor's centre — the
datum BoxStyle.arrow/arrowOffset already declares and nothing in
sparkles:ui produces today;
RTL as a pre-solver resolution, never a flag inside the solver
(the Angular CDK bug in ../proposal.md § 2's dimension
notes: CDK resolves start/end through _isRtl() in two places and
forgets it in a third);
anchorHidden as a hide verdict, not a close.
Every case is checked by checkInvariants before it is printed, so the
program is a self-checking oracle rather than a printer: the placed rect is
inside the boundary whenever it fits, its origin is never below the
boundary's origin (the anti-clamp-to-zero invariant), the arrow cell is
strictly inside the attached edge, and placement is idempotent — feeding
the resolved side and alignment back in reproduces the same rect and reports
no further flip.
Companion to ../proposal.md § 3.2–3.3 and
../concepts.md § "Collision geometry".
Run with: dub run --single place-reference.d
Portability
pure integer geometry — no clock, no display, no terminal.
Deterministic everywhere. Build checked, never release: the invariants
below are asserts, and -release would delete them.
Note
Point/Size are Vector-backed unions, so a named-field read is not
available in CTFE (libs/ui/src/sparkles/ui/geometry.d:34-40). Everything
here is therefore a runtime demonstration; nothing is a static assert.
anchored_overlays_place_reference;
import (package) stdstd.(module) std.formatThis package provides string formatting functionality using
printf style format strings.
Submodule Function Name Description package format Converts its arguments according to a format string into a string.
| package |
sformat |
Converts its arguments according to a format string into a buffer. |
| package |
FormatException |
Signals a problem while formatting. |
| write |
formattedWrite |
Converts its arguments according to a format string and writes
the result to an output range. |
| write |
formatValue |
Formats a value of any type according to a format specifier and
writes the result to an output range. |
| read |
formattedRead |
Reads an input range according to a format string and stores the read
values into its arguments. |
| read |
unformatValue |
Reads a value from the given input range and converts it according to
a format specifier. |
| spec |
FormatSpec |
A general handler for format strings. |
| spec |
singleSpec |
Helper function that returns a FormatSpec for a single format specifier. |
Limitation
This package does not support localization, but
adheres to the rounding mode of the floating point unit, if
available.
Format Strings
The functions contained in this package use format strings. A
format string describes the layout of another string for reading or
writing purposes. A format string is composed of normal text
interspersed with format specifiers. A format specifier starts
with a percentage sign '%', optionally followed by one or more
parameters and ends with a format indicator. A format
indicator may be a simple format character or a compound
indicator.
Format strings are composed according to the following grammar:
FormatString:
FormatStringItem FormatString
FormatStringItem:
Character
FormatSpecifier
FormatSpecifier:
'%' Parameters FormatIndicator
FormatIndicator:
FormatCharacter
CompoundIndicator
FormatCharacter:
see remark below
CompoundIndicator:
'(' FormatString '%)'
'(' FormatString '%|' Delimiter '%)'
Delimiter
empty
Character Delimiter
Parameters:
Position Flags Width Precision Separator
Position:
empty
Integer '$'**
*Integer* **':'** *Integer* **'$'
Integer ':' '$'**
*Flags*:
*empty*
*Flag* *Flags*
*Flag*:
**'-'**|**'+'**|**' '**|**'0'**|**'#'**|**'='**
*Width*:
*OptionalPositionalInteger*
*Precision*:
*empty*
**'.'** *OptionalPositionalInteger*
*Separator*:
*empty*
**','** *OptionalInteger*
**','** *OptionalInteger* **'?'**
*OptionalInteger*:
*empty*
*Integer*
**'*'**
*OptionalPositionalInteger*:
*OptionalInteger*
**'*'** *Integer* **'$'
Character
'%%'
AnyCharacterExceptPercent
Integer:
NonZeroDigit Digits
Digits:
empty
Digit Digits
NonZeroDigit:
'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'
Digit:
'0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'
Note
FormatCharacter is unspecified. It can be any character
that has no other purpose in this grammar, but it is
recommended to assign (lower- and uppercase) letters.
Note
The Parameters of a CompoundIndicator are currently
limited to a '-' flag.
Format Indicator
The format indicator can either be a single character or an
expression surrounded by '%(' and '%)'. It specifies the
basic manner in which a value will be formatted and is the minimum
requirement to format a value.
The following characters can be used as format characters:
FormatCharacter Semantics 's' To be formatted in a human readable format. Can be used with all types. 'c' To be formatted as a character. 'd' To be formatted as a signed decimal integer. 'u' To be formatted as a decimal image of the underlying bit representation. 'b' To be formatted as a binary image of the underlying bit representation. 'o' To be formatted as an octal image of the underlying bit representation. 'x' / 'X' To be formatted as a hexadecimal image of the underlying bit representation. 'e' / 'E' To be formatted as a real number in decimal scientific notation. 'f' / 'F' To be formatted as a real number in decimal natural notation. 'g' / 'G' To be formatted as a real number in decimal short notation. Depending on the number, a scientific notation or a natural notation is used. 'a' / 'A' To be formatted as a real number in hexadecimal scientific notation. 'r' To be formatted as raw bytes. The output may not be printable and depends on endianness.
The compound indicator can be used to describe compound types
like arrays or structs in more detail. A compound type is enclosed
within '%(' and '%)'. The enclosed sub-format string is
applied to individual elements. The trailing portion of the
sub-format string following the specifier for the element is
interpreted as the delimiter, and is therefore omitted following the
last element. The '%|' specifier may be used to explicitly
indicate the start of the delimiter, so that the preceding portion of
the string will be included following the last element.
The format string inside of the compound indicator should
contain exactly one format specifier (two in case of associative
arrays), which specifies the formatting mode of the elements of the
compound type. This format specifier can be a compound
indicator itself.
Note
Inside a compound indicator, strings and characters are
escaped automatically. To avoid this behavior, use "%-("
instead of "%(".
Flags
There are several flags that affect the outcome of the formatting.
Flag Semantics '-' When the formatted result is shorter than the value given by the width parameter, the output is left justified. Without the '-' flag, the output remains right justified.
There are two exceptions where the '-' flag has a
different meaning: (1) with 'r' it denotes to use little
endian and (2) in case of a compound indicator it means that
no special handling of the members is applied. |
| '=' |
When the formatted result is shorter than the value
given by the width parameter, the output is centered.
If the central position is not possible it is moved slightly
to the right. In this case, if '-' flag is present in
addition to the '=' flag, it is moved slightly to the left. |
| '+' / *' '* |
Applies to numerical values. By default, positive numbers are not
formatted to include the + sign. With one of these two flags present,
positive numbers are preceded by a plus sign or a space.
When both flags are present, a plus sign is used.
In case of 'r', a big endian format is used. |
| '0' |
Is applied to numerical values that are printed right justified.
If the zero flag is present, the space left to the number is
filled with zeros instead of spaces. |
| '#' |
Denotes that an alternative output must be used. This depends on the type
to be formatted and the format character used. See the
sections below for more information. |
Width, Precision and Separator
The width parameter specifies the minimum width of the result.
The meaning of precision depends on the format indicator. For
integers it denotes the minimum number of digits printed, for
real numbers it denotes the number of fractional digits and for
strings and compound types it denotes the maximum number of elements
that are included in the output.
A separator is used for formatting numbers. If it is specified,
the output is divided into chunks of three digits, separated by a ','. The number of digits in a chunk can be given explicitly by
providing a number or a ''* after the ','.
In all three cases the number of digits can be replaced by a ''*. In this scenario, the next argument is used as the number of
digits. If the argument is a negative number, the precision and
separator parameters are considered unspecified. For width,
the absolute value is used and the '-' flag is set.
The separator can also be followed by a '?'. In that case,
an additional argument is used to specify the symbol that should be
used to separate the chunks.
Position
By default, the arguments are processed in the provided order. With
the position parameter it is possible to address arguments
directly. It is also possible to denote a series of arguments with
two numbers separated by ':', that are all processed in the same
way. The second number can be omitted. In that case the series ends
with the last argument.
It's also possible to use positional arguments for width, precision and separator by adding a number and a '$' after the ''*.
Types
This section describes the result of combining types with format
characters. It is organized in 2 subsections: a list of general
information regarding the formatting of types in the presence of
format characters and a table that contains details for every
available combination of type and format character.
When formatting types, the following rules apply:
If the format character is upper case, the resulting string will
be formatted using upper case letters.
The default precision for floating point numbers is 6 digits.
Rounding of floating point numbers adheres to the rounding mode
of the floating point unit, if available.
The floating point values NaN and Infinity are formatted as
nan and inf, possibly preceded by '+' or '-' sign.
Formatting reals is only supported for 64 bit reals and 80 bit reals.
All other reals are cast to double before they are formatted. This will
cause the result to be inf for very large numbers.
Characters and strings formatted with the 's' format character
inside of compound types are surrounded by single and double quotes
and unprintable characters are escaped. To avoid this, a '-'
flag can be specified for the compound specifier
(e.g. "%-(%s%)" instead of "%(%s%)" ).
Structs, unions, classes and interfaces are formatted by calling a
toString method if available.
See module std.format.write for more
details.
Only part of these combinations can be used for reading. See
module std.format.read for more
detailed information.
This table contains descriptions for every possible combination of
type and format character:
<th scope="col" width="20%">Type</th> <th scope="col" width="20%">Format Character</th> Formatted as... <td rowspan="1">null</td> 's' null
|<td rowspan="3">bool</td> 's' |
false or true |
| 'b', 'd', 'o', 'u', 'x', 'X' |
As the integrals 0 or 1 with the same format character.
Please note, that 'o' and 'x' with '#' flag
might produce unexpected results due to special handling of
the value 0. |
| 'r' |
\0 or \1 |
|<td rowspan="4">Integral</td> 's', 'd' |
A signed decimal number. The '#' flag is ignored. |
| 'b', 'o', 'u', 'x', 'X' |
An unsigned binary, decimal, octal or hexadecimal number.
In case of 'o' and 'x', the '#' flag
denotes that the number must be preceded by 0 and 0x, with
the exception of the value 0, where this does not apply. For
'b' and 'u' the '#' flag has no effect. |
| 'e', 'E', 'f', 'F', 'g', 'G', 'a', 'A' |
As a floating point value with the same specifier.
Default precision is large enough to add all digits
of the integral value.
In case of 'a' and 'A', the integral digit can be
any hexadecimal digit.
|
| 'r' |
Characters taken directly from the binary representation. |
|<td rowspan="5">Floating Point</td> 'e', 'E' |
Scientific notation: Exactly one integral digit followed by a dot
and fractional digits, followed by the exponent.
The exponent is formatted as 'e' followed by
a '+' or '-' sign, followed by at least
two digits.
When there are no fractional digits and the '#' flag
is not present, the dot is omitted. |
| 'f', 'F' |
Natural notation: Integral digits followed by a dot and
fractional digits.
When there are no fractional digits and the '#' flag
is not present, the dot is omitted.
Please note: the difference between 'f' and 'F'
is only visible for NaN and Infinity. |
| 's', 'g', 'G' |
Short notation: If the absolute value is larger than 10 ^^ precision
or smaller than 0.0001, the scientific notation is used.
If not, the natural notation is applied.
In both cases precision denotes the count of all digits, including
the integral digits. Trailing zeros (including a trailing dot) are removed.
If '#' flag is present, trailing zeros are not removed. |
| 'a', 'A' |
Hexadecimal scientific notation: 0x followed by 1
(or 0 in case of value zero or denormalized number)
followed by a dot, fractional digits in hexadecimal
notation and an exponent. The exponent is build by p,
followed by a sign and the exponent in decimal notation.
When there are no fractional digits and the '#' flag
is not present, the dot is omitted. |
| 'r' |
Characters taken directly from the binary representation. |
|<td rowspan="3">Character</td> 's', 'c' |
As the character.
Inside of a compound indicator 's' is treated differently: The
character is surrounded by single quotes and non printable
characters are escaped. This can be avoided by preceding
the compound indicator with a '-' flag
(e.g. "%-(%s%)"). |
| 'b', 'd', 'o', 'u', 'x', 'X' |
As the integral that represents the character. |
| 'r' |
Characters taken directly from the binary representation. |
|<td rowspan="3">String</td> 's' |
The sequence of characters that form the string.
Inside of a compound indicator the string is surrounded by double quotes
and non printable characters are escaped. This can be avoided
by preceding the compound indicator with a '-' flag
(e.g. "%-(%s%)"). |
| 'r' |
The sequence of characters, each formatted with 'r'. |
| compound |
As an array of characters. |
|<td rowspan="3">Array</td> 's' |
When the elements are characters, the array is formatted as
a string. In all other cases the array is surrounded by square brackets
and the elements are separated by a comma and a space. If the elements
are strings, they are surrounded by double quotes and non
printable characters are escaped. |
| 'r' |
The sequence of the elements, each formatted with 'r'. |
| compound |
The sequence of the elements, each formatted according to the specifications
given inside of the compound specifier. |
|<td rowspan="2">Associative Array</td> 's' |
As a sequence of the elements in unpredictable order. The output is
surrounded by square brackets. The elements are separated by a
comma and a space. The elements are formatted as key:value. |
| compound |
As a sequence of the elements in unpredictable order. Each element
is formatted according to the specifications given inside of the
compound specifier. The first specifier is used for formatting
the key and the second specifier is used for formatting the value.
The order can be changed with positional arguments. For example
"%(%2$s (%1$s), %)" will write the value, followed by the key in
parenthesis. |
|<td rowspan="2">Enum</td> 's' |
The name of the value. If the name is not available, the base value
is used, preceeded by a cast. |
| All, but 's' |
Enums can be formatted with all format characters that can be used
with the base value. In that case they are formatted like the base value. |
|<td rowspan="3">Input Range</td> 's' |
When the elements of the range are characters, they are written like a string.
In all other cases, the elements are enclosed by square brackets and separated
by a comma and a space. |
| 'r' |
The sequence of the elements, each formatted with 'r'. |
| compound |
The sequence of the elements, each formatted according to the specifications
given inside of the compound specifier. |
|<td rowspan="1">Struct</td> 's' |
When the struct has neither an applicable toString
nor is an input range, it is formatted as follows:
StructType(field1, field2, ...). |
|<td rowspan="1">Class</td> 's' |
When the class has neither an applicable toString
nor is an input range, it is formatted as the
fully qualified name of the class. |
|<td rowspan="1">Union</td> 's' |
When the union has neither an applicable toString
nor is an input range, it is formatted as its base name. |
|<td rowspan="2">Pointer</td> 's' |
A null pointer is formatted as 'null'. All other pointers are
formatted as hexadecimal numbers with the format character 'X'. |
| 'x', 'X' |
Formatted as a hexadecimal number. |
|<td rowspan="3">SIMD vector</td> 's' |
The array is surrounded by square brackets
and the elements are separated by a comma and a space. |
| 'r' |
The sequence of the elements, each formatted with 'r'. |
| compound |
The sequence of the elements, each formatted according to the specifications
given inside of the compound specifier. |
|<td rowspan="1">Delegate</td> 's', 'r', compound |
As the .stringof of this delegate treated as a string.
Please note: The implementation is currently buggy
and its use is discouraged. |
Source
std/format/package.d
Examples
Simple use:
// Easiest way is to use `%s` everywhere:
assert(format("I got %s %s for %s euros.", 30, "eggs", 5.27) == "I got 30 eggs for 5.27 euros.");
// Other format characters provide more control:
assert(format("I got %b %(%X%) for %f euros.", 30, "eggs", 5.27) == "I got 11110 65676773 for 5.270000 euros.");
Compound specifiers allow formatting arrays and other compound types:
/*
The trailing end of the sub-format string following the specifier for
each item is interpreted as the array delimiter, and is therefore
omitted following the last array item:
*/
assert(format("My items are %(%s %).", [1,2,3]) == "My items are 1 2 3.");
assert(format("My items are %(%s, %).", [1,2,3]) == "My items are 1, 2, 3.");
/*
The "%|" delimiter specifier may be used to indicate where the
delimiter begins, so that the portion of the format string prior to
it will be retained in the last array element:
*/
assert(format("My items are %(-%s-%|, %).", [1,2,3]) == "My items are -1-, -2-, -3-.");
/*
These compound format specifiers may be nested in the case of a
nested array argument:
*/
auto mat = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]];
assert(format("%(%(%d %) - %)", mat), "1 2 3 - 4 5 6 - 7 8 9");
assert(format("[%(%(%d %) - %)]", mat), "[1 2 3 - 4 5 6 - 7 8 9]");
assert(format("[%([%(%d %)]%| - %)]", mat), "[1 2 3] - [4 5 6] - [7 8 9]");
/*
Strings and characters are escaped automatically inside compound
format specifiers. To avoid this behavior, use "%-(" instead of "%(":
*/
assert(format("My friends are %s.", ["John", "Nancy"]) == `My friends are ["John", "Nancy"].`);
assert(format("My friends are %(%s, %).", ["John", "Nancy"]) == `My friends are "John", "Nancy".`);
assert(format("My friends are %-(%s, %).", ["John", "Nancy"]) == `My friends are John, Nancy.`);
Using parameters:
// Flags can be used to influence to outcome:
assert(format("%g != %+#g", 3.14, 3.14) == "3.14 != +3.14000");
// Width and precision help to arrange the formatted result:
assert(format(">%10.2f<", 1234.56789) == "> 1234.57<");
// Numbers can be grouped:
assert(format("%,4d", int.max) == "21,4748,3647");
// It's possible to specify the position of an argument:
assert(format("%3$s %1$s", 3, 17, 5) == "5 3");
Providing parameters as arguments:
// Width as argument
assert(format(">%*s<", 10, "abc") == "> abc<");
// Precision as argument
assert(format(">%.*f<", 5, 123.2) == ">123.20000<");
// Grouping as argument
assert(format("%,*d", 1, int.max) == "2,1,4,7,4,8,3,6,4,7");
// Grouping separator as argument
assert(format("%,3?d", '_', int.max) == "2_147_483_647");
// All at once
assert(format("%*.*,*?d", 20, 15, 6, '/', int.max) == " 000/002147/483647");
format : (alias template) anchored_overlays_place_reference.format = std.format.format(Char, Args...)(in Char[] fmt, Args args) if (isSomeChar!Char)Converts its arguments according to a format string into a string.
The second version of format takes the format string as template
argument. In this case, it is checked for consistency at
compile-time and produces slightly faster code, because the length of
the output buffer can be estimated in advance.
format;
import (package) stdstd.(module) std.stdioCategory Symbols File handles _popen File isFileHandle openNetwork stderr stdin stdout Reading chunks lines readf readfln readln Writing toFile write writef writefln writeln Misc KeepTerminator LockType StdioException
Standard I/O functions that extend core.stdc.stdio. core.stdc.stdio
is publically imported when importing std.stdio.
There are three layers of I/O:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
stdio : (alias template) anchored_overlays_place_reference.writefln = std.stdio.writefln(alias fmt, A...)(A args) if (isSomeString!(typeof(fmt)))Equivalent to writef(fmt, args, '\n').
writefln, (alias template) anchored_overlays_place_reference.writeln = std.stdio.writeln(T...)(T args)Equivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln;
import (package) sparklessparkles.(package) sparkles.uiui.(module) sparkles.ui.geometryAbstract geometry for sparkles.ui: points, sizes, rectangles, and insets
measured in abstract cells — the monospace column/row grid every backend
shares. An interpreter scales cells to pixels (GUI), keeps them 1:1 (TUI cell
grid), or maps them to ch/em (HTML). Nothing here knows about a specific
backend.
Also the sizing vocabulary (SizeSpec: fit / grow / fixed / percent with
min/max) the layout pass (sparkles.ui.layout) resolves, and
cellsOf — the one width authority: the display-column width of a
string, counting one column per codepoint to match the grid advance the GUI
painter (drawText) and the terminal both use. (Proper wide/combining width is
the deferred grapheme-width upgrade; see the hue FNT6/DEF7 roadmap item.)
The 2-D types specialize sparkles.math.vector's numeric Vector, the same
way TermSize/TermPosition do for the
terminal — one vector implementation and one field vocabulary across the stack.
geometry : (struct) sparkles.math.vector.Vector!(int, 2LU, ["x", "y"])Point, (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect, (struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size;
// ---------------------------------------------------------------------------
// The vocabulary
// ---------------------------------------------------------------------------
/// Which edge of the **anchor** the overlay attaches to. `Side.bottom` means the
/// overlay hangs below the anchor and its own *top* edge faces it.
enum (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side : ubyte
{
(enum value) anchored_overlays_place_reference.Side.top = cast(ubyte)0uabove the anchor
top, /// above the anchor
(enum value) anchored_overlays_place_reference.Side.bottom = 1below the anchor
bottom, /// below the anchor
(enum value) anchored_overlays_place_reference.Side.left = 2left of the anchor
left, /// left of the anchor
(enum value) anchored_overlays_place_reference.Side.right = 3right of the anchor
right, /// right of the anchor
}
/// Cross-axis alignment, in **physical** terms. `start` is the left/top edge; a
/// logical (writing-order) alignment is resolved to one of these before the
/// solver runs — see $(LREF physical).
enum (enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align : ubyte { (enum value) anchored_overlays_place_reference.Align.start = cast(ubyte)0ustart, (enum value) anchored_overlays_place_reference.Align.center = 1center, (enum value) anchored_overlays_place_reference.Align.end = 2end }
/// Reading direction. An *input to the resolution step*, never a flag consulted
/// inside the solver.
enum (enum) anchored_overlays_place_reference.DirectionReading direction. An input to the resolution step, never a flag consulted
inside the solver.
Direction : ubyte { (enum value) anchored_overlays_place_reference.Direction.ltr = cast(ubyte)0ultr, (enum value) anchored_overlays_place_reference.Direction.rtl = 1rtl }
/// Which adjustments the caller permits — and, on the result, which ones
/// actually fired. Structurally GTK4's `GdkAnchorHints` / `xdg_positioner`'s
/// `constraint_adjustment`, so a future native-windowing backend can forward it.
enum (enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust : ubyte
{
(enum value) anchored_overlays_place_reference.Adjust.none = cast(ubyte)0unone = 0,
(enum value) anchored_overlays_place_reference.Adjust.flipMain = cast(ubyte)1ucross to the opposite side of the anchor
flipMain = 1 << 0, /// cross to the opposite side of the anchor
(enum value) anchored_overlays_place_reference.Adjust.slideMain = cast(ubyte)2ushift along the side axis (detaches; opt-in)
slideMain = 1 << 1, /// shift along the side axis (detaches; opt-in)
(enum value) anchored_overlays_place_reference.Adjust.flipCross = cast(ubyte)4umirror the alignment (opt-in; Floating UI's rule)
flipCross = 1 << 2, /// mirror the alignment (opt-in; Floating UI's rule)
(enum value) anchored_overlays_place_reference.Adjust.slideCross = cast(ubyte)8ushift along the edge axis
slideCross = 1 << 3, /// shift along the edge axis
(enum value) anchored_overlays_place_reference.Adjust.resizeMain = cast(ubyte)16ushrink to the room at the resolved side
resizeMain = 1 << 4, /// shrink to the room at the resolved side
(enum value) anchored_overlays_place_reference.Adjust.resizeCross = cast(ubyte)32ushrink to the boundary's cross extent (opt-in)
resizeCross = 1 << 5, /// shrink to the boundary's cross extent (opt-in)
}
/// How good the resulting placement is, worst-wins.
enum (enum) anchored_overlays_place_reference.FitHow good the resulting placement is, worst-wins.
Fit : ubyte
{
(enum value) anchored_overlays_place_reference.Fit.exact = cast(ubyte)0uplaced as asked
exact, /// placed as asked
(enum value) anchored_overlays_place_reference.Fit.slid = 1shifted along an axis to stay inside
slid, /// shifted along an axis to stay inside
(enum value) anchored_overlays_place_reference.Fit.flipped = 2crossed to the other side of the anchor
flipped, /// crossed to the other side of the anchor
(enum value) anchored_overlays_place_reference.Fit.shrunk = 3the content was capped
shrunk, /// the content was capped
(enum value) anchored_overlays_place_reference.Fit.overflowing = 4it does not fit and we are the host — nobody clips for us
overflowing, /// it does not fit and we are the host — nobody clips for us
}
/// The genuine fork the survey found: GTK4 accepts a flip when it is *less bad*;
/// `xdg_positioner` reverts unless the flipped position is fully unconstrained.
enum (enum) anchored_overlays_place_reference.FlipAcceptanceThe genuine fork the survey found: GTK4 accepts a flip when it is less bad;
xdg_positioner reverts unless the flipped position is fully unconstrained.
FlipAcceptance : ubyte { (enum value) anchored_overlays_place_reference.FlipAcceptance.revertUnlessFree = cast(ubyte)0urevertUnlessFree, (enum value) anchored_overlays_place_reference.FlipAcceptance.lessBadWins = 1lessBadWins }
/// Bit tests spelled once, so the solver reads as prose.
bool bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
has((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust (parameter) anchored_overlays_place_reference.Adjust aa, (enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust (parameter) anchored_overlays_place_reference.Adjust ff) @safe pure nothrow @nogc => ((parameter) anchored_overlays_place_reference.Adjust aa & (parameter) anchored_overlays_place_reference.Adjust ff) != 0;
/// ditto
(enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.plus(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
plus((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust (parameter) anchored_overlays_place_reference.Adjust aa, (enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust (parameter) anchored_overlays_place_reference.Adjust ff) @safe pure nothrow @nogc => cast((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust)((parameter) anchored_overlays_place_reference.Adjust aa | (parameter) anchored_overlays_place_reference.Adjust ff);
/// The opposite side, for a main-axis flip.
(enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side anchored_overlays_place_reference.Side anchored_overlays_place_reference.opposite(anchored_overlays_place_reference.Side s) pure nothrow @nogc @safeThe opposite side, for a main-axis flip.
opposite((enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side (parameter) anchored_overlays_place_reference.Side ss) @safe pure nothrow @nogc
{
final switch ((parameter) anchored_overlays_place_reference.Side ss)
{
case (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.top = cast(ubyte)0uabove the anchor
top: return (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.bottom = 1below the anchor
bottom;
case (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.bottom = 1below the anchor
bottom: return (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.top = cast(ubyte)0uabove the anchor
top;
case (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.left = 2left of the anchor
left: return (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.right = 3right of the anchor
right;
case (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.right = 3right of the anchor
right: return (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.left = 2left of the anchor
left;
}
}
/// The mirrored alignment. `center` is its own mirror.
(enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align anchored_overlays_place_reference.Align anchored_overlays_place_reference.mirror(anchored_overlays_place_reference.Align a) pure nothrow @nogc @safeThe mirrored alignment. center is its own mirror.
mirror((enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align (parameter) anchored_overlays_place_reference.Align aa) @safe pure nothrow @nogc
=> (parameter) anchored_overlays_place_reference.Align aa == (enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align.(enum value) anchored_overlays_place_reference.Align.start = cast(ubyte)0ustart ? (enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align.(enum value) anchored_overlays_place_reference.Align.end = 2end : ((parameter) anchored_overlays_place_reference.Align aa == (enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align.(enum value) anchored_overlays_place_reference.Align.end = 2end ? (enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align.(enum value) anchored_overlays_place_reference.Align.start = cast(ubyte)0ustart : (enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align.(enum value) anchored_overlays_place_reference.Align.center = 1center);
/**
The placement **request**. Never written back to by the solver (`D15.C6`): what
the caller asked for stays readable next to what it got.
*/
struct (struct) anchored_overlays_place_reference.PlacementPolicyThe placement request. Never written back to by the solver (D15.C6): what
the caller asked for stays readable next to what it got.
PlacementPolicy
{
(enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side (field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.sidethe preferred anchor edge
side = (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.bottom = 1below the anchor
bottom; /// the preferred anchor edge
(enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align (field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacementPolicy.align_the preferred cross-axis alignment
align_ = (enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align.(enum value) anchored_overlays_place_reference.Align.center = 1center; /// the preferred cross-axis alignment
(enum) anchored_overlays_place_reference.DirectionReading direction. An input to the resolution step, never a flag consulted
inside the solver.
Direction (field) anchored_overlays_place_reference.Direction anchored_overlays_place_reference.PlacementPolicy.directionresolved away before the solve
direction = (enum) anchored_overlays_place_reference.DirectionReading direction. An input to the resolution step, never a flag consulted
inside the solver.
Direction.(enum value) anchored_overlays_place_reference.Direction.ltr = cast(ubyte)0ultr; /// resolved away before the solve
int (field) int anchored_overlays_place_reference.PlacementPolicy.sideOffsetthe gutter, in cells, applied BEFORE testing
sideOffset; /// the gutter, in cells, applied BEFORE testing
int (field) int anchored_overlays_place_reference.PlacementPolicy.alignOffseta nudge along the edge axis, in cells
alignOffset; /// a nudge along the edge axis, in cells
/// The default is the proposal's `popupCollision`: flip the side axis, slide
/// the edge axis, cap the height. Side-axis slide and cross-axis flip are
/// opt-in, because both detach the overlay from its anchor.
(enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust (field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjustThe default is the proposal's popupCollision: flip the side axis, slide
the edge axis, cap the height. Side-axis slide and cross-axis flip are
opt-in, because both detach the overlay from its anchor.
adjust = cast((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust)((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.flipMain = cast(ubyte)1ucross to the opposite side of the anchor
flipMain | (enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.slideCross = cast(ubyte)8ushift along the edge axis
slideCross | (enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.resizeMain = cast(ubyte)16ushrink to the room at the resolved side
resizeMain);
(enum) anchored_overlays_place_reference.FlipAcceptanceThe genuine fork the survey found: GTK4 accepts a flip when it is less bad;
xdg_positioner reverts unless the flipped position is fully unconstrained.
FlipAcceptance (field) anchored_overlays_place_reference.FlipAcceptance anchored_overlays_place_reference.PlacementPolicy.acceptanceacceptance = (enum) anchored_overlays_place_reference.FlipAcceptanceThe genuine fork the survey found: GTK4 accepts a flip when it is less bad;
xdg_positioner reverts unless the flipped position is fully unconstrained.
FlipAcceptance.(enum value) anchored_overlays_place_reference.FlipAcceptance.revertUnlessFree = cast(ubyte)0urevertUnlessFree;
bool (field) bool anchored_overlays_place_reference.PlacementPolicy.arrowreserve an arrow cell on the attached edge
arrow = true; /// reserve an arrow cell on the attached edge
}
/**
The resolved anchor. `rect` is what the solver places against; `clip` is the
anchor's clipping ancestor, which governs **only** the `anchorHidden` verdict —
the placement boundary is a separate parameter (`D3.C3`).
*/
struct (struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor
{
(struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect (field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect; /// the anchor's cell rect
(struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect (field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.clipthe clipping ancestor
clip; /// the clipping ancestor
@safe pure nothrow @nogc:
/// An anchor with no clipping ancestor: it clips to itself, so it is always
/// visible.
static (struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safeAn anchor with no clipping ancestor: it clips to itself, so it is always
visible.
unclipped(in (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect (parameter) const(sparkles.ui.geometry.Rect) rr) => (struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor((parameter) const(sparkles.ui.geometry.Rect) rr, (parameter) const(sparkles.ui.geometry.Rect) rr);
/// An anchor inside a scrolling viewport, which may have scrolled out of it.
static (struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.within(in sparkles.ui.geometry.Rect r, in sparkles.ui.geometry.Rect clip) pure nothrow @nogc @safeAn anchor inside a scrolling viewport, which may have scrolled out of it.
within(in (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect (parameter) const(sparkles.ui.geometry.Rect) rr, in (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect (parameter) const(sparkles.ui.geometry.Rect) clipclip) => (struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor((parameter) const(sparkles.ui.geometry.Rect) rr, (parameter) const(sparkles.ui.geometry.Rect) clipclip);
/// The part of the anchor its clip stack actually leaves on screen.
(struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.visible() const pure nothrow @nogc @safeThe part of the anchor its clip stack actually leaves on screen.
visible() const scope => (field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.sparkles.ui.geometry.Rect sparkles.ui.geometry.Rect.intersection(in sparkles.ui.geometry.Rect other) const pure nothrow @nogc @safeThe overlap of two rectangles (an empty one when disjoint).
intersection((field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.clipthe clipping ancestor
clip);
/// The anchor left its clip entirely — a HIDE verdict, not a close.
bool bool anchored_overlays_place_reference.Anchor.hidden() const pure nothrow @nogc @safeThe anchor left its clip entirely — a HIDE verdict, not a close.
hidden() const scope => sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.visible() const pure nothrow @nogc @safeThe part of the anchor its clip stack actually leaves on screen.
visible.bool sparkles.ui.geometry.Rect.empty() const pure nothrow @nogc @safetrue iff the rectangle covers no cells.
empty;
}
/**
The placement **result**: geometry metadata, not a point. Every field here is
one a backend or an emitter would otherwise have to re-derive — which is exactly
what [../compose.md](../compose.md), [../avalonia.md](../avalonia.md) and hue's
three `clampOrigin` call sites each ended up doing, differently.
*/
struct (struct) anchored_overlays_place_reference.PlacedOverlayThe placement result: geometry metadata, not a point. Every field here is
one a backend or an emitter would otherwise have to re-derive — which is exactly
what ../compose.md, ../avalonia.md and hue's
three clampOrigin call sites each ended up doing, differently.
PlacedOverlay
{
(struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect (field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect; /// resolved, integer cells, already pinned
(enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side (field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.sidepost-flip anchor edge we attached to
side; /// post-flip anchor edge we attached to
(enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align (field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacedOverlay.align_post-flip, post-RTL cross alignment
align_; /// post-flip, post-RTL cross alignment
int (field) int anchored_overlays_place_reference.PlacedOverlay.arrowCelloverlay-local index along the attached edge; -1 = none
arrowCell = -1; /// overlay-local index along the attached edge; -1 = none
bool (field) bool anchored_overlays_place_reference.PlacedOverlay.arrowCentredfalse ⇒ the arrow could not reach the anchor's centre
arrowCentred; /// false ⇒ the arrow could not reach the anchor's centre
bool (field) bool anchored_overlays_place_reference.PlacedOverlay.flippedMainthe side axis crossed to the other side of the anchor
flippedMain; /// the side axis crossed to the other side of the anchor
bool (field) bool anchored_overlays_place_reference.PlacedOverlay.flippedCrossthe alignment was mirrored (RTL resolution, or flipCross)
flippedCross; /// the alignment was mirrored (RTL resolution, or flipCross)
bool (field) bool anchored_overlays_place_reference.PlacedOverlay.anchorHiddenthe anchor left its clip
anchorHidden; /// the anchor left its clip
(struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size (field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.PlacedOverlay.availableroom actually left at the resolved side
available; /// room actually left at the resolved side
(enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust (field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacedOverlay.appliedwhich adjustments fired
applied; /// which adjustments fired
(enum) anchored_overlays_place_reference.FitHow good the resulting placement is, worst-wins.
Fit (field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fitthe worst thing that happened
fit; /// the worst thing that happened
}
// ---------------------------------------------------------------------------
// The pipeline
// ---------------------------------------------------------------------------
/**
Step 0 — **logical → physical**, run *before* the solver and never inside it.
Under RTL, `start` is the right edge, the left/right sides swap, and the sign of
the edge-axis offset flips with them. Angular CDK resolves this inside its
solver and forgets it in one of three places; GTK4 negates the offset on the
flipped branch for the analogous reason and Avalonia's RTL mirror omits it.
Keeping it a separate pure step makes the omission unrepresentable.
*/
(struct) anchored_overlays_place_reference.PlacementPolicyThe placement request. Never written back to by the solver (D15.C6): what
the caller asked for stays readable next to what it got.
PlacementPolicy anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.physical(in anchored_overlays_place_reference.PlacementPolicy p) pure nothrow @nogc @safeStep 0 — logical → physical, run before the solver and never inside it.
Under RTL, start is the right edge, the left/right sides swap, and the sign of
the edge-axis offset flips with them. Angular CDK resolves this inside its
solver and forgets it in one of three places; GTK4 negates the offset on the
flipped branch for the analogous reason and Avalonia's RTL mirror omits it.
Keeping it a separate pure step makes the omission unrepresentable.
physical(in (struct) anchored_overlays_place_reference.PlacementPolicyThe placement request. Never written back to by the solver (D15.C6): what
the caller asked for stays readable next to what it got.
PlacementPolicy (parameter) const(anchored_overlays_place_reference.PlacementPolicy) pp) @safe pure nothrow @nogc
{
if ((parameter) const(anchored_overlays_place_reference.PlacementPolicy) pp.(field) anchored_overlays_place_reference.Direction anchored_overlays_place_reference.PlacementPolicy.directionresolved away before the solve
direction == (enum) anchored_overlays_place_reference.DirectionReading direction. An input to the resolution step, never a flag consulted
inside the solver.
Direction.(enum value) anchored_overlays_place_reference.Direction.ltr = cast(ubyte)0ultr)
return (parameter) const(anchored_overlays_place_reference.PlacementPolicy) pp;
(struct) anchored_overlays_place_reference.PlacementPolicyThe placement request. Never written back to by the solver (D15.C6): what
the caller asked for stays readable next to what it got.
PlacementPolicy (local variable) anchored_overlays_place_reference.PlacementPolicy rr = (parameter) const(anchored_overlays_place_reference.PlacementPolicy) pp;
(local variable) anchored_overlays_place_reference.PlacementPolicy rr.(field) anchored_overlays_place_reference.Direction anchored_overlays_place_reference.PlacementPolicy.directionresolved away before the solve
direction = (enum) anchored_overlays_place_reference.DirectionReading direction. An input to the resolution step, never a flag consulted
inside the solver.
Direction.(enum value) anchored_overlays_place_reference.Direction.ltr = cast(ubyte)0ultr;
(local variable) anchored_overlays_place_reference.PlacementPolicy rr.(field) int anchored_overlays_place_reference.PlacementPolicy.alignOffseta nudge along the edge axis, in cells
alignOffset = -(parameter) const(anchored_overlays_place_reference.PlacementPolicy) pp.(field) int anchored_overlays_place_reference.PlacementPolicy.alignOffseta nudge along the edge axis, in cells
alignOffset;
if ((parameter) const(anchored_overlays_place_reference.PlacementPolicy) pp.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.sidethe preferred anchor edge
side == (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.left = 2left of the anchor
left)
(local variable) anchored_overlays_place_reference.PlacementPolicy rr.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.sidethe preferred anchor edge
side = (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.right = 3right of the anchor
right;
else if ((parameter) const(anchored_overlays_place_reference.PlacementPolicy) pp.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.sidethe preferred anchor edge
side == (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.right = 3right of the anchor
right)
(local variable) anchored_overlays_place_reference.PlacementPolicy rr.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.sidethe preferred anchor edge
side = (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.left = 2left of the anchor
left;
else
(local variable) anchored_overlays_place_reference.PlacementPolicy rr.(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacementPolicy.align_the preferred cross-axis alignment
align_ = anchored_overlays_place_reference.Align anchored_overlays_place_reference.mirror(anchored_overlays_place_reference.Align a) pure nothrow @nogc @safeThe mirrored alignment. center is its own mirror.
mirror((parameter) const(anchored_overlays_place_reference.PlacementPolicy) pp.(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacementPolicy.align_the preferred cross-axis alignment
align_);
return (local variable) anchored_overlays_place_reference.PlacementPolicy rr;
}
/**
Place `content` against `anchor` inside `boundary`, under `policy`.
Per-axis and total: the **main** (side) axis flips then optionally resizes; the
**cross** (edge) axis aligns, optionally mirrors, then slides — end edge first,
start edge last, so an overlay larger than the boundary pins its start and
overflows its end. The start pin is against `boundary`, **not** against `0`.
*/
(struct) anchored_overlays_place_reference.PlacedOverlayThe placement result: geometry metadata, not a point. Every field here is
one a backend or an emitter would otherwise have to re-derive — which is exactly
what ../compose.md, ../avalonia.md and hue's
three clampOrigin call sites each ended up doing, differently.
PlacedOverlay anchored_overlays_place_reference.PlacedOverlay anchored_overlays_place_reference.place(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy) pure nothrow @nogc @safePlace content against anchor inside boundary, under policy.
Per-axis and total: the main (side) axis flips then optionally resizes; the
cross* (edge) axis aligns, optionally mirrors, then slides — end edge first,
start edge last, so an overlay larger than the boundary pins its start and
overflows its end. The start pin is against boundary, not against 0.
place(in (struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor (parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor, in (struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size (parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) contentcontent, in (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect (parameter) const(sparkles.ui.geometry.Rect) boundaryboundary,
in (struct) anchored_overlays_place_reference.PlacementPolicyThe placement request. Never written back to by the solver (D15.C6): what
the caller asked for stays readable next to what it got.
PlacementPolicy (parameter) const(anchored_overlays_place_reference.PlacementPolicy) policypolicy) @safe pure nothrow @nogc
in ((parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) contentcontent.(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).widthwidth > 0 && (parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) contentcontent.(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).heightheight > 0, "an empty overlay is not a placement problem")
in (!(parameter) const(sparkles.ui.geometry.Rect) boundaryboundary.bool sparkles.ui.geometry.Rect.empty() const pure nothrow @nogc @safetrue iff the rectangle covers no cells.
empty, "the boundary must cover at least one cell")
out (r; (local variable) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x >= (parameter) const(sparkles.ui.geometry.Rect) boundaryboundary.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x && (local variable) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y >= (parameter) const(sparkles.ui.geometry.Rect) boundaryboundary.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y,
"the start edge pins to the BOUNDARY, never to the coordinate origin")
{
const (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq = anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.physical(in anchored_overlays_place_reference.PlacementPolicy p) pure nothrow @nogc @safeStep 0 — logical → physical, run before the solver and never inside it.
Under RTL, start is the right edge, the left/right sides swap, and the sign of
the edge-axis offset flips with them. Angular CDK resolves this inside its
solver and forgets it in one of three places; GTK4 negates the offset on the
flipped branch for the analogous reason and Avalonia's RTL mirror omits it.
Keeping it a separate pure step makes the omission unrepresentable.
physical((parameter) const(anchored_overlays_place_reference.PlacementPolicy) policypolicy);
const (local variable) const(bool) verticalvertical = (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.sidethe preferred anchor edge
side == (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.top = cast(ubyte)0uabove the anchor
top || (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.sidethe preferred anchor edge
side == (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.bottom = 1below the anchor
bottom;
// --- main (side) axis --------------------------------------------------
const int (local variable) const(int) bLobLo = (local variable) const(bool) verticalvertical ? (parameter) const(sparkles.ui.geometry.Rect) boundaryboundary.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y : (parameter) const(sparkles.ui.geometry.Rect) boundaryboundary.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x;
const int (local variable) const(int) bHibHi = (local variable) const(bool) verticalvertical ? (parameter) const(sparkles.ui.geometry.Rect) boundaryboundary.int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
bottom : (parameter) const(sparkles.ui.geometry.Rect) boundaryboundary.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right;
const int (local variable) const(int) aLoaLo = (local variable) const(bool) verticalvertical ? (parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y : (parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x;
const int (local variable) const(int) aHiaHi = (local variable) const(bool) verticalvertical ? (parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
bottom : (parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right;
const int (local variable) const(int) mainWantmainWant = (local variable) const(bool) verticalvertical ? (parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) contentcontent.(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).heightheight : (parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) contentcontent.(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).widthwidth;
// The gutter is folded in BEFORE the constraint test, never after it
// (xdg_positioner's rule; testing the un-offset rect re-introduces exactly
// the overflow the flip just resolved).
bool (local variable) bool atEndatEnd = (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.sidethe preferred anchor edge
side == (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.bottom = 1below the anchor
bottom || (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.sidethe preferred anchor edge
side == (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.right = 3right of the anchor
right;
int (local variable) int roomroom = (local variable) bool atEndatEnd ? (local variable) const(int) bHibHi - ((local variable) const(int) aHiaHi + (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) int anchored_overlays_place_reference.PlacementPolicy.sideOffsetthe gutter, in cells, applied BEFORE testing
sideOffset) : ((local variable) const(int) aLoaLo - (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) int anchored_overlays_place_reference.PlacementPolicy.sideOffsetthe gutter, in cells, applied BEFORE testing
sideOffset) - (local variable) const(int) bLobLo;
int (local variable) int otherother = (local variable) bool atEndatEnd ? ((local variable) const(int) aLoaLo - (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) int anchored_overlays_place_reference.PlacementPolicy.sideOffsetthe gutter, in cells, applied BEFORE testing
sideOffset) - (local variable) const(int) bLobLo : (local variable) const(int) bHibHi - ((local variable) const(int) aHiaHi + (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) int anchored_overlays_place_reference.PlacementPolicy.sideOffsetthe gutter, in cells, applied BEFORE testing
sideOffset);
(enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust (local variable) anchored_overlays_place_reference.Adjust appliedapplied = (enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.none = cast(ubyte)0unone;
bool (local variable) bool flippedMainflippedMain;
if ((local variable) const(int) mainWantmainWant > (local variable) int roomroom && (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjustThe default is the proposal's popupCollision: flip the side axis, slide
the edge axis, cap the height. Side-axis slide and cross-axis flip are
opt-in, because both detach the overlay from its anchor.
adjust.bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
has((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.flipMain = cast(ubyte)1ucross to the opposite side of the anchor
flipMain))
{
const (local variable) const(bool) acceptaccept = (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) anchored_overlays_place_reference.FlipAcceptance anchored_overlays_place_reference.PlacementPolicy.acceptanceacceptance == (enum) anchored_overlays_place_reference.FlipAcceptanceThe genuine fork the survey found: GTK4 accepts a flip when it is less bad;
xdg_positioner reverts unless the flipped position is fully unconstrained.
FlipAcceptance.(enum value) anchored_overlays_place_reference.FlipAcceptance.revertUnlessFree = cast(ubyte)0urevertUnlessFree
? (local variable) const(int) mainWantmainWant <= (local variable) int otherother // xdg: revert unless the flip is FULLY free
: (local variable) int otherother > (local variable) int roomroom; // gtk4: accept whenever it is less bad
if ((local variable) const(bool) acceptaccept)
{
(local variable) bool flippedMainflippedMain = true;
(local variable) bool atEndatEnd = !(local variable) bool atEndatEnd;
const (local variable) const(int) swapswap = (local variable) int roomroom;
(local variable) int roomroom = (local variable) int otherother;
(local variable) int otherother = (local variable) const(int) swapswap;
(local variable) anchored_overlays_place_reference.Adjust appliedapplied = (local variable) anchored_overlays_place_reference.Adjust appliedapplied.anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.plus(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
plus((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.flipMain = cast(ubyte)1ucross to the opposite side of the anchor
flipMain);
}
}
int (local variable) int mainLenmainLen = (local variable) const(int) mainWantmainWant;
if ((local variable) int mainLenmainLen > (local variable) int roomroom && (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjustThe default is the proposal's popupCollision: flip the side axis, slide
the edge axis, cap the height. Side-axis slide and cross-axis flip are
opt-in, because both detach the overlay from its anchor.
adjust.bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
has((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.resizeMain = cast(ubyte)16ushrink to the room at the resolved side
resizeMain))
{
(local variable) int mainLenmainLen = (local variable) int roomroom > 1 ? (local variable) int roomroom : 1;
(local variable) anchored_overlays_place_reference.Adjust appliedapplied = (local variable) anchored_overlays_place_reference.Adjust appliedapplied.anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.plus(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
plus((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.resizeMain = cast(ubyte)16ushrink to the room at the resolved side
resizeMain);
}
int (local variable) int mainPosmainPos = (local variable) bool atEndatEnd ? (local variable) const(int) aHiaHi + (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) int anchored_overlays_place_reference.PlacementPolicy.sideOffsetthe gutter, in cells, applied BEFORE testing
sideOffset : (local variable) const(int) aLoaLo - (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) int anchored_overlays_place_reference.PlacementPolicy.sideOffsetthe gutter, in cells, applied BEFORE testing
sideOffset - (local variable) int mainLenmainLen;
const int (local variable) const(int) mainAskedmainAsked = (local variable) int mainPosmainPos;
if ((local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjustThe default is the proposal's popupCollision: flip the side axis, slide
the edge axis, cap the height. Side-axis slide and cross-axis flip are
opt-in, because both detach the overlay from its anchor.
adjust.bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
has((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.slideMain = cast(ubyte)2ushift along the side axis (detaches; opt-in)
slideMain) && (local variable) int mainPosmainPos + (local variable) int mainLenmainLen > (local variable) const(int) bHibHi)
(local variable) int mainPosmainPos = (local variable) const(int) bHibHi - (local variable) int mainLenmainLen;
if ((local variable) int mainPosmainPos < (local variable) const(int) bLobLo)
(local variable) int mainPosmainPos = (local variable) const(int) bLobLo; // the START pin — to the boundary, not to 0
if ((local variable) int mainPosmainPos != (local variable) const(int) mainAskedmainAsked)
(local variable) anchored_overlays_place_reference.Adjust appliedapplied = (local variable) anchored_overlays_place_reference.Adjust appliedapplied.anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.plus(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
plus((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.slideMain = cast(ubyte)2ushift along the side axis (detaches; opt-in)
slideMain);
// --- cross (edge) axis -------------------------------------------------
const int (local variable) const(int) cbLocbLo = (local variable) const(bool) verticalvertical ? (parameter) const(sparkles.ui.geometry.Rect) boundaryboundary.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x : (parameter) const(sparkles.ui.geometry.Rect) boundaryboundary.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y;
const int (local variable) const(int) cbHicbHi = (local variable) const(bool) verticalvertical ? (parameter) const(sparkles.ui.geometry.Rect) boundaryboundary.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right : (parameter) const(sparkles.ui.geometry.Rect) boundaryboundary.int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
bottom;
const int (local variable) const(int) caLocaLo = (local variable) const(bool) verticalvertical ? (parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x : (parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y;
const int (local variable) const(int) caHicaHi = (local variable) const(bool) verticalvertical ? (parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right : (parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
bottom;
const int (local variable) const(int) crossWantcrossWant = (local variable) const(bool) verticalvertical ? (parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) contentcontent.(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).widthwidth : (parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) contentcontent.(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).heightheight;
int (local variable) int crossLencrossLen = (local variable) const(int) crossWantcrossWant;
if ((local variable) int crossLencrossLen > (local variable) const(int) cbHicbHi - (local variable) const(int) cbLocbLo && (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjustThe default is the proposal's popupCollision: flip the side axis, slide
the edge axis, cap the height. Side-axis slide and cross-axis flip are
opt-in, because both detach the overlay from its anchor.
adjust.bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
has((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.resizeCross = cast(ubyte)32ushrink to the boundary's cross extent (opt-in)
resizeCross))
{
(local variable) int crossLencrossLen = (local variable) const(int) cbHicbHi - (local variable) const(int) cbLocbLo;
(local variable) anchored_overlays_place_reference.Adjust appliedapplied = (local variable) anchored_overlays_place_reference.Adjust appliedapplied.anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.plus(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
plus((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.resizeCross = cast(ubyte)32ushrink to the boundary's cross extent (opt-in)
resizeCross);
}
int int anchored_overlays_place_reference.place.alignedAt(anchored_overlays_place_reference.Align a) pure nothrow @nogc @safealignedAt((enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align (parameter) anchored_overlays_place_reference.Align aa) => (parameter) anchored_overlays_place_reference.Align aa == (enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align.(enum value) anchored_overlays_place_reference.Align.start = cast(ubyte)0ustart
? (local variable) const(int) caLocaLo
: ((parameter) anchored_overlays_place_reference.Align aa == (enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align.(enum value) anchored_overlays_place_reference.Align.end = 2end ? (local variable) const(int) caHicaHi - (local variable) int crossLencrossLen : (local variable) const(int) caLocaLo + (((local variable) const(int) caHicaHi - (local variable) const(int) caLocaLo) - (local variable) int crossLencrossLen) / 2);
(enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align (local variable) anchored_overlays_place_reference.Align align_align_ = (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacementPolicy.align_the preferred cross-axis alignment
align_;
int (local variable) int crossPoscrossPos = int anchored_overlays_place_reference.place.alignedAt(anchored_overlays_place_reference.Align a) pure nothrow @nogc @safealignedAt((local variable) anchored_overlays_place_reference.Align align_align_) + (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) int anchored_overlays_place_reference.PlacementPolicy.alignOffseta nudge along the edge axis, in cells
alignOffset;
// RTL mirroring already happened in `physical`; report it as a cross flip.
bool (local variable) bool flippedCrossflippedCross = (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacementPolicy.align_the preferred cross-axis alignment
align_ != (parameter) const(anchored_overlays_place_reference.PlacementPolicy) policypolicy.(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacementPolicy.align_the preferred cross-axis alignment
align_;
if ((local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjustThe default is the proposal's popupCollision: flip the side axis, slide
the edge axis, cap the height. Side-axis slide and cross-axis flip are
opt-in, because both detach the overlay from its anchor.
adjust.bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
has((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.flipCross = cast(ubyte)4umirror the alignment (opt-in; Floating UI's rule)
flipCross) && ((local variable) int crossPoscrossPos < (local variable) const(int) cbLocbLo || (local variable) int crossPoscrossPos + (local variable) int crossLencrossLen > (local variable) const(int) cbHicbHi))
{
const (local variable) const(anchored_overlays_place_reference.Align) mm = anchored_overlays_place_reference.Align anchored_overlays_place_reference.mirror(anchored_overlays_place_reference.Align a) pure nothrow @nogc @safeThe mirrored alignment. center is its own mirror.
mirror((local variable) anchored_overlays_place_reference.Align align_align_);
const (local variable) const(int) mpmp = int anchored_overlays_place_reference.place.alignedAt(anchored_overlays_place_reference.Align a) pure nothrow @nogc @safealignedAt((local variable) const(anchored_overlays_place_reference.Align) mm) + (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) int anchored_overlays_place_reference.PlacementPolicy.alignOffseta nudge along the edge axis, in cells
alignOffset;
if ((local variable) const(int) mpmp >= (local variable) const(int) cbLocbLo && (local variable) const(int) mpmp + (local variable) int crossLencrossLen <= (local variable) const(int) cbHicbHi)
{
(local variable) anchored_overlays_place_reference.Align align_align_ = (local variable) const(anchored_overlays_place_reference.Align) mm;
(local variable) int crossPoscrossPos = (local variable) const(int) mpmp;
(local variable) bool flippedCrossflippedCross = !(local variable) bool flippedCrossflippedCross;
(local variable) anchored_overlays_place_reference.Adjust appliedapplied = (local variable) anchored_overlays_place_reference.Adjust appliedapplied.anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.plus(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
plus((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.flipCross = cast(ubyte)4umirror the alignment (opt-in; Floating UI's rule)
flipCross);
}
}
const int (local variable) const(int) crossAskedcrossAsked = (local variable) int crossPoscrossPos;
if ((local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjustThe default is the proposal's popupCollision: flip the side axis, slide
the edge axis, cap the height. Side-axis slide and cross-axis flip are
opt-in, because both detach the overlay from its anchor.
adjust.bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
has((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.slideCross = cast(ubyte)8ushift along the edge axis
slideCross) && (local variable) int crossPoscrossPos + (local variable) int crossLencrossLen > (local variable) const(int) cbHicbHi)
(local variable) int crossPoscrossPos = (local variable) const(int) cbHicbHi - (local variable) int crossLencrossLen; // end edge first …
if ((local variable) int crossPoscrossPos < (local variable) const(int) cbLocbLo)
(local variable) int crossPoscrossPos = (local variable) const(int) cbLocbLo; // … START pin last, so the start edge wins
if ((local variable) int crossPoscrossPos != (local variable) const(int) crossAskedcrossAsked)
(local variable) anchored_overlays_place_reference.Adjust appliedapplied = (local variable) anchored_overlays_place_reference.Adjust appliedapplied.anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.plus(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
plus((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.slideCross = cast(ubyte)8ushift along the edge axis
slideCross);
const (local variable) const(sparkles.ui.geometry.Rect) rectrect = (local variable) const(bool) verticalvertical
? (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(sparkles.ui.geometry.Rect sparkles.ui.geometry.Rect.this(int x, int y, int width, int height) pure nothrow @nogc ref @safeFrom an origin + extent, or from the four components directly (the
spelling every call site uses).
crossPos, (local variable) int mainPosmainPos, (local variable) int crossLencrossLen, (local variable) int mainLenmainLen)
: (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(sparkles.ui.geometry.Rect sparkles.ui.geometry.Rect.this(int x, int y, int width, int height) pure nothrow @nogc ref @safeFrom an origin + extent, or from the four components directly (the
spelling every call site uses).
mainPos, (local variable) int crossPoscrossPos, (local variable) int mainLenmainLen, (local variable) int crossLencrossLen);
// --- the arrow ---------------------------------------------------------
// The attached edge always runs along the cross axis, so the arrow is one
// integer: an overlay-local index into that edge, clamped strictly inside it
// so it can never overwrite a corner glyph (the unclamped `arrowOffset`
// defect, D4.C3). A 1x1 anchor can invert the interval if the edge is too
// short to hold an arrow, so assert rather than trust the clamp (D1.C8).
int (local variable) int arrowCellarrowCell = -1;
bool (local variable) bool arrowCentredarrowCentred;
if ((parameter) const(anchored_overlays_place_reference.PlacementPolicy) policypolicy.(field) bool anchored_overlays_place_reference.PlacementPolicy.arrowreserve an arrow cell on the attached edge
arrow && (local variable) int crossLencrossLen >= 3)
{
const int (local variable) const(int) lolo = 1, (local variable) const(int) hihi = (local variable) int crossLencrossLen - 2;
assert((local variable) const(int) lolo <= (local variable) const(int) hihi, "an arrow interval must never invert");
const int (local variable) const(int) wantwant = (local variable) const(int) caLocaLo + ((local variable) const(int) caHicaHi - (local variable) const(int) caLocaLo) / 2 - (local variable) int crossPoscrossPos;
(local variable) int arrowCellarrowCell = (local variable) const(int) wantwant < (local variable) const(int) lolo ? (local variable) const(int) lolo : ((local variable) const(int) wantwant > (local variable) const(int) hihi ? (local variable) const(int) hihi : (local variable) const(int) wantwant);
(local variable) bool arrowCentredarrowCentred = (local variable) int arrowCellarrowCell == (local variable) const(int) wantwant;
}
const (local variable) const(bool) insideinside = (parameter) const(sparkles.ui.geometry.Rect) boundaryboundary.sparkles.ui.geometry.Rect sparkles.ui.geometry.Rect.intersection(in sparkles.ui.geometry.Rect other) const pure nothrow @nogc @safeThe overlap of two rectangles (an empty one when disjoint).
intersection((local variable) const(sparkles.ui.geometry.Rect) rectrect) == bool sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]).opEquals(in sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]) rhs) const pure nothrow @nogc @safeComponent-wise equality (compares the backing components directly, so it is
well-defined despite the union — the compiler-generated == over a union
is not).
rect;
const (local variable) const(anchored_overlays_place_reference.Fit) fitfit = !(local variable) const(bool) insideinside
? (enum) anchored_overlays_place_reference.FitHow good the resulting placement is, worst-wins.
Fit.(enum value) anchored_overlays_place_reference.Fit.overflowing = 4it does not fit and we are the host — nobody clips for us
overflowing
: (local variable) anchored_overlays_place_reference.Adjust appliedapplied.bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
has((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.resizeMain = cast(ubyte)16ushrink to the room at the resolved side
resizeMain) || (local variable) anchored_overlays_place_reference.Adjust appliedapplied.bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
has((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.resizeCross = cast(ubyte)32ushrink to the boundary's cross extent (opt-in)
resizeCross)
? (enum) anchored_overlays_place_reference.FitHow good the resulting placement is, worst-wins.
Fit.(enum value) anchored_overlays_place_reference.Fit.shrunk = 3the content was capped
shrunk
: (local variable) bool flippedMainflippedMain || (local variable) anchored_overlays_place_reference.Adjust appliedapplied.bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
has((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.flipCross = cast(ubyte)4umirror the alignment (opt-in; Floating UI's rule)
flipCross)
? (enum) anchored_overlays_place_reference.FitHow good the resulting placement is, worst-wins.
Fit.(enum value) anchored_overlays_place_reference.Fit.flipped = 2crossed to the other side of the anchor
flipped
: (local variable) anchored_overlays_place_reference.Adjust appliedapplied.bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
has((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.slideCross = cast(ubyte)8ushift along the edge axis
slideCross) || (local variable) anchored_overlays_place_reference.Adjust appliedapplied.bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
has((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.slideMain = cast(ubyte)2ushift along the side axis (detaches; opt-in)
slideMain)
? (enum) anchored_overlays_place_reference.FitHow good the resulting placement is, worst-wins.
Fit.(enum value) anchored_overlays_place_reference.Fit.slid = 1shifted along an axis to stay inside
slid
: (enum) anchored_overlays_place_reference.FitHow good the resulting placement is, worst-wins.
Fit.(enum value) anchored_overlays_place_reference.Fit.exact = cast(ubyte)0uplaced as asked
exact;
return (struct) anchored_overlays_place_reference.PlacedOverlayThe placement result: geometry metadata, not a point. Every field here is
one a backend or an emitter would otherwise have to re-derive — which is exactly
what ../compose.md, ../avalonia.md and hue's
three clampOrigin call sites each ended up doing, differently.
PlacedOverlay(
rect: (local variable) const(sparkles.ui.geometry.Rect) rectrect,
side: (local variable) bool flippedMainflippedMain ? anchored_overlays_place_reference.Side anchored_overlays_place_reference.opposite(anchored_overlays_place_reference.Side s) pure nothrow @nogc @safeThe opposite side, for a main-axis flip.
opposite((local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.sidethe preferred anchor edge
side) : (local variable) const(anchored_overlays_place_reference.PlacementPolicy) reqreq.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.sidethe preferred anchor edge
side,
align_: (local variable) anchored_overlays_place_reference.Align align_align_,
arrowCell: (local variable) int arrowCellarrowCell,
arrowCentred: (local variable) bool arrowCentredarrowCentred,
flippedMain: (local variable) bool flippedMainflippedMain,
flippedCross: (local variable) bool flippedCrossflippedCross,
anchorHidden: (parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor.bool anchored_overlays_place_reference.Anchor.hidden() const pure nothrow @nogc @safeThe anchor left its clip entirely — a HIDE verdict, not a close.
hidden,
available: (local variable) const(bool) verticalvertical ? (struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).this(int[2] values...) pure nothrow @nogc ref @safeInitializes the first i components from constructor arguments.
cbHi - (local variable) const(int) cbLocbLo, (local variable) int roomroom) : (struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).this(int[2] values...) pure nothrow @nogc ref @safeInitializes the first i components from constructor arguments.
room, (local variable) const(int) cbHicbHi - (local variable) const(int) cbLocbLo),
applied: (local variable) anchored_overlays_place_reference.Adjust appliedapplied,
fit: (local variable) const(anchored_overlays_place_reference.Fit) fitfit,
);
}
/**
`clampOrigin` as `libs/twoslash/src/sparkles/twoslash/render_widgets.d:430` has
it today — one axis, one direction, against a **scalar** extent, floored at zero.
Reproduced verbatim so case 9 can print the divergence rather than describe it.
*/
int int anchored_overlays_place_reference.clampOriginToday(int anchor, int width, int extent) pure nothrow @nogc @safeclampOrigin as libs/twoslash/src/sparkles/twoslash/render_widgets.d:430 has
it today — one axis, one direction, against a scalar extent, floored at zero.
Reproduced verbatim so case 9 can print the divergence rather than describe it.
clampOriginToday(int (parameter) int anchoranchor, int (parameter) int widthwidth, int (parameter) int extentextent) @safe pure nothrow @nogc
{
const (local variable) const(int) overover = (parameter) int anchoranchor + (parameter) int widthwidth - (parameter) int extentextent;
const (local variable) const(int) shiftedshifted = (local variable) const(int) overover > 0 ? (parameter) int anchoranchor - (local variable) const(int) overover : (parameter) int anchoranchor;
return (local variable) const(int) shiftedshifted < 0 ? 0 : (local variable) const(int) shiftedshifted;
}
// ---------------------------------------------------------------------------
// The invariants — asserted for every case, so this is an oracle
// ---------------------------------------------------------------------------
void void anchored_overlays_place_reference.checkInvariants(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy, in anchored_overlays_place_reference.PlacedOverlay r) @safecheckInvariants(in (struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor (parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor, in (struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size (parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) contentcontent, in (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect (parameter) const(sparkles.ui.geometry.Rect) boundaryboundary,
in (struct) anchored_overlays_place_reference.PlacementPolicyThe placement request. Never written back to by the solver (D15.C6): what
the caller asked for stays readable next to what it got.
PlacementPolicy (parameter) const(anchored_overlays_place_reference.PlacementPolicy) policypolicy, in (struct) anchored_overlays_place_reference.PlacedOverlayThe placement result: geometry metadata, not a point. Every field here is
one a backend or an emitter would otherwise have to re-derive — which is exactly
what ../compose.md, ../avalonia.md and hue's
three clampOrigin call sites each ended up doing, differently.
PlacedOverlay (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr) @safe
{
// I1. The start edge pins to the BOUNDARY. This is the whole clamp-to-zero
// defect: it must hold for a boundary that starts anywhere, including
// at negative coordinates (content scrolled above/left of a viewport).
assert((parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x >= (parameter) const(sparkles.ui.geometry.Rect) boundaryboundary.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x && (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y >= (parameter) const(sparkles.ui.geometry.Rect) boundaryboundary.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y,
"placed rect escaped the boundary's start edge");
// I2. Whenever it fits, it is fully inside.
if ((parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fitthe worst thing that happened
fit != (enum) anchored_overlays_place_reference.FitHow good the resulting placement is, worst-wins.
Fit.(enum value) anchored_overlays_place_reference.Fit.overflowing = 4it does not fit and we are the host — nobody clips for us
overflowing)
assert((parameter) const(sparkles.ui.geometry.Rect) boundaryboundary.sparkles.ui.geometry.Rect sparkles.ui.geometry.Rect.intersection(in sparkles.ui.geometry.Rect other) const pure nothrow @nogc @safeThe overlap of two rectangles (an empty one when disjoint).
intersection((parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect) == bool sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]).opEquals(in sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]) rhs) const pure nothrow @nogc @safeComponent-wise equality (compares the backing components directly, so it is
well-defined despite the union — the compiler-generated == over a union
is not).
r.bool sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]).opEquals(in sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]) rhs) const pure nothrow @nogc @safeComponent-wise equality (compares the backing components directly, so it is
well-defined despite the union — the compiler-generated == over a union
is not).
rect,
"a non-overflowing placement must be inside the boundary");
// I3. The arrow is strictly inside the attached edge — never on a corner.
const (local variable) const(bool) verticalvertical = (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.sidepost-flip anchor edge we attached to
side == (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.top = cast(ubyte)0uabove the anchor
top || (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.sidepost-flip anchor edge we attached to
side == (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.bottom = 1below the anchor
bottom;
const (local variable) const(int) edgeLenedgeLen = (local variable) const(bool) verticalvertical ? (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
width : (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.height() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
height;
if ((parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCelloverlay-local index along the attached edge; -1 = none
arrowCell >= 0)
{
assert((parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCelloverlay-local index along the attached edge; -1 = none
arrowCell >= 1 && (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCelloverlay-local index along the attached edge; -1 = none
arrowCell <= (local variable) const(int) edgeLenedgeLen - 2,
"the arrow cell overwrote a corner of the overlay's edge");
// …and when it reached the anchor, it really points at it.
if ((parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) bool anchored_overlays_place_reference.PlacedOverlay.arrowCentredfalse ⇒ the arrow could not reach the anchor's centre
arrowCentred)
{
const (local variable) const(int) basebase = (local variable) const(bool) verticalvertical ? (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x : (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y;
const (local variable) const(int) aLoaLo = (local variable) const(bool) verticalvertical ? (parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x : (parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y;
const (local variable) const(int) aHiaHi = (local variable) const(bool) verticalvertical ? (parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right : (parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
bottom;
assert((local variable) const(int) basebase + (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCelloverlay-local index along the attached edge; -1 = none
arrowCell == (local variable) const(int) aLoaLo + ((local variable) const(int) aHiaHi - (local variable) const(int) aLoaLo) / 2,
"a centred arrow must land on the anchor's centre cell");
}
}
// I4. Flipping is idempotent: re-placing at the RESOLVED side and alignment
// (physical, so RTL is already resolved) reproduces the same geometry
// and reports no further flip. A solver that fails this oscillates.
(struct) anchored_overlays_place_reference.PlacementPolicyThe placement request. Never written back to by the solver (D15.C6): what
the caller asked for stays readable next to what it got.
PlacementPolicy (local variable) anchored_overlays_place_reference.PlacementPolicy againagain = (parameter) const(anchored_overlays_place_reference.PlacementPolicy) policypolicy;
(local variable) anchored_overlays_place_reference.PlacementPolicy againagain.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.sidethe preferred anchor edge
side = (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.sidepost-flip anchor edge we attached to
side;
(local variable) anchored_overlays_place_reference.PlacementPolicy againagain.(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacementPolicy.align_the preferred cross-axis alignment
align_ = (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacedOverlay.align_post-flip, post-RTL cross alignment
align_;
(local variable) anchored_overlays_place_reference.PlacementPolicy againagain.(field) anchored_overlays_place_reference.Direction anchored_overlays_place_reference.PlacementPolicy.directionresolved away before the solve
direction = (enum) anchored_overlays_place_reference.DirectionReading direction. An input to the resolution step, never a flag consulted
inside the solver.
Direction.(enum value) anchored_overlays_place_reference.Direction.ltr = cast(ubyte)0ultr;
(local variable) anchored_overlays_place_reference.PlacementPolicy againagain.(field) int anchored_overlays_place_reference.PlacementPolicy.alignOffseta nudge along the edge axis, in cells
alignOffset = (parameter) const(anchored_overlays_place_reference.PlacementPolicy) policypolicy.(field) anchored_overlays_place_reference.Direction anchored_overlays_place_reference.PlacementPolicy.directionresolved away before the solve
direction == (enum) anchored_overlays_place_reference.DirectionReading direction. An input to the resolution step, never a flag consulted
inside the solver.
Direction.(enum value) anchored_overlays_place_reference.Direction.rtl = 1rtl
? -(parameter) const(anchored_overlays_place_reference.PlacementPolicy) policypolicy.(field) int anchored_overlays_place_reference.PlacementPolicy.alignOffseta nudge along the edge axis, in cells
alignOffset : (parameter) const(anchored_overlays_place_reference.PlacementPolicy) policypolicy.(field) int anchored_overlays_place_reference.PlacementPolicy.alignOffseta nudge along the edge axis, in cells
alignOffset;
const (local variable) const(anchored_overlays_place_reference.PlacedOverlay) twicetwice = anchored_overlays_place_reference.PlacedOverlay anchored_overlays_place_reference.place(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy) pure nothrow @nogc @safePlace content against anchor inside boundary, under policy.
Per-axis and total: the main (side) axis flips then optionally resizes; the
cross* (edge) axis aligns, optionally mirrors, then slides — end edge first,
start edge last, so an overlay larger than the boundary pins its start and
overflows its end. The start pin is against boundary, not against 0.
place((parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor, (parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) contentcontent, (parameter) const(sparkles.ui.geometry.Rect) boundaryboundary, (local variable) anchored_overlays_place_reference.PlacementPolicy againagain);
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) twicetwice.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect == bool sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]).opEquals(in sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]) rhs) const pure nothrow @nogc @safeComponent-wise equality (compares the backing components directly, so it is
well-defined despite the union — the compiler-generated == over a union
is not).
r.bool sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]).opEquals(in sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]) rhs) const pure nothrow @nogc @safeComponent-wise equality (compares the backing components directly, so it is
well-defined despite the union — the compiler-generated == over a union
is not).
rect, "re-placement moved the overlay");
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) twicetwice.(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCelloverlay-local index along the attached edge; -1 = none
arrowCell == (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCelloverlay-local index along the attached edge; -1 = none
arrowCell, "re-placement moved the arrow");
assert(!(local variable) const(anchored_overlays_place_reference.PlacedOverlay) twicetwice.(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedMainthe side axis crossed to the other side of the anchor
flippedMain && !(local variable) const(anchored_overlays_place_reference.PlacedOverlay) twicetwice.(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedCrossthe alignment was mirrored (RTL resolution, or flipCross)
flippedCross, "re-placement flipped again");
}
// ---------------------------------------------------------------------------
// Rendering the result as cells
// ---------------------------------------------------------------------------
/// A character grid covering `world`, so a placement can be *seen*.
struct (struct) anchored_overlays_place_reference.GridA character grid covering world, so a placement can be seen.
Grid
{
enum int (constant) int anchored_overlays_place_reference.Grid.maxW = 96maxW = 96, (constant) int anchored_overlays_place_reference.Grid.maxH = 40maxH = 40;
(struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect (field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Grid.worldworld;
char[(constant) int anchored_overlays_place_reference.Grid.maxW = 96maxW * (constant) int anchored_overlays_place_reference.Grid.maxH = 40maxH] (field) char[3840] anchored_overlays_place_reference.Grid.cellscells = '.';
@safe pure nothrow @nogc:
this(in (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect (parameter) const(sparkles.ui.geometry.Rect) worldworld)
in ((parameter) const(sparkles.ui.geometry.Rect) worldworld.int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
width > 0 && (parameter) const(sparkles.ui.geometry.Rect) worldworld.int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
width <= (constant) int anchored_overlays_place_reference.Grid.maxW = 96maxW, "world too wide to draw")
in ((parameter) const(sparkles.ui.geometry.Rect) worldworld.int sparkles.ui.geometry.Rect.height() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
height > 0 && (parameter) const(sparkles.ui.geometry.Rect) worldworld.int sparkles.ui.geometry.Rect.height() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
height <= (constant) int anchored_overlays_place_reference.Grid.maxH = 40maxH, "world too tall to draw")
{
this.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Grid.worldworld = (parameter) const(sparkles.ui.geometry.Rect) worldworld;
(field) char[3840] anchored_overlays_place_reference.Grid.cellscells[] = '.';
}
void void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safeset(int (parameter) int xx, int (parameter) int yy, char (parameter) char cc) scope
{
if ((field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Grid.worldworld.bool sparkles.ui.geometry.Rect.contains(in sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]) p) const pure nothrow @nogc @safetrue iff p lies inside the half-open rectangle.
contains((struct) sparkles.math.vector.Vector!(int, 2LU, ["x", "y"])Point(sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]) sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]).this(int[2] values...) pure nothrow @nogc ref @safeInitializes the first i components from constructor arguments.
x, sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]) sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]).this(int[2] values...) pure nothrow @nogc ref @safeInitializes the first i components from constructor arguments.
y)))
(field) char[3840] anchored_overlays_place_reference.Grid.cellscells[((parameter) int yy - (field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Grid.worldworld.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y) * (constant) int anchored_overlays_place_reference.Grid.maxW = 96maxW + ((parameter) int xx - (field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Grid.worldworld.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x)] = (parameter) char cc;
}
void void anchored_overlays_place_reference.Grid.fill(in sparkles.ui.geometry.Rect r, char c) pure nothrow @nogc @safefill(in (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect (parameter) const(sparkles.ui.geometry.Rect) rr, char (parameter) char cc) scope
{
foreach ((local variable) int yy; (parameter) const(sparkles.ui.geometry.Rect) rr.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y .. (parameter) const(sparkles.ui.geometry.Rect) rr.int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
bottom)
foreach ((local variable) int xx; (parameter) const(sparkles.ui.geometry.Rect) rr.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x .. (parameter) const(sparkles.ui.geometry.Rect) rr.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right)
void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safeset((local variable) int xx, (local variable) int yy, (parameter) char cc);
}
}
/// The union of two rectangles (either may be empty).
(struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect sparkles.ui.geometry.Rect anchored_overlays_place_reference.unite(in sparkles.ui.geometry.Rect a, in sparkles.ui.geometry.Rect b) pure nothrow @nogc @safeThe union of two rectangles (either may be empty).
unite(in (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect (parameter) const(sparkles.ui.geometry.Rect) aa, in (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect (parameter) const(sparkles.ui.geometry.Rect) bb) @safe pure nothrow @nogc
{
if ((parameter) const(sparkles.ui.geometry.Rect) aa.bool sparkles.ui.geometry.Rect.empty() const pure nothrow @nogc @safetrue iff the rectangle covers no cells.
empty)
return (parameter) const(sparkles.ui.geometry.Rect) bb;
if ((parameter) const(sparkles.ui.geometry.Rect) bb.bool sparkles.ui.geometry.Rect.empty() const pure nothrow @nogc @safetrue iff the rectangle covers no cells.
empty)
return (parameter) const(sparkles.ui.geometry.Rect) aa;
const (local variable) const(int) x0x0 = (parameter) const(sparkles.ui.geometry.Rect) aa.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x < (parameter) const(sparkles.ui.geometry.Rect) bb.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x ? (parameter) const(sparkles.ui.geometry.Rect) aa.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x : (parameter) const(sparkles.ui.geometry.Rect) bb.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x;
const (local variable) const(int) y0y0 = (parameter) const(sparkles.ui.geometry.Rect) aa.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y < (parameter) const(sparkles.ui.geometry.Rect) bb.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y ? (parameter) const(sparkles.ui.geometry.Rect) aa.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y : (parameter) const(sparkles.ui.geometry.Rect) bb.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y;
const (local variable) const(int) x1x1 = (parameter) const(sparkles.ui.geometry.Rect) aa.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right > (parameter) const(sparkles.ui.geometry.Rect) bb.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right ? (parameter) const(sparkles.ui.geometry.Rect) aa.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right : (parameter) const(sparkles.ui.geometry.Rect) bb.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right;
const (local variable) const(int) y1y1 = (parameter) const(sparkles.ui.geometry.Rect) aa.int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
bottom > (parameter) const(sparkles.ui.geometry.Rect) bb.int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
bottom ? (parameter) const(sparkles.ui.geometry.Rect) aa.int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
bottom : (parameter) const(sparkles.ui.geometry.Rect) bb.int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
bottom;
return (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(sparkles.ui.geometry.Rect sparkles.ui.geometry.Rect.this(int x, int y, int width, int height) pure nothrow @nogc ref @safeFrom an origin + extent, or from the four components directly (the
spelling every call site uses).
x0, sparkles.ui.geometry.Rect sparkles.ui.geometry.Rect.this(int x, int y, int width, int height) pure nothrow @nogc ref @safeFrom an origin + extent, or from the four components directly (the
spelling every call site uses).
y0, (local variable) const(int) x1x1 - (local variable) const(int) x0x0, (local variable) const(int) y1y1 - (local variable) const(int) y0y0);
}
/// `r` grown by `n` cells on every side.
(struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect sparkles.ui.geometry.Rect anchored_overlays_place_reference.inflate(in sparkles.ui.geometry.Rect r, int n) pure nothrow @nogc @safer grown by n cells on every side.
inflate(in (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect (parameter) const(sparkles.ui.geometry.Rect) rr, int (parameter) int nn) @safe pure nothrow @nogc
=> (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(sparkles.ui.geometry.Rect sparkles.ui.geometry.Rect.this(int x, int y, int width, int height) pure nothrow @nogc ref @safeFrom an origin + extent, or from the four components directly (the
spelling every call site uses).
r.sparkles.ui.geometry.Rect sparkles.ui.geometry.Rect.this(int x, int y, int width, int height) pure nothrow @nogc ref @safeFrom an origin + extent, or from the four components directly (the
spelling every call site uses).
x - (parameter) int nn, (parameter) const(sparkles.ui.geometry.Rect) rr.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y - (parameter) int nn, (parameter) const(sparkles.ui.geometry.Rect) rr.int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
width + 2 * (parameter) int nn, (parameter) const(sparkles.ui.geometry.Rect) rr.int sparkles.ui.geometry.Rect.height() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
height + 2 * (parameter) int nn);
/// The arrow glyph for the edge the overlay attached along.
char char anchored_overlays_place_reference.arrowGlyph(anchored_overlays_place_reference.Side s) pure nothrow @nogc @safeThe arrow glyph for the edge the overlay attached along.
arrowGlyph((enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side (parameter) anchored_overlays_place_reference.Side ss) @safe pure nothrow @nogc
{
final switch ((parameter) anchored_overlays_place_reference.Side ss)
{
case (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.bottom = 1below the anchor
bottom: return '^'; // overlay below ⇒ arrow on its top edge
case (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.top = cast(ubyte)0uabove the anchor
top: return 'v';
case (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.right = 3right of the anchor
right: return '<';
case (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.left = 2left of the anchor
left: return '>';
}
}
/// Paint the boundary frame, the anchor and the placed overlay into one grid.
(struct) anchored_overlays_place_reference.GridA character grid covering world, so a placement can be seen.
Grid anchored_overlays_place_reference.Grid anchored_overlays_place_reference.draw(in anchored_overlays_place_reference.Anchor anchor, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacedOverlay r) pure nothrow @nogc @safePaint the boundary frame, the anchor and the placed overlay into one grid.
draw(in (struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor (parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor, in (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect (parameter) const(sparkles.ui.geometry.Rect) boundaryboundary, in (struct) anchored_overlays_place_reference.PlacedOverlayThe placement result: geometry metadata, not a point. Every field here is
one a backend or an emitter would otherwise have to re-derive — which is exactly
what ../compose.md, ../avalonia.md and hue's
three clampOrigin call sites each ended up doing, differently.
PlacedOverlay (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr) @safe pure nothrow @nogc
{
const (local variable) const(sparkles.ui.geometry.Rect) worldworld = sparkles.ui.geometry.Rect anchored_overlays_place_reference.unite(in sparkles.ui.geometry.Rect a, in sparkles.ui.geometry.Rect b) pure nothrow @nogc @safeThe union of two rectangles (either may be empty).
unite(sparkles.ui.geometry.Rect anchored_overlays_place_reference.inflate(in sparkles.ui.geometry.Rect r, int n) pure nothrow @nogc @safer grown by n cells on every side.
inflate((parameter) const(sparkles.ui.geometry.Rect) boundaryboundary, 1), sparkles.ui.geometry.Rect anchored_overlays_place_reference.unite(in sparkles.ui.geometry.Rect a, in sparkles.ui.geometry.Rect b) pure nothrow @nogc @safeThe union of two rectangles (either may be empty).
unite((parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect, (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect));
auto (local variable) anchored_overlays_place_reference.Grid gg = (struct) anchored_overlays_place_reference.GridA character grid covering world, so a placement can be seen.
Grid(anchored_overlays_place_reference.Grid anchored_overlays_place_reference.Grid.this(in sparkles.ui.geometry.Rect world) pure nothrow @nogc ref @safeworld);
(local variable) anchored_overlays_place_reference.Grid gg.void anchored_overlays_place_reference.Grid.fill(in sparkles.ui.geometry.Rect r, char c) pure nothrow @nogc @safefill((parameter) const(sparkles.ui.geometry.Rect) boundaryboundary, ' ');
// The frame sits one cell OUTSIDE the boundary, so it never collides with
// a placed cell — everything drawn on it is genuinely out of bounds.
const (local variable) const(sparkles.ui.geometry.Rect) ff = sparkles.ui.geometry.Rect anchored_overlays_place_reference.inflate(in sparkles.ui.geometry.Rect r, int n) pure nothrow @nogc @safer grown by n cells on every side.
inflate((parameter) const(sparkles.ui.geometry.Rect) boundaryboundary, 1);
foreach ((local variable) int xx; (local variable) const(sparkles.ui.geometry.Rect) ff.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x .. (local variable) const(sparkles.ui.geometry.Rect) ff.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right)
{
(local variable) anchored_overlays_place_reference.Grid gg.void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safeset((local variable) int xx, (local variable) const(sparkles.ui.geometry.Rect) ff.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y, '-');
(local variable) anchored_overlays_place_reference.Grid gg.void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safeset((local variable) int xx, (local variable) const(sparkles.ui.geometry.Rect) ff.int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
bottom - 1, '-');
}
foreach ((local variable) int yy; (local variable) const(sparkles.ui.geometry.Rect) ff.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y .. (local variable) const(sparkles.ui.geometry.Rect) ff.int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
bottom)
{
(local variable) anchored_overlays_place_reference.Grid gg.void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safeset((local variable) const(sparkles.ui.geometry.Rect) ff.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x, (local variable) int yy, '|');
(local variable) anchored_overlays_place_reference.Grid gg.void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safeset((local variable) const(sparkles.ui.geometry.Rect) ff.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right - 1, (local variable) int yy, '|');
}
(local variable) anchored_overlays_place_reference.Grid gg.void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safeset((local variable) const(sparkles.ui.geometry.Rect) ff.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x, (local variable) const(sparkles.ui.geometry.Rect) ff.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y, '+');
(local variable) anchored_overlays_place_reference.Grid gg.void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safeset((local variable) const(sparkles.ui.geometry.Rect) ff.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right - 1, (local variable) const(sparkles.ui.geometry.Rect) ff.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y, '+');
(local variable) anchored_overlays_place_reference.Grid gg.void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safeset((local variable) const(sparkles.ui.geometry.Rect) ff.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x, (local variable) const(sparkles.ui.geometry.Rect) ff.int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
bottom - 1, '+');
(local variable) anchored_overlays_place_reference.Grid gg.void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safeset((local variable) const(sparkles.ui.geometry.Rect) ff.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right - 1, (local variable) const(sparkles.ui.geometry.Rect) ff.int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
bottom - 1, '+');
(local variable) anchored_overlays_place_reference.Grid gg.void anchored_overlays_place_reference.Grid.fill(in sparkles.ui.geometry.Rect r, char c) pure nothrow @nogc @safefill((parameter) const(anchored_overlays_place_reference.Anchor) anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect, 'A');
(local variable) anchored_overlays_place_reference.Grid gg.void anchored_overlays_place_reference.Grid.fill(in sparkles.ui.geometry.Rect r, char c) pure nothrow @nogc @safefill((parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect, '#');
if ((parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCelloverlay-local index along the attached edge; -1 = none
arrowCell >= 0)
{
const (local variable) const(char) cc = char anchored_overlays_place_reference.arrowGlyph(anchored_overlays_place_reference.Side s) pure nothrow @nogc @safeThe arrow glyph for the edge the overlay attached along.
arrowGlyph((parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.sidepost-flip anchor edge we attached to
side);
final switch ((parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.sidepost-flip anchor edge we attached to
side)
{
case (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.bottom = 1below the anchor
bottom: (local variable) anchored_overlays_place_reference.Grid gg.void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safeset((parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x + (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCelloverlay-local index along the attached edge; -1 = none
arrowCell, (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y, (local variable) const(char) cc); break;
case (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.top = cast(ubyte)0uabove the anchor
top: (local variable) anchored_overlays_place_reference.Grid gg.void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safeset((parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x + (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCelloverlay-local index along the attached edge; -1 = none
arrowCell, (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
bottom - 1, (local variable) const(char) cc); break;
case (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.right = 3right of the anchor
right: (local variable) anchored_overlays_place_reference.Grid gg.void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safeset((parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x, (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y + (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCelloverlay-local index along the attached edge; -1 = none
arrowCell, (local variable) const(char) cc); break;
case (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.left = 2left of the anchor
left: (local variable) anchored_overlays_place_reference.Grid gg.void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safeset((parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right - 1, (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y + (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCelloverlay-local index along the attached edge; -1 = none
arrowCell, (local variable) const(char) cc); break;
}
}
return (local variable) anchored_overlays_place_reference.Grid gg;
}
void void anchored_overlays_place_reference.printGrid(in anchored_overlays_place_reference.Grid g) @safeprintGrid(in (struct) anchored_overlays_place_reference.GridA character grid covering world, so a placement can be seen.
Grid (parameter) const(anchored_overlays_place_reference.Grid) gg) @safe
{
foreach ((local variable) int ii; 0 .. (parameter) const(anchored_overlays_place_reference.Grid) gg.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Grid.worldworld.int sparkles.ui.geometry.Rect.height() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
height)
{
char[(struct) anchored_overlays_place_reference.GridA character grid covering world, so a placement can be seen.
Grid.(constant) int anchored_overlays_place_reference.Grid.maxW = 96maxW] (local variable) char[96] bufbuf;
const (local variable) const(int) ww = (parameter) const(anchored_overlays_place_reference.Grid) gg.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Grid.worldworld.int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
width;
(local variable) char[96] bufbuf[0 .. (local variable) const(int) ww] = (parameter) const(anchored_overlays_place_reference.Grid) gg.(field) char[3840] anchored_overlays_place_reference.Grid.cellscells[(local variable) int ii * (struct) anchored_overlays_place_reference.GridA character grid covering world, so a placement can be seen.
Grid.(constant) int anchored_overlays_place_reference.Grid.maxW = 96maxW .. (local variable) int ii * (struct) anchored_overlays_place_reference.GridA character grid covering world, so a placement can be seen.
Grid.(constant) int anchored_overlays_place_reference.Grid.maxW = 96maxW + (local variable) const(int) ww];
void std.stdio.writeln!(string, string)(string __param_0, string __param_1) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln(" ", (local variable) char[96] bufbuf[0 .. (local variable) const(int) ww].string object.idup!char(char[] a) pure nothrow @property @safeProvide the .idup array property, which creates an immutable duplicate.
idup);
}
}
// ---------------------------------------------------------------------------
// Reporting
// ---------------------------------------------------------------------------
(alias) object.string = stringstring string anchored_overlays_place_reference.rectText(in sparkles.ui.geometry.Rect r) @saferectText(in (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect (parameter) const(sparkles.ui.geometry.Rect) rr) @safe => string std.format.format!("(%d,%d %dx%d)", int, int, int, int)(int __param_0, int __param_1, int __param_2, int __param_3) pure @safeExamples
The format string can be checked at compile-time:
auto s = format!"%s is %s"("Pi", 3.14);
assert(s == "Pi is 3.14");
// This line doesn't compile, because 3.14 cannot be formatted with %d:
// s = format!"%s is %d"("Pi", 3.14);
format!"(%d,%d %dx%d)"((parameter) const(sparkles.ui.geometry.Rect) rr.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x, (parameter) const(sparkles.ui.geometry.Rect) rr.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y, (parameter) const(sparkles.ui.geometry.Rect) rr.int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
width, (parameter) const(sparkles.ui.geometry.Rect) rr.int sparkles.ui.geometry.Rect.height() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
height);
(alias) object.string = stringstring string anchored_overlays_place_reference.adjustText(anchored_overlays_place_reference.Adjust a) @safeadjustText((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust (parameter) anchored_overlays_place_reference.Adjust aa) @safe
{
if ((parameter) anchored_overlays_place_reference.Adjust aa == (enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.none = cast(ubyte)0unone)
return "none";
(alias) object.string = stringstring (local variable) string ss;
static foreach (name; ["flipMain", "slideMain", "flipCross", "slideCross",
"resizeMain", "resizeCross"])
if ((parameter) anchored_overlays_place_reference.Adjust aa.bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
has(__traits(getMember, Adjust, name)))
(local variable) string ss ~= ((local variable) string ss.(field) ulong string.lengthlength ? "|" : "") ~ (constant) string anchored_overlays_place_reference.adjustText.name = "flipMain"name;
return (local variable) string ss;
}
/// One row of the case table.
struct (struct) anchored_overlays_place_reference.CaseOne row of the case table.
Case
{
(alias) object.string = stringstring (field) string anchored_overlays_place_reference.Case.labellabel;
(struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor (field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor;
(struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size (field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent;
(struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect (field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary;
(struct) anchored_overlays_place_reference.PlacementPolicyThe placement request. Never written back to by the solver (D15.C6): what
the caller asked for stays readable next to what it got.
PlacementPolicy (field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy;
(alias) object.string = stringstring (field) string anchored_overlays_place_reference.Case.notenote;
}
void void anchored_overlays_place_reference.report(int n, const(anchored_overlays_place_reference.Case) c, in anchored_overlays_place_reference.PlacedOverlay r) @safereport(int (parameter) int nn, const (struct) anchored_overlays_place_reference.CaseOne row of the case table.
Case (parameter) const(anchored_overlays_place_reference.Case) cc, in (struct) anchored_overlays_place_reference.PlacedOverlayThe placement result: geometry metadata, not a point. Every field here is
one a backend or an emitter would otherwise have to re-derive — which is exactly
what ../compose.md, ../avalonia.md and hue's
three clampOrigin call sites each ended up doing, differently.
PlacedOverlay (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr) @safe
{
void std.stdio.writefln!("=== %d. %s ===", int, string)(int __param_0, string __param_1) @safeEquivalent to writef(fmt, args, '\n').
writefln!"=== %d. %s ==="((parameter) int nn, (parameter) const(anchored_overlays_place_reference.Case) cc.(field) string anchored_overlays_place_reference.Case.labellabel);
void anchored_overlays_place_reference.printGrid(in anchored_overlays_place_reference.Grid g) @safeprintGrid(anchored_overlays_place_reference.Grid anchored_overlays_place_reference.draw(in anchored_overlays_place_reference.Anchor anchor, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacedOverlay r) pure nothrow @nogc @safePaint the boundary frame, the anchor and the placed overlay into one grid.
draw((parameter) const(anchored_overlays_place_reference.Case) cc.(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor, (parameter) const(anchored_overlays_place_reference.Case) cc.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary, (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr));
void std.stdio.writefln!(" ask side=%s align=%s dir=%s offset=(%d,%d) adjust=%s", const(anchored_overlays_place_reference.Side), const(anchored_overlays_place_reference.Align), const(anchored_overlays_place_reference.Direction), const(int), const(int), string)(const(anchored_overlays_place_reference.Side) __param_0, const(anchored_overlays_place_reference.Align) __param_1, const(anchored_overlays_place_reference.Direction) __param_2, const(int) __param_3, const(int) __param_4, string __param_5) @safeEquivalent to writef(fmt, args, '\n').
writefln!" ask side=%s align=%s dir=%s offset=(%d,%d) adjust=%s"(
(parameter) const(anchored_overlays_place_reference.Case) cc.(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.sidethe preferred anchor edge
side, (parameter) const(anchored_overlays_place_reference.Case) cc.(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy.(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacementPolicy.align_the preferred cross-axis alignment
align_, (parameter) const(anchored_overlays_place_reference.Case) cc.(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy.(field) anchored_overlays_place_reference.Direction anchored_overlays_place_reference.PlacementPolicy.directionresolved away before the solve
direction,
(parameter) const(anchored_overlays_place_reference.Case) cc.(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy.(field) int anchored_overlays_place_reference.PlacementPolicy.sideOffsetthe gutter, in cells, applied BEFORE testing
sideOffset, (parameter) const(anchored_overlays_place_reference.Case) cc.(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy.(field) int anchored_overlays_place_reference.PlacementPolicy.alignOffseta nudge along the edge axis, in cells
alignOffset, string anchored_overlays_place_reference.adjustText(anchored_overlays_place_reference.Adjust a) @safeadjustText((parameter) const(anchored_overlays_place_reference.Case) cc.(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy.(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjustThe default is the proposal's popupCollision: flip the side axis, slide
the edge axis, cap the height. Side-axis slide and cross-axis flip are
opt-in, because both detach the overlay from its anchor.
adjust));
void std.stdio.writefln!(" boundary %s anchor %s content %dx%d", string, string, const(int), const(int))(string __param_0, string __param_1, const(int) __param_2, const(int) __param_3) @safeEquivalent to writef(fmt, args, '\n').
writefln!" boundary %s anchor %s content %dx%d"(
string anchored_overlays_place_reference.rectText(in sparkles.ui.geometry.Rect r) @saferectText((parameter) const(anchored_overlays_place_reference.Case) cc.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary), string anchored_overlays_place_reference.rectText(in sparkles.ui.geometry.Rect r) @saferectText((parameter) const(anchored_overlays_place_reference.Case) cc.(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect), (parameter) const(anchored_overlays_place_reference.Case) cc.(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent.(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).widthwidth, (parameter) const(anchored_overlays_place_reference.Case) cc.(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent.(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).heightheight);
void std.stdio.writefln!(" got rect=%s side=%s align=%s fit=%s applied=%s", string, const(anchored_overlays_place_reference.Side), const(anchored_overlays_place_reference.Align), const(anchored_overlays_place_reference.Fit), string)(string __param_0, const(anchored_overlays_place_reference.Side) __param_1, const(anchored_overlays_place_reference.Align) __param_2, const(anchored_overlays_place_reference.Fit) __param_3, string __param_4) @safeEquivalent to writef(fmt, args, '\n').
writefln!" got rect=%s side=%s align=%s fit=%s applied=%s"(
string anchored_overlays_place_reference.rectText(in sparkles.ui.geometry.Rect r) @saferectText((parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect), (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.sidepost-flip anchor edge we attached to
side, (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacedOverlay.align_post-flip, post-RTL cross alignment
align_, (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fitthe worst thing that happened
fit, string anchored_overlays_place_reference.adjustText(anchored_overlays_place_reference.Adjust a) @safeadjustText((parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacedOverlay.appliedwhich adjustments fired
applied));
void std.stdio.writefln!(" metadata arrowCell=%d (centred %s) flippedMain=%s flippedCross=%s", const(int), string, const(bool), const(bool))(const(int) __param_0, string __param_1, const(bool) __param_2, const(bool) __param_3) @safeEquivalent to writef(fmt, args, '\n').
writefln!" metadata arrowCell=%d (centred %s) flippedMain=%s flippedCross=%s"(
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCelloverlay-local index along the attached edge; -1 = none
arrowCell, (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) bool anchored_overlays_place_reference.PlacedOverlay.arrowCentredfalse ⇒ the arrow could not reach the anchor's centre
arrowCentred ? "yes" : "no", (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedMainthe side axis crossed to the other side of the anchor
flippedMain, (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedCrossthe alignment was mirrored (RTL resolution, or flipCross)
flippedCross);
void std.stdio.writefln!(" anchorHidden=%s available=%dx%d", const(bool), const(int), const(int))(const(bool) __param_0, const(int) __param_1, const(int) __param_2) @safeEquivalent to writef(fmt, args, '\n').
writefln!" anchorHidden=%s available=%dx%d"(
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) bool anchored_overlays_place_reference.PlacedOverlay.anchorHiddenthe anchor left its clip
anchorHidden, (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.PlacedOverlay.availableroom actually left at the resolved side
available.(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).widthwidth, (parameter) const(anchored_overlays_place_reference.PlacedOverlay) rr.(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.PlacedOverlay.availableroom actually left at the resolved side
available.(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).heightheight);
if ((parameter) const(anchored_overlays_place_reference.Case) cc.(field) string anchored_overlays_place_reference.Case.notenote.(field) ulong const(string).lengthlength)
void std.stdio.writeln!(string, string)(string __param_0, string __param_1) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln(" note ", (parameter) const(anchored_overlays_place_reference.Case) cc.(field) string anchored_overlays_place_reference.Case.notenote);
void std.stdio.writeln!()() @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln();
}
// ---------------------------------------------------------------------------
void void D main() @safemain() @safe
{
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln("place() — the reference placement pipeline, in cells");
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln("legend: '+-|' the boundary frame (drawn just outside it), 'A' anchor,");
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln(" '#' overlay, '^v<>' the arrow cell, '.' outside the boundary");
void std.stdio.writeln!()() @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln();
// The default policy (`popupCollision`): flip the side axis, slide the edge
// axis, cap the height. Everything else is opt-in, per case.
(struct) anchored_overlays_place_reference.PlacementPolicyThe placement request. Never written back to by the solver (D15.C6): what
the caller asked for stays readable next to what it got.
PlacementPolicy (local variable) anchored_overlays_place_reference.PlacementPolicy polpol;
auto (local variable) anchored_overlays_place_reference.PlacementPolicy crossFlipcrossFlip = (local variable) anchored_overlays_place_reference.PlacementPolicy polpol;
(local variable) anchored_overlays_place_reference.PlacementPolicy crossFlipcrossFlip.(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacementPolicy.align_the preferred cross-axis alignment
align_ = (enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align.(enum value) anchored_overlays_place_reference.Align.start = cast(ubyte)0ustart;
(local variable) anchored_overlays_place_reference.PlacementPolicy crossFlipcrossFlip.(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjustThe default is the proposal's popupCollision: flip the side axis, slide
the edge axis, cap the height. Side-axis slide and cross-axis flip are
opt-in, because both detach the overlay from its anchor.
adjust = (local variable) anchored_overlays_place_reference.PlacementPolicy polpol.(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjustThe default is the proposal's popupCollision: flip the side axis, slide
the edge axis, cap the height. Side-axis slide and cross-axis flip are
opt-in, because both detach the overlay from its anchor.
adjust.anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.plus(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
plus((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.flipCross = cast(ubyte)4umirror the alignment (opt-in; Floating UI's rule)
flipCross);
auto (local variable) anchored_overlays_place_reference.PlacementPolicy rtlrtl = (local variable) anchored_overlays_place_reference.PlacementPolicy polpol;
(local variable) anchored_overlays_place_reference.PlacementPolicy rtlrtl.(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacementPolicy.align_the preferred cross-axis alignment
align_ = (enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align.(enum value) anchored_overlays_place_reference.Align.start = cast(ubyte)0ustart;
(local variable) anchored_overlays_place_reference.PlacementPolicy rtlrtl.(field) anchored_overlays_place_reference.Direction anchored_overlays_place_reference.PlacementPolicy.directionresolved away before the solve
direction = (enum) anchored_overlays_place_reference.DirectionReading direction. An input to the resolution step, never a flag consulted
inside the solver.
Direction.(enum value) anchored_overlays_place_reference.Direction.rtl = 1rtl;
auto (local variable) anchored_overlays_place_reference.Case[] casescases = [
(struct) anchored_overlays_place_reference.CaseOne row of the case table.
Case("fits as preferred",
(struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor.anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safeAn anchor with no clipping ancestor: it clips to itself, so it is always
visible.
unclipped((struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(11, 2, 4, 1)), (struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size(12, 3), (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(0, 0, 26, 9), (local variable) anchored_overlays_place_reference.PlacementPolicy polpol,
"nothing fired: the arrow sits on the anchor's centre cell"),
(struct) anchored_overlays_place_reference.CaseOne row of the case table.
Case("flips on the main axis (no room below)",
(struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor.anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safeAn anchor with no clipping ancestor: it clips to itself, so it is always
visible.
unclipped((struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(11, 6, 4, 1)), (struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size(12, 3), (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(0, 0, 26, 9), (local variable) anchored_overlays_place_reference.PlacementPolicy polpol,
"2 cells below, 6 above: the side is REPORTED, so the backend "
~ "picks 'v' without re-deriving it"),
(struct) anchored_overlays_place_reference.CaseOne row of the case table.
Case("shifts on the cross axis (near the right edge)",
(struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor.anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safeAn anchor with no clipping ancestor: it clips to itself, so it is always
visible.
unclipped((struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(22, 2, 3, 1)), (struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size(12, 3), (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(0, 0, 26, 9), (local variable) anchored_overlays_place_reference.PlacementPolicy polpol,
"the rect slid 4 cells left; the arrow tracked the anchor and is "
~ "still centred"),
(struct) anchored_overlays_place_reference.CaseOne row of the case table.
Case("BOTH axes constrained",
(struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor.anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safeAn anchor with no clipping ancestor: it clips to itself, so it is always
visible.
unclipped((struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(22, 6, 3, 1)), (struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size(12, 3), (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(0, 0, 26, 9), (local variable) anchored_overlays_place_reference.PlacementPolicy polpol,
"flip on the main axis AND slide on the cross axis, in one solve"),
(struct) anchored_overlays_place_reference.CaseOne row of the case table.
Case("content wider than the boundary",
(struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor.anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safeAn anchor with no clipping ancestor: it clips to itself, so it is always
visible.
unclipped((struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(7, 2, 4, 1)), (struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size(24, 3), (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(0, 0, 18, 8), (local variable) anchored_overlays_place_reference.PlacementPolicy polpol,
"the START edge is pinned and the end overflows — never the reverse, "
~ "or the text the arrow points at scrolls off"),
(struct) anchored_overlays_place_reference.CaseOne row of the case table.
Case("content taller than the boundary",
(struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor.anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safeAn anchor with no clipping ancestor: it clips to itself, so it is always
visible.
unclipped((struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(9, 4, 4, 1)), (struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size(10, 14), (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(0, 0, 22, 9), (local variable) anchored_overlays_place_reference.PlacementPolicy polpol,
"neither side fits, so no flip is accepted (revertUnlessFree) and "
~ "the height is capped to the room actually there"),
(struct) anchored_overlays_place_reference.CaseOne row of the case table.
Case("clipped / offscreen anchor",
(struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor.anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.within(in sparkles.ui.geometry.Rect r, in sparkles.ui.geometry.Rect clip) pure nothrow @nogc @safeAn anchor inside a scrolling viewport, which may have scrolled out of it.
within((struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(28, 3, 4, 1), (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(0, 0, 26, 9)), (struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size(12, 3),
(struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(0, 0, 26, 9), (local variable) anchored_overlays_place_reference.PlacementPolicy polpol,
"anchorHidden is a HIDE verdict, not a close; the arrow could not "
~ "reach the anchor, and says so"),
(struct) anchored_overlays_place_reference.CaseOne row of the case table.
Case("RTL alignment",
(struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor.anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safeAn anchor with no clipping ancestor: it clips to itself, so it is always
visible.
unclipped((struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(10, 2, 6, 1)), (struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size(12, 3), (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(0, 0, 26, 9), (local variable) anchored_overlays_place_reference.PlacementPolicy rtlrtl,
"align=start resolved to the RIGHT edge BEFORE the solver ran; the "
~ "solver itself is purely physical"),
(struct) anchored_overlays_place_reference.CaseOne row of the case table.
Case("boundary whose origin is NOT (0,0)",
(struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor.anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safeAn anchor with no clipping ancestor: it clips to itself, so it is always
visible.
unclipped((struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(7, 5, 3, 1)), (struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size(14, 3), (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(6, 3, 20, 8), (local variable) anchored_overlays_place_reference.PlacementPolicy polpol,
"the pin is to boundary.x = 6 — clamping at 0 would leave the "
~ "overlay 4 cells outside its own boundary"),
(struct) anchored_overlays_place_reference.CaseOne row of the case table.
Case("cross-axis alignment flip (opt-in)",
(struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor.anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safeAn anchor with no clipping ancestor: it clips to itself, so it is always
visible.
unclipped((struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(17, 2, 6, 1)), (struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size(12, 3), (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(0, 0, 26, 9), (local variable) anchored_overlays_place_reference.PlacementPolicy crossFlipcrossFlip,
"Floating UI's rule: try the other alignment on the SAME side "
~ "before sliding"),
];
foreach ((parameter) ulong ii, ref (parameter) anchored_overlays_place_reference.Case cc; (local variable) anchored_overlays_place_reference.Case[] casescases)
{
const (local variable) const(anchored_overlays_place_reference.PlacedOverlay) rr = anchored_overlays_place_reference.PlacedOverlay anchored_overlays_place_reference.place(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy) pure nothrow @nogc @safePlace content against anchor inside boundary, under policy.
Per-axis and total: the main (side) axis flips then optionally resizes; the
cross* (edge) axis aligns, optionally mirrors, then slides — end edge first,
start edge last, so an overlay larger than the boundary pins its start and
overflows its end. The start pin is against boundary, not against 0.
place((local variable) anchored_overlays_place_reference.Case cc.(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor, (local variable) anchored_overlays_place_reference.Case cc.(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent, (local variable) anchored_overlays_place_reference.Case cc.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary, (local variable) anchored_overlays_place_reference.Case cc.(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy);
void anchored_overlays_place_reference.checkInvariants(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy, in anchored_overlays_place_reference.PlacedOverlay r) @safecheckInvariants((local variable) anchored_overlays_place_reference.Case cc.(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor, (local variable) anchored_overlays_place_reference.Case cc.(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent, (local variable) anchored_overlays_place_reference.Case cc.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary, (local variable) anchored_overlays_place_reference.Case cc.(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy, (local variable) const(anchored_overlays_place_reference.PlacedOverlay) rr);
void anchored_overlays_place_reference.report(int n, const(anchored_overlays_place_reference.Case) c, in anchored_overlays_place_reference.PlacedOverlay r) @safereport(cast(int) (local variable) ulong ii + 1, (local variable) anchored_overlays_place_reference.Case cc, (local variable) const(anchored_overlays_place_reference.PlacedOverlay) rr);
}
// -- The case-specific assertions, stated as the specification will state them.
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln("=== what the cases pin ===");
const (local variable) const(anchored_overlays_place_reference.PlacedOverlay) fitsfits = anchored_overlays_place_reference.PlacedOverlay anchored_overlays_place_reference.place(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy) pure nothrow @nogc @safePlace content against anchor inside boundary, under policy.
Per-axis and total: the main (side) axis flips then optionally resizes; the
cross* (edge) axis aligns, optionally mirrors, then slides — end edge first,
start edge last, so an overlay larger than the boundary pins its start and
overflows its end. The start pin is against boundary, not against 0.
place((local variable) anchored_overlays_place_reference.Case[] casescases[0].(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor, (local variable) anchored_overlays_place_reference.Case[] casescases[0].(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent, (local variable) anchored_overlays_place_reference.Case[] casescases[0].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary, (local variable) anchored_overlays_place_reference.Case[] casescases[0].(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy);
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) fitsfits.(field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fitthe worst thing that happened
fit == (enum) anchored_overlays_place_reference.FitHow good the resulting placement is, worst-wins.
Fit.(enum value) anchored_overlays_place_reference.Fit.exact = cast(ubyte)0uplaced as asked
exact && (local variable) const(anchored_overlays_place_reference.PlacedOverlay) fitsfits.(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacedOverlay.appliedwhich adjustments fired
applied == (enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.none = cast(ubyte)0unone);
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) fitsfits.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.sidepost-flip anchor edge we attached to
side == (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.bottom = 1below the anchor
bottom && !(local variable) const(anchored_overlays_place_reference.PlacedOverlay) fitsfits.(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedMainthe side axis crossed to the other side of the anchor
flippedMain);
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln(" 1 a preferred placement fires no adjustment at all");
const (local variable) const(anchored_overlays_place_reference.PlacedOverlay) flippedflipped = anchored_overlays_place_reference.PlacedOverlay anchored_overlays_place_reference.place(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy) pure nothrow @nogc @safePlace content against anchor inside boundary, under policy.
Per-axis and total: the main (side) axis flips then optionally resizes; the
cross* (edge) axis aligns, optionally mirrors, then slides — end edge first,
start edge last, so an overlay larger than the boundary pins its start and
overflows its end. The start pin is against boundary, not against 0.
place((local variable) anchored_overlays_place_reference.Case[] casescases[1].(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor, (local variable) anchored_overlays_place_reference.Case[] casescases[1].(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent, (local variable) anchored_overlays_place_reference.Case[] casescases[1].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary, (local variable) anchored_overlays_place_reference.Case[] casescases[1].(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy);
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) flippedflipped.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.sidepost-flip anchor edge we attached to
side == (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.top = cast(ubyte)0uabove the anchor
top && (local variable) const(anchored_overlays_place_reference.PlacedOverlay) flippedflipped.(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedMainthe side axis crossed to the other side of the anchor
flippedMain);
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) flippedflipped.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
bottom <= (local variable) anchored_overlays_place_reference.Case[] casescases[1].(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
y, "a flipped overlay must clear the anchor");
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln(" 2 a main-axis flip is reported as a resolved side, not inferred");
const (local variable) const(anchored_overlays_place_reference.PlacedOverlay) slidslid = anchored_overlays_place_reference.PlacedOverlay anchored_overlays_place_reference.place(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy) pure nothrow @nogc @safePlace content against anchor inside boundary, under policy.
Per-axis and total: the main (side) axis flips then optionally resizes; the
cross* (edge) axis aligns, optionally mirrors, then slides — end edge first,
start edge last, so an overlay larger than the boundary pins its start and
overflows its end. The start pin is against boundary, not against 0.
place((local variable) anchored_overlays_place_reference.Case[] casescases[2].(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor, (local variable) anchored_overlays_place_reference.Case[] casescases[2].(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent, (local variable) anchored_overlays_place_reference.Case[] casescases[2].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary, (local variable) anchored_overlays_place_reference.Case[] casescases[2].(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy);
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) slidslid.(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.sidepost-flip anchor edge we attached to
side == (enum) anchored_overlays_place_reference.SideWhich edge of the anchor the overlay attaches to. ``Side.bottom means the
overlay hangs below the anchor and its own top edge faces it.
Side.(enum value) anchored_overlays_place_reference.Side.bottom = 1below the anchor
bottom && (local variable) const(anchored_overlays_place_reference.PlacedOverlay) slidslid.(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacedOverlay.appliedwhich adjustments fired
applied.bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
has((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.slideCross = cast(ubyte)8ushift along the edge axis
slideCross));
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) slidslid.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right == (local variable) anchored_overlays_place_reference.Case[] casescases[2].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right, "a cross-axis slide pins the end edge");
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) slidslid.(field) bool anchored_overlays_place_reference.PlacedOverlay.arrowCentredfalse ⇒ the arrow could not reach the anchor's centre
arrowCentred, "the arrow follows the anchor after a slide");
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln(" 3 sliding moves the rect and the arrow independently");
const (local variable) const(anchored_overlays_place_reference.PlacedOverlay) bothboth = anchored_overlays_place_reference.PlacedOverlay anchored_overlays_place_reference.place(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy) pure nothrow @nogc @safePlace content against anchor inside boundary, under policy.
Per-axis and total: the main (side) axis flips then optionally resizes; the
cross* (edge) axis aligns, optionally mirrors, then slides — end edge first,
start edge last, so an overlay larger than the boundary pins its start and
overflows its end. The start pin is against boundary, not against 0.
place((local variable) anchored_overlays_place_reference.Case[] casescases[3].(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor, (local variable) anchored_overlays_place_reference.Case[] casescases[3].(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent, (local variable) anchored_overlays_place_reference.Case[] casescases[3].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary, (local variable) anchored_overlays_place_reference.Case[] casescases[3].(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy);
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) bothboth.(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacedOverlay.appliedwhich adjustments fired
applied.bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
has((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.flipMain = cast(ubyte)1ucross to the opposite side of the anchor
flipMain) && (local variable) const(anchored_overlays_place_reference.PlacedOverlay) bothboth.(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacedOverlay.appliedwhich adjustments fired
applied.bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
has((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.slideCross = cast(ubyte)8ushift along the edge axis
slideCross));
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln(" 4 the two axes are solved independently, so both may fire");
const (local variable) const(anchored_overlays_place_reference.PlacedOverlay) widewide = anchored_overlays_place_reference.PlacedOverlay anchored_overlays_place_reference.place(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy) pure nothrow @nogc @safePlace content against anchor inside boundary, under policy.
Per-axis and total: the main (side) axis flips then optionally resizes; the
cross* (edge) axis aligns, optionally mirrors, then slides — end edge first,
start edge last, so an overlay larger than the boundary pins its start and
overflows its end. The start pin is against boundary, not against 0.
place((local variable) anchored_overlays_place_reference.Case[] casescases[4].(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor, (local variable) anchored_overlays_place_reference.Case[] casescases[4].(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent, (local variable) anchored_overlays_place_reference.Case[] casescases[4].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary, (local variable) anchored_overlays_place_reference.Case[] casescases[4].(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy);
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) widewide.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x == (local variable) anchored_overlays_place_reference.Case[] casescases[4].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x, "the START edge wins when the content is too wide");
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) widewide.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right > (local variable) anchored_overlays_place_reference.Case[] casescases[4].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right && (local variable) const(anchored_overlays_place_reference.PlacedOverlay) widewide.(field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fitthe worst thing that happened
fit == (enum) anchored_overlays_place_reference.FitHow good the resulting placement is, worst-wins.
Fit.(enum value) anchored_overlays_place_reference.Fit.overflowing = 4it does not fit and we are the host — nobody clips for us
overflowing);
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln(" 5 oversize content pins its start edge and REPORTS the overflow");
const (local variable) const(anchored_overlays_place_reference.PlacedOverlay) talltall = anchored_overlays_place_reference.PlacedOverlay anchored_overlays_place_reference.place(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy) pure nothrow @nogc @safePlace content against anchor inside boundary, under policy.
Per-axis and total: the main (side) axis flips then optionally resizes; the
cross* (edge) axis aligns, optionally mirrors, then slides — end edge first,
start edge last, so an overlay larger than the boundary pins its start and
overflows its end. The start pin is against boundary, not against 0.
place((local variable) anchored_overlays_place_reference.Case[] casescases[5].(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor, (local variable) anchored_overlays_place_reference.Case[] casescases[5].(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent, (local variable) anchored_overlays_place_reference.Case[] casescases[5].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary, (local variable) anchored_overlays_place_reference.Case[] casescases[5].(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy);
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) talltall.(field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fitthe worst thing that happened
fit == (enum) anchored_overlays_place_reference.FitHow good the resulting placement is, worst-wins.
Fit.(enum value) anchored_overlays_place_reference.Fit.shrunk = 3the content was capped
shrunk && (local variable) const(anchored_overlays_place_reference.PlacedOverlay) talltall.(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacedOverlay.appliedwhich adjustments fired
applied.bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safeBit tests spelled once, so the solver reads as prose.
has((enum) anchored_overlays_place_reference.AdjustWhich adjustments the caller permits — and, on the result, which ones
actually fired. Structurally GTK4's GdkAnchorHints / xdg_positioner's
constraint_adjustment, so a future native-windowing backend can forward it.
Adjust.(enum value) anchored_overlays_place_reference.Adjust.resizeMain = cast(ubyte)16ushrink to the room at the resolved side
resizeMain));
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) talltall.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.height() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
height == (local variable) const(anchored_overlays_place_reference.PlacedOverlay) talltall.(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.PlacedOverlay.availableroom actually left at the resolved side
available.(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).heightheight, "a capped overlay takes the room reported");
assert(!(local variable) const(anchored_overlays_place_reference.PlacedOverlay) talltall.(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedMainthe side axis crossed to the other side of the anchor
flippedMain, "revertUnlessFree refuses a flip that does not fit either");
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln(" 6 resize is the LAST resort, and the cap equals the reported room");
const (local variable) const(anchored_overlays_place_reference.PlacedOverlay) hiddenhidden = anchored_overlays_place_reference.PlacedOverlay anchored_overlays_place_reference.place(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy) pure nothrow @nogc @safePlace content against anchor inside boundary, under policy.
Per-axis and total: the main (side) axis flips then optionally resizes; the
cross* (edge) axis aligns, optionally mirrors, then slides — end edge first,
start edge last, so an overlay larger than the boundary pins its start and
overflows its end. The start pin is against boundary, not against 0.
place((local variable) anchored_overlays_place_reference.Case[] casescases[6].(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor, (local variable) anchored_overlays_place_reference.Case[] casescases[6].(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent, (local variable) anchored_overlays_place_reference.Case[] casescases[6].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary, (local variable) anchored_overlays_place_reference.Case[] casescases[6].(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy);
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) hiddenhidden.(field) bool anchored_overlays_place_reference.PlacedOverlay.anchorHiddenthe anchor left its clip
anchorHidden, "an anchor outside its clip must be reported hidden");
assert(!(local variable) const(anchored_overlays_place_reference.PlacedOverlay) hiddenhidden.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.bool sparkles.ui.geometry.Rect.empty() const pure nothrow @nogc @safetrue iff the rectangle covers no cells.
empty, "a hidden anchor still yields geometry — hide, do not close");
assert(!(local variable) const(anchored_overlays_place_reference.PlacedOverlay) hiddenhidden.(field) bool anchored_overlays_place_reference.PlacedOverlay.arrowCentredfalse ⇒ the arrow could not reach the anchor's centre
arrowCentred, "the arrow clamped, and said so");
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln(" 7 anchorHidden hides; the geometry survives, and the arrow admits it clamped");
// RTL: `start` is the right edge. The same request under LTR lands elsewhere.
auto (local variable) anchored_overlays_place_reference.PlacementPolicy asLtrasLtr = (local variable) anchored_overlays_place_reference.Case[] casescases[7].(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy;
(local variable) anchored_overlays_place_reference.PlacementPolicy asLtrasLtr.(field) anchored_overlays_place_reference.Direction anchored_overlays_place_reference.PlacementPolicy.directionresolved away before the solve
direction = (enum) anchored_overlays_place_reference.DirectionReading direction. An input to the resolution step, never a flag consulted
inside the solver.
Direction.(enum value) anchored_overlays_place_reference.Direction.ltr = cast(ubyte)0ultr;
const (local variable) const(anchored_overlays_place_reference.PlacedOverlay) rtlPlacedrtlPlaced = anchored_overlays_place_reference.PlacedOverlay anchored_overlays_place_reference.place(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy) pure nothrow @nogc @safePlace content against anchor inside boundary, under policy.
Per-axis and total: the main (side) axis flips then optionally resizes; the
cross* (edge) axis aligns, optionally mirrors, then slides — end edge first,
start edge last, so an overlay larger than the boundary pins its start and
overflows its end. The start pin is against boundary, not against 0.
place((local variable) anchored_overlays_place_reference.Case[] casescases[7].(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor, (local variable) anchored_overlays_place_reference.Case[] casescases[7].(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent, (local variable) anchored_overlays_place_reference.Case[] casescases[7].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary, (local variable) anchored_overlays_place_reference.Case[] casescases[7].(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy);
const (local variable) const(anchored_overlays_place_reference.PlacedOverlay) ltrPlacedltrPlaced = anchored_overlays_place_reference.PlacedOverlay anchored_overlays_place_reference.place(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy) pure nothrow @nogc @safePlace content against anchor inside boundary, under policy.
Per-axis and total: the main (side) axis flips then optionally resizes; the
cross* (edge) axis aligns, optionally mirrors, then slides — end edge first,
start edge last, so an overlay larger than the boundary pins its start and
overflows its end. The start pin is against boundary, not against 0.
place((local variable) anchored_overlays_place_reference.Case[] casescases[7].(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor, (local variable) anchored_overlays_place_reference.Case[] casescases[7].(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent, (local variable) anchored_overlays_place_reference.Case[] casescases[7].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary, (local variable) anchored_overlays_place_reference.PlacementPolicy asLtrasLtr);
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) rtlPlacedrtlPlaced.(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacedOverlay.align_post-flip, post-RTL cross alignment
align_ == (enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align.(enum value) anchored_overlays_place_reference.Align.end = 2end && (local variable) const(anchored_overlays_place_reference.PlacedOverlay) rtlPlacedrtlPlaced.(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedCrossthe alignment was mirrored (RTL resolution, or flipCross)
flippedCross);
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) ltrPlacedltrPlaced.(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacedOverlay.align_post-flip, post-RTL cross alignment
align_ == (enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align.(enum value) anchored_overlays_place_reference.Align.start = cast(ubyte)0ustart && !(local variable) const(anchored_overlays_place_reference.PlacedOverlay) ltrPlacedltrPlaced.(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedCrossthe alignment was mirrored (RTL resolution, or flipCross)
flippedCross);
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) rtlPlacedrtlPlaced.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right == (local variable) anchored_overlays_place_reference.Case[] casescases[7].(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right, "RTL start aligns the RIGHT edges");
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) ltrPlacedltrPlaced.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x == (local variable) anchored_overlays_place_reference.Case[] casescases[7].(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x, "LTR start aligns the LEFT edges");
void std.stdio.writefln!(" 8 align=start \xe2\x87\x92 x=%d under RTL, x=%d under LTR \xe2\x80\x94 resolved before the solve", int, int)(int __param_0, int __param_1) @safeEquivalent to writef(fmt, args, '\n').
writefln!" 8 align=start ⇒ x=%d under RTL, x=%d under LTR — resolved before the solve"(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) rtlPlacedrtlPlaced.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x, (local variable) const(anchored_overlays_place_reference.PlacedOverlay) ltrPlacedltrPlaced.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x);
// The clamp-to-zero case, stated twice: once at a positive boundary origin,
// once at a negative one, where a legitimate placement is itself negative.
const (local variable) const(anchored_overlays_place_reference.PlacedOverlay) offoff = anchored_overlays_place_reference.PlacedOverlay anchored_overlays_place_reference.place(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy) pure nothrow @nogc @safePlace content against anchor inside boundary, under policy.
Per-axis and total: the main (side) axis flips then optionally resizes; the
cross* (edge) axis aligns, optionally mirrors, then slides — end edge first,
start edge last, so an overlay larger than the boundary pins its start and
overflows its end. The start pin is against boundary, not against 0.
place((local variable) anchored_overlays_place_reference.Case[] casescases[8].(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor, (local variable) anchored_overlays_place_reference.Case[] casescases[8].(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent, (local variable) anchored_overlays_place_reference.Case[] casescases[8].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary, (local variable) anchored_overlays_place_reference.Case[] casescases[8].(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy);
const (local variable) const(int) alignedaligned = (local variable) anchored_overlays_place_reference.Case[] casescases[8].(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x
+ ((local variable) anchored_overlays_place_reference.Case[] casescases[8].(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
width - (local variable) anchored_overlays_place_reference.Case[] casescases[8].(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent.(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).widthwidth) / 2;
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) offoff.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x == (local variable) anchored_overlays_place_reference.Case[] casescases[8].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x, "the pin is the boundary's start edge");
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) offoff.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x != 0, "a boundary that does not start at 0 must not pin at 0");
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) offoff.(field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fitthe worst thing that happened
fit != (enum) anchored_overlays_place_reference.FitHow good the resulting placement is, worst-wins.
Fit.(enum value) anchored_overlays_place_reference.Fit.overflowing = 4it does not fit and we are the host — nobody clips for us
overflowing && (local variable) anchored_overlays_place_reference.Case[] casescases[8].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary.sparkles.ui.geometry.Rect sparkles.ui.geometry.Rect.intersection(in sparkles.ui.geometry.Rect other) const pure nothrow @nogc @safeThe overlap of two rectangles (an empty one when disjoint).
intersection((local variable) const(anchored_overlays_place_reference.PlacedOverlay) offoff.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect) == bool sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]).opEquals(in sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]) rhs) const pure nothrow @nogc @safeComponent-wise equality (compares the backing components directly, so it is
well-defined despite the union — the compiler-generated == over a union
is not).
off.bool sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]).opEquals(in sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]) rhs) const pure nothrow @nogc @safeComponent-wise equality (compares the backing components directly, so it is
well-defined despite the union — the compiler-generated == over a union
is not).
rect);
const (local variable) const(int) todayAbstodayAbs = int anchored_overlays_place_reference.clampOriginToday(int anchor, int width, int extent) pure nothrow @nogc @safeclampOrigin as libs/twoslash/src/sparkles/twoslash/render_widgets.d:430 has
it today — one axis, one direction, against a scalar extent, floored at zero.
Reproduced verbatim so case 9 can print the divergence rather than describe it.
clampOriginToday((local variable) const(int) alignedaligned, (local variable) anchored_overlays_place_reference.Case[] casescases[8].(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent.(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).widthwidth, (local variable) anchored_overlays_place_reference.Case[] casescases[8].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right);
const (local variable) const(int) todayReltodayRel = int anchored_overlays_place_reference.clampOriginToday(int anchor, int width, int extent) pure nothrow @nogc @safeclampOrigin as libs/twoslash/src/sparkles/twoslash/render_widgets.d:430 has
it today — one axis, one direction, against a scalar extent, floored at zero.
Reproduced verbatim so case 9 can print the divergence rather than describe it.
clampOriginToday((local variable) const(int) alignedaligned, (local variable) anchored_overlays_place_reference.Case[] casescases[8].(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent.(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).widthwidth, (local variable) anchored_overlays_place_reference.Case[] casescases[8].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary.int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
width);
void std.stdio.writefln!(" 9 centred x would be %d; place() pins %d (boundary.x)", const(int), int)(const(int) __param_0, int __param_1) @safeEquivalent to writef(fmt, args, '\n').
writefln!" 9 centred x would be %d; place() pins %d (boundary.x)"((local variable) const(int) alignedaligned, (local variable) const(anchored_overlays_place_reference.PlacedOverlay) offoff.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x);
void std.stdio.writefln!(" clampOrigin(%d,%d,extent) gives %d absolute / %d pane-relative \xe2\x80\x94 %d cells outside a boundary that starts at %d", const(int), int, const(int), const(int), int, int)(const(int) __param_0, int __param_1, const(int) __param_2, const(int) __param_3, int __param_4, int __param_5) @safeEquivalent to writef(fmt, args, '\n').
writefln!(" clampOrigin(%d,%d,extent) gives %d absolute / %d pane-relative — %d cells"
~ " outside a boundary that starts at %d")(
(local variable) const(int) alignedaligned, (local variable) anchored_overlays_place_reference.Case[] casescases[8].(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent.(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).widthwidth, (local variable) const(int) todayAbstodayAbs, (local variable) const(int) todayReltodayRel,
(local variable) anchored_overlays_place_reference.Case[] casescases[8].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x - (local variable) const(int) todayAbstodayAbs, (local variable) anchored_overlays_place_reference.Case[] casescases[8].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x);
// A viewport scrolled above/left of the origin: positions are legitimately
// negative, and clamping at zero detaches the overlay from its anchor.
const (local variable) const(sparkles.ui.geometry.Rect) negBoundarynegBoundary = (struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(-4, -2, 20, 8);
const (local variable) const(anchored_overlays_place_reference.Anchor) negAnchornegAnchor = (struct) anchored_overlays_place_reference.AnchorThe resolved anchor. rect is what the solver places against; clip is the
anchor's clipping ancestor, which governs only the anchorHidden verdict —
the placement boundary is a separate parameter (D3.C3).
Anchor.anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safeAn anchor with no clipping ancestor: it clips to itself, so it is always
visible.
unclipped((struct) sparkles.ui.geometry.RectA rectangle on the cell grid, [x, x+width) × [y, y+height) — a
Point origin plus a Size extent.
Rect(-3, 0, 3, 1));
const (local variable) const(anchored_overlays_place_reference.PlacedOverlay) negneg = anchored_overlays_place_reference.PlacedOverlay anchored_overlays_place_reference.place(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy) pure nothrow @nogc @safePlace content against anchor inside boundary, under policy.
Per-axis and total: the main (side) axis flips then optionally resizes; the
cross* (edge) axis aligns, optionally mirrors, then slides — end edge first,
start edge last, so an overlay larger than the boundary pins its start and
overflows its end. The start pin is against boundary, not against 0.
place((local variable) const(anchored_overlays_place_reference.Anchor) negAnchornegAnchor, (struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size(14, 3), (local variable) const(sparkles.ui.geometry.Rect) negBoundarynegBoundary, (local variable) anchored_overlays_place_reference.PlacementPolicy polpol);
void anchored_overlays_place_reference.checkInvariants(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy, in anchored_overlays_place_reference.PlacedOverlay r) @safecheckInvariants((local variable) const(anchored_overlays_place_reference.Anchor) negAnchornegAnchor, (struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])Size(14, 3), (local variable) const(sparkles.ui.geometry.Rect) negBoundarynegBoundary, (local variable) anchored_overlays_place_reference.PlacementPolicy polpol, (local variable) const(anchored_overlays_place_reference.PlacedOverlay) negneg);
const (local variable) const(int) negAlignednegAligned = (local variable) const(anchored_overlays_place_reference.Anchor) negAnchornegAnchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x + ((local variable) const(anchored_overlays_place_reference.Anchor) negAnchornegAnchor.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rectthe anchor's cell rect
rect.int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
width - 14) / 2;
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) negneg.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x == (local variable) const(sparkles.ui.geometry.Rect) negBoundarynegBoundary.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x && (local variable) const(anchored_overlays_place_reference.PlacedOverlay) negneg.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x < 0,
"a negative boundary origin is a legal placement, not an error to clamp away");
void std.stdio.writefln!(" negative-origin boundary %s: place() pins x=%d, clampOrigin gives %d", string, int, int)(string __param_0, int __param_1, int __param_2) @safeEquivalent to writef(fmt, args, '\n').
writefln!" negative-origin boundary %s: place() pins x=%d, clampOrigin gives %d"(
string anchored_overlays_place_reference.rectText(in sparkles.ui.geometry.Rect r) @saferectText((local variable) const(sparkles.ui.geometry.Rect) negBoundarynegBoundary), (local variable) const(anchored_overlays_place_reference.PlacedOverlay) negneg.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x,
int anchored_overlays_place_reference.clampOriginToday(int anchor, int width, int extent) pure nothrow @nogc @safeclampOrigin as libs/twoslash/src/sparkles/twoslash/render_widgets.d:430 has
it today — one axis, one direction, against a scalar extent, floored at zero.
Reproduced verbatim so case 9 can print the divergence rather than describe it.
clampOriginToday((local variable) const(int) negAlignednegAligned, 14, (local variable) const(sparkles.ui.geometry.Rect) negBoundarynegBoundary.int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safeRight edge (exclusive) and bottom edge (exclusive).
right));
const (local variable) const(anchored_overlays_place_reference.PlacedOverlay) crossFlippedcrossFlipped = anchored_overlays_place_reference.PlacedOverlay anchored_overlays_place_reference.place(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy) pure nothrow @nogc @safePlace content against anchor inside boundary, under policy.
Per-axis and total: the main (side) axis flips then optionally resizes; the
cross* (edge) axis aligns, optionally mirrors, then slides — end edge first,
start edge last, so an overlay larger than the boundary pins its start and
overflows its end. The start pin is against boundary, not against 0.
place((local variable) anchored_overlays_place_reference.Case[] casescases[9].(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor, (local variable) anchored_overlays_place_reference.Case[] casescases[9].(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent, (local variable) anchored_overlays_place_reference.Case[] casescases[9].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary, (local variable) anchored_overlays_place_reference.Case[] casescases[9].(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy);
auto (local variable) anchored_overlays_place_reference.PlacementPolicy noFlipnoFlip = (local variable) anchored_overlays_place_reference.Case[] casescases[9].(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policypolicy;
(local variable) anchored_overlays_place_reference.PlacementPolicy noFlipnoFlip.(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjustThe default is the proposal's popupCollision: flip the side axis, slide
the edge axis, cap the height. Side-axis slide and cross-axis flip are
opt-in, because both detach the overlay from its anchor.
adjust = (local variable) anchored_overlays_place_reference.PlacementPolicy polpol.(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjustThe default is the proposal's popupCollision: flip the side axis, slide
the edge axis, cap the height. Side-axis slide and cross-axis flip are
opt-in, because both detach the overlay from its anchor.
adjust;
(local variable) anchored_overlays_place_reference.PlacementPolicy noFlipnoFlip.(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacementPolicy.align_the preferred cross-axis alignment
align_ = (enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align.(enum value) anchored_overlays_place_reference.Align.start = cast(ubyte)0ustart;
const (local variable) const(anchored_overlays_place_reference.PlacedOverlay) wouldSlidewouldSlide = anchored_overlays_place_reference.PlacedOverlay anchored_overlays_place_reference.place(in anchored_overlays_place_reference.Anchor anchor, in sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) content, in sparkles.ui.geometry.Rect boundary, in anchored_overlays_place_reference.PlacementPolicy policy) pure nothrow @nogc @safePlace content against anchor inside boundary, under policy.
Per-axis and total: the main (side) axis flips then optionally resizes; the
cross* (edge) axis aligns, optionally mirrors, then slides — end edge first,
start edge last, so an overlay larger than the boundary pins its start and
overflows its end. The start pin is against boundary, not against 0.
place((local variable) anchored_overlays_place_reference.Case[] casescases[9].(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchoranchor, (local variable) anchored_overlays_place_reference.Case[] casescases[9].(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.contentcontent, (local variable) anchored_overlays_place_reference.Case[] casescases[9].(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundaryboundary, (local variable) anchored_overlays_place_reference.PlacementPolicy noFlipnoFlip);
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) crossFlippedcrossFlipped.(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacedOverlay.align_post-flip, post-RTL cross alignment
align_ == (enum) anchored_overlays_place_reference.AlignCross-axis alignment, in physical terms. start is the left/top edge; a
logical (writing-order) alignment is resolved to one of these before the
solver runs — see physical.
Align.(enum value) anchored_overlays_place_reference.Align.end = 2end && (local variable) const(anchored_overlays_place_reference.PlacedOverlay) crossFlippedcrossFlipped.(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedCrossthe alignment was mirrored (RTL resolution, or flipCross)
flippedCross);
assert((local variable) const(anchored_overlays_place_reference.PlacedOverlay) crossFlippedcrossFlipped.(field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fitthe worst thing that happened
fit == (enum) anchored_overlays_place_reference.FitHow good the resulting placement is, worst-wins.
Fit.(enum value) anchored_overlays_place_reference.Fit.flipped = 2crossed to the other side of the anchor
flipped && (local variable) const(anchored_overlays_place_reference.PlacedOverlay) wouldSlidewouldSlide.(field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fitthe worst thing that happened
fit == (enum) anchored_overlays_place_reference.FitHow good the resulting placement is, worst-wins.
Fit.(enum value) anchored_overlays_place_reference.Fit.slid = 1shifted along an axis to stay inside
slid);
void std.stdio.writefln!(" 10 flipCross lands x=%d (align=end); sliding alone would land x=%d", int, int)(int __param_0, int __param_1) @safeEquivalent to writef(fmt, args, '\n').
writefln!" 10 flipCross lands x=%d (align=end); sliding alone would land x=%d"(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) crossFlippedcrossFlipped.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x, (local variable) const(anchored_overlays_place_reference.PlacedOverlay) wouldSlidewouldSlide.(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rectresolved, integer cells, already pinned
rect.int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safeThe components, forwarded from origin/size.
x);
void std.stdio.writeln!()() @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln();
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln("=== invariants held for every case ===");
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln(" I1 rect.origin >= boundary.origin (the pin is the boundary, not 0)");
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln(" I2 fit != overflowing => rect inside boundary");
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln(" I3 1 <= arrowCell <= edgeLen - 2 (never a corner glyph)");
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln(" I4 place(resolved side/align) == the same rect, with no further flip");
}