place-reference.dhover×1780all
#!/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_reference

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 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:

  1. 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);

  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 § 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 § 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 § 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) std
std
.
(module) std.format

This 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");
@copyrightCopyright The D Language Foundation 2000-2021.@licenseBoost License 1.0.@authorsWalter Bright, Andrei Alexandrescu, and Kenji Hara
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.

@paramfmt a format string@paramargs a variadic list of arguments to be formatted@paramChar character type of fmt@paramArgs a variadic list of types of the arguments@returnsThe formatted string.@throwsA FormatException if formatting did not succeed.@seesformat for a variant, that tries to avoid garbage collection.
format
;
import
(package) std
std
.
(module) std.stdio
Category 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:

  1. The lowest layer is the operating system layer. The two main schemes are Windows and Posix.

  2. C's stdio.h which unifies the two operating system schemes.

  3. std.stdio, this module, unifies the various stdio.h implementations into a high level package for D programs.

Source

std/stdio.d

@copyrightCopyright The D Language Foundation 2007-.@licenseBoost License 1.0.@authorsWalter Bright, Andrei Alexandrescu, Alex Rønne Petersen
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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
;
import
(package) sparkles
sparkles
.
(package) sparkles.ui
ui
.
(module) sparkles.ui.geometry

Abstract 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.Rect

A 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.Side

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.

Side
: ubyte
{
(enum value) anchored_overlays_place_reference.Side.top = cast(ubyte)0u

above the anchor

top
, /// above the anchor
(enum value) anchored_overlays_place_reference.Side.bottom = 1

below the anchor

bottom
, /// below the anchor
(enum value) anchored_overlays_place_reference.Side.left = 2

left of the anchor

left
, /// left of the anchor
(enum value) anchored_overlays_place_reference.Side.right = 3

right 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.Align

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 physical.

Align
: ubyte {
(enum value) anchored_overlays_place_reference.Align.start = cast(ubyte)0u
start
,
(enum value) anchored_overlays_place_reference.Align.center = 1
center
,
(enum value) anchored_overlays_place_reference.Align.end = 2
end
}
/// Reading direction. An *input to the resolution step*, never a flag consulted /// inside the solver. enum
(enum) anchored_overlays_place_reference.Direction

Reading 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)0u
ltr
,
(enum value) anchored_overlays_place_reference.Direction.rtl = 1
rtl
}
/// 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.Adjust

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.

Adjust
: ubyte
{
(enum value) anchored_overlays_place_reference.Adjust.none = cast(ubyte)0u
none
= 0,
(enum value) anchored_overlays_place_reference.Adjust.flipMain = cast(ubyte)1u

cross 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)2u

shift 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)4u

mirror 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)8u

shift along the edge axis

slideCross
= 1 << 3, /// shift along the edge axis
(enum value) anchored_overlays_place_reference.Adjust.resizeMain = cast(ubyte)16u

shrink 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)32u

shrink 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.Fit

How good the resulting placement is, worst-wins.

Fit
: ubyte
{
(enum value) anchored_overlays_place_reference.Fit.exact = cast(ubyte)0u

placed as asked

exact
, /// placed as asked
(enum value) anchored_overlays_place_reference.Fit.slid = 1

shifted along an axis to stay inside

slid
, /// shifted along an axis to stay inside
(enum value) anchored_overlays_place_reference.Fit.flipped = 2

crossed to the other side of the anchor

flipped
, /// crossed to the other side of the anchor
(enum value) anchored_overlays_place_reference.Fit.shrunk = 3

the content was capped

shrunk
, /// the content was capped
(enum value) anchored_overlays_place_reference.Fit.overflowing = 4

it 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.FlipAcceptance

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.

FlipAcceptance
: ubyte {
(enum value) anchored_overlays_place_reference.FlipAcceptance.revertUnlessFree = cast(ubyte)0u
revertUnlessFree
,
(enum value) anchored_overlays_place_reference.FlipAcceptance.lessBadWins = 1
lessBadWins
}
/// 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 @safe

Bit tests spelled once, so the solver reads as prose.

has
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
(parameter) anchored_overlays_place_reference.Adjust a
a
,
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
(parameter) anchored_overlays_place_reference.Adjust f
f
) @safe pure nothrow @nogc => (
(parameter) anchored_overlays_place_reference.Adjust a
a
&
(parameter) anchored_overlays_place_reference.Adjust f
f
) != 0;
/// ditto
(enum) anchored_overlays_place_reference.Adjust

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.

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 @safe

Bit tests spelled once, so the solver reads as prose.

plus
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
(parameter) anchored_overlays_place_reference.Adjust a
a
,
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
(parameter) anchored_overlays_place_reference.Adjust f
f
) @safe pure nothrow @nogc => cast(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
)(
(parameter) anchored_overlays_place_reference.Adjust a
a
|
(parameter) anchored_overlays_place_reference.Adjust f
f
);
/// The opposite side, for a main-axis flip.
(enum) anchored_overlays_place_reference.Side

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.

Side
anchored_overlays_place_reference.Side anchored_overlays_place_reference.opposite(anchored_overlays_place_reference.Side s) pure nothrow @nogc @safe

The opposite side, for a main-axis flip.

opposite
(
(enum) anchored_overlays_place_reference.Side

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.

Side
(parameter) anchored_overlays_place_reference.Side s
s
) @safe pure nothrow @nogc
{ final switch (
(parameter) anchored_overlays_place_reference.Side s
s
)
{ case
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.top = cast(ubyte)0u

above the anchor

top
: return
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.bottom = 1

below the anchor

bottom
;
case
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.bottom = 1

below the anchor

bottom
: return
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.top = cast(ubyte)0u

above the anchor

top
;
case
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.left = 2

left of the anchor

left
: return
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.right = 3

right of the anchor

right
;
case
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.right = 3

right of the anchor

right
: return
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.left = 2

left of the anchor

left
;
} } /// The mirrored alignment. `center` is its own mirror.
(enum) anchored_overlays_place_reference.Align

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 physical.

Align
anchored_overlays_place_reference.Align anchored_overlays_place_reference.mirror(anchored_overlays_place_reference.Align a) pure nothrow @nogc @safe

The mirrored alignment. center is its own mirror.

mirror
(
(enum) anchored_overlays_place_reference.Align

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 physical.

Align
(parameter) anchored_overlays_place_reference.Align a
a
) @safe pure nothrow @nogc
=>
(parameter) anchored_overlays_place_reference.Align a
a
==
(enum) anchored_overlays_place_reference.Align

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 physical.

Align
.
(enum value) anchored_overlays_place_reference.Align.start = cast(ubyte)0u
start
?
(enum) anchored_overlays_place_reference.Align

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 physical.

Align
.
(enum value) anchored_overlays_place_reference.Align.end = 2
end
: (
(parameter) anchored_overlays_place_reference.Align a
a
==
(enum) anchored_overlays_place_reference.Align

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 physical.

Align
.
(enum value) anchored_overlays_place_reference.Align.end = 2
end
?
(enum) anchored_overlays_place_reference.Align

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 physical.

Align
.
(enum value) anchored_overlays_place_reference.Align.start = cast(ubyte)0u
start
:
(enum) anchored_overlays_place_reference.Align

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 physical.

Align
.
(enum value) anchored_overlays_place_reference.Align.center = 1
center
);
/** 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.PlacementPolicy

The 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.Side

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.

Side
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.side

the preferred anchor edge

side
=
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.bottom = 1

below the anchor

bottom
; /// the preferred anchor edge
(enum) anchored_overlays_place_reference.Align

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 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.Align

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 physical.

Align
.
(enum value) anchored_overlays_place_reference.Align.center = 1
center
; /// the preferred cross-axis alignment
(enum) anchored_overlays_place_reference.Direction

Reading 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.direction

resolved away before the solve

direction
=
(enum) anchored_overlays_place_reference.Direction

Reading 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)0u
ltr
; /// resolved away before the solve
int
(field) int anchored_overlays_place_reference.PlacementPolicy.sideOffset

the gutter, in cells, applied BEFORE testing

sideOffset
; /// the gutter, in cells, applied BEFORE testing
int
(field) int anchored_overlays_place_reference.PlacementPolicy.alignOffset

a 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.Adjust

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.

Adjust
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjust

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.

adjust
= cast(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
)(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.flipMain = cast(ubyte)1u

cross to the opposite side of the anchor

flipMain
|
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.slideCross = cast(ubyte)8u

shift along the edge axis

slideCross
|
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.resizeMain = cast(ubyte)16u

shrink to the room at the resolved side

resizeMain
);
(enum) anchored_overlays_place_reference.FlipAcceptance

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.

FlipAcceptance
(field) anchored_overlays_place_reference.FlipAcceptance anchored_overlays_place_reference.PlacementPolicy.acceptance
acceptance
=
(enum) anchored_overlays_place_reference.FlipAcceptance

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.

FlipAcceptance
.
(enum value) anchored_overlays_place_reference.FlipAcceptance.revertUnlessFree = cast(ubyte)0u
revertUnlessFree
;
bool
(field) bool anchored_overlays_place_reference.PlacementPolicy.arrow

reserve 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.Anchor

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).

Anchor
{
(struct) sparkles.ui.geometry.Rect

A 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.rect

the anchor's cell rect

rect
; /// the anchor's cell rect
(struct) sparkles.ui.geometry.Rect

A 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.clip

the 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.Anchor

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).

Anchor
anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safe

An anchor with no clipping ancestor: it clips to itself, so it is always visible.

unclipped
(in
(struct) sparkles.ui.geometry.Rect

A 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) r
r
) =>
(struct) anchored_overlays_place_reference.Anchor

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).

Anchor
(
(parameter) const(sparkles.ui.geometry.Rect) r
r
,
(parameter) const(sparkles.ui.geometry.Rect) r
r
);
/// An anchor inside a scrolling viewport, which may have scrolled out of it. static
(struct) anchored_overlays_place_reference.Anchor

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).

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 @safe

An anchor inside a scrolling viewport, which may have scrolled out of it.

within
(in
(struct) sparkles.ui.geometry.Rect

A 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) r
r
, in
(struct) sparkles.ui.geometry.Rect

A 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) clip
clip
) =>
(struct) anchored_overlays_place_reference.Anchor

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).

Anchor
(
(parameter) const(sparkles.ui.geometry.Rect) r
r
,
(parameter) const(sparkles.ui.geometry.Rect) clip
clip
);
/// The part of the anchor its clip stack actually leaves on screen.
(struct) sparkles.ui.geometry.Rect

A 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 @safe

The part of the anchor its clip stack actually leaves on screen.

visible
() const scope =>
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
sparkles.ui.geometry.Rect sparkles.ui.geometry.Rect.intersection(in sparkles.ui.geometry.Rect other) const pure nothrow @nogc @safe

The overlap of two rectangles (an empty one when disjoint).

intersection
(
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.clip

the 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 @safe

The 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 @safe

The part of the anchor its clip stack actually leaves on screen.

visible
.
bool sparkles.ui.geometry.Rect.empty() const pure nothrow @nogc @safe

true 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.PlacedOverlay

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, ../avalonia.md and hue's three clampOrigin call sites each ended up doing, differently.

PlacedOverlay
{
(struct) sparkles.ui.geometry.Rect

A 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.rect

resolved, integer cells, already pinned

rect
; /// resolved, integer cells, already pinned
(enum) anchored_overlays_place_reference.Side

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.

Side
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.side

post-flip anchor edge we attached to

side
; /// post-flip anchor edge we attached to
(enum) anchored_overlays_place_reference.Align

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 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.arrowCell

overlay-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.arrowCentred

false ⇒ 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.flippedMain

the 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.flippedCross

the alignment was mirrored (RTL resolution, or flipCross)

flippedCross
; /// the alignment was mirrored (RTL resolution, or flipCross)
bool
(field) bool anchored_overlays_place_reference.PlacedOverlay.anchorHidden

the 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.available

room actually left at the resolved side

available
; /// room actually left at the resolved side
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacedOverlay.applied

which adjustments fired

applied
; /// which adjustments fired
(enum) anchored_overlays_place_reference.Fit

How good the resulting placement is, worst-wins.

Fit
(field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fit

the 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.PlacementPolicy

The 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 @safe

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.

physical
(in
(struct) anchored_overlays_place_reference.PlacementPolicy

The 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) p
p
) @safe pure nothrow @nogc
{ if (
(parameter) const(anchored_overlays_place_reference.PlacementPolicy) p
p
.
(field) anchored_overlays_place_reference.Direction anchored_overlays_place_reference.PlacementPolicy.direction

resolved away before the solve

direction
==
(enum) anchored_overlays_place_reference.Direction

Reading 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)0u
ltr
)
return
(parameter) const(anchored_overlays_place_reference.PlacementPolicy) p
p
;
(struct) anchored_overlays_place_reference.PlacementPolicy

The 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 r
r
=
(parameter) const(anchored_overlays_place_reference.PlacementPolicy) p
p
;
(local variable) anchored_overlays_place_reference.PlacementPolicy r
r
.
(field) anchored_overlays_place_reference.Direction anchored_overlays_place_reference.PlacementPolicy.direction

resolved away before the solve

direction
=
(enum) anchored_overlays_place_reference.Direction

Reading 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)0u
ltr
;
(local variable) anchored_overlays_place_reference.PlacementPolicy r
r
.
(field) int anchored_overlays_place_reference.PlacementPolicy.alignOffset

a nudge along the edge axis, in cells

alignOffset
= -
(parameter) const(anchored_overlays_place_reference.PlacementPolicy) p
p
.
(field) int anchored_overlays_place_reference.PlacementPolicy.alignOffset

a nudge along the edge axis, in cells

alignOffset
;
if (
(parameter) const(anchored_overlays_place_reference.PlacementPolicy) p
p
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.side

the preferred anchor edge

side
==
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.left = 2

left of the anchor

left
)
(local variable) anchored_overlays_place_reference.PlacementPolicy r
r
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.side

the preferred anchor edge

side
=
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.right = 3

right of the anchor

right
;
else if (
(parameter) const(anchored_overlays_place_reference.PlacementPolicy) p
p
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.side

the preferred anchor edge

side
==
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.right = 3

right of the anchor

right
)
(local variable) anchored_overlays_place_reference.PlacementPolicy r
r
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.side

the preferred anchor edge

side
=
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.left = 2

left of the anchor

left
;
else
(local variable) anchored_overlays_place_reference.PlacementPolicy r
r
.
(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 @safe

The mirrored alignment. center is its own mirror.

mirror
(
(parameter) const(anchored_overlays_place_reference.PlacementPolicy) p
p
.
(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 r
r
;
} /** 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.PlacedOverlay

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, ../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 @safe

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.

place
(in
(struct) anchored_overlays_place_reference.Anchor

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).

Anchor
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
, in
(struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])
Size
(parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) content
content
, in
(struct) sparkles.ui.geometry.Rect

A 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) boundary
boundary
,
in
(struct) anchored_overlays_place_reference.PlacementPolicy

The 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) policy
policy
) @safe pure nothrow @nogc
in (
(parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) content
content
.
(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).width
width
> 0 &&
(parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) content
content
.
(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).height
height
> 0, "an empty overlay is not a placement problem")
in (!
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
.
bool sparkles.ui.geometry.Rect.empty() const pure nothrow @nogc @safe

true 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) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
>=
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
&&
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
>=
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The 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) req
req
=
anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.physical(in anchored_overlays_place_reference.PlacementPolicy p) pure nothrow @nogc @safe

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.

physical
(
(parameter) const(anchored_overlays_place_reference.PlacementPolicy) policy
policy
);
const
(local variable) const(bool) vertical
vertical
=
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.side

the preferred anchor edge

side
==
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.top = cast(ubyte)0u

above the anchor

top
||
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.side

the preferred anchor edge

side
==
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.bottom = 1

below the anchor

bottom
;
// --- main (side) axis -------------------------------------------------- const int
(local variable) const(int) bLo
bLo
=
(local variable) const(bool) vertical
vertical
?
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
:
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
;
const int
(local variable) const(int) bHi
bHi
=
(local variable) const(bool) vertical
vertical
?
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
.
int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

bottom
:
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
;
const int
(local variable) const(int) aLo
aLo
=
(local variable) const(bool) vertical
vertical
?
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
:
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
;
const int
(local variable) const(int) aHi
aHi
=
(local variable) const(bool) vertical
vertical
?
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

bottom
:
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
;
const int
(local variable) const(int) mainWant
mainWant
=
(local variable) const(bool) vertical
vertical
?
(parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) content
content
.
(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).height
height
:
(parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) content
content
.
(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).width
width
;
// 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 atEnd
atEnd
=
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.side

the preferred anchor edge

side
==
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.bottom = 1

below the anchor

bottom
||
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.side

the preferred anchor edge

side
==
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.right = 3

right of the anchor

right
;
int
(local variable) int room
room
=
(local variable) bool atEnd
atEnd
?
(local variable) const(int) bHi
bHi
- (
(local variable) const(int) aHi
aHi
+
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) int anchored_overlays_place_reference.PlacementPolicy.sideOffset

the gutter, in cells, applied BEFORE testing

sideOffset
) : (
(local variable) const(int) aLo
aLo
-
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) int anchored_overlays_place_reference.PlacementPolicy.sideOffset

the gutter, in cells, applied BEFORE testing

sideOffset
) -
(local variable) const(int) bLo
bLo
;
int
(local variable) int other
other
=
(local variable) bool atEnd
atEnd
? (
(local variable) const(int) aLo
aLo
-
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) int anchored_overlays_place_reference.PlacementPolicy.sideOffset

the gutter, in cells, applied BEFORE testing

sideOffset
) -
(local variable) const(int) bLo
bLo
:
(local variable) const(int) bHi
bHi
- (
(local variable) const(int) aHi
aHi
+
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) int anchored_overlays_place_reference.PlacementPolicy.sideOffset

the gutter, in cells, applied BEFORE testing

sideOffset
);
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
(local variable) anchored_overlays_place_reference.Adjust applied
applied
=
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.none = cast(ubyte)0u
none
;
bool
(local variable) bool flippedMain
flippedMain
;
if (
(local variable) const(int) mainWant
mainWant
>
(local variable) int room
room
&&
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjust

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.

adjust
.
bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safe

Bit tests spelled once, so the solver reads as prose.

has
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.flipMain = cast(ubyte)1u

cross to the opposite side of the anchor

flipMain
))
{ const
(local variable) const(bool) accept
accept
=
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) anchored_overlays_place_reference.FlipAcceptance anchored_overlays_place_reference.PlacementPolicy.acceptance
acceptance
==
(enum) anchored_overlays_place_reference.FlipAcceptance

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.

FlipAcceptance
.
(enum value) anchored_overlays_place_reference.FlipAcceptance.revertUnlessFree = cast(ubyte)0u
revertUnlessFree
?
(local variable) const(int) mainWant
mainWant
<=
(local variable) int other
other
// xdg: revert unless the flip is FULLY free
:
(local variable) int other
other
>
(local variable) int room
room
; // gtk4: accept whenever it is less bad
if (
(local variable) const(bool) accept
accept
)
{
(local variable) bool flippedMain
flippedMain
= true;
(local variable) bool atEnd
atEnd
= !
(local variable) bool atEnd
atEnd
;
const
(local variable) const(int) swap
swap
=
(local variable) int room
room
;
(local variable) int room
room
=
(local variable) int other
other
;
(local variable) int other
other
=
(local variable) const(int) swap
swap
;
(local variable) anchored_overlays_place_reference.Adjust applied
applied
=
(local variable) anchored_overlays_place_reference.Adjust applied
applied
.
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 @safe

Bit tests spelled once, so the solver reads as prose.

plus
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.flipMain = cast(ubyte)1u

cross to the opposite side of the anchor

flipMain
);
} } int
(local variable) int mainLen
mainLen
=
(local variable) const(int) mainWant
mainWant
;
if (
(local variable) int mainLen
mainLen
>
(local variable) int room
room
&&
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjust

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.

adjust
.
bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safe

Bit tests spelled once, so the solver reads as prose.

has
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.resizeMain = cast(ubyte)16u

shrink to the room at the resolved side

resizeMain
))
{
(local variable) int mainLen
mainLen
=
(local variable) int room
room
> 1 ?
(local variable) int room
room
: 1;
(local variable) anchored_overlays_place_reference.Adjust applied
applied
=
(local variable) anchored_overlays_place_reference.Adjust applied
applied
.
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 @safe

Bit tests spelled once, so the solver reads as prose.

plus
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.resizeMain = cast(ubyte)16u

shrink to the room at the resolved side

resizeMain
);
} int
(local variable) int mainPos
mainPos
=
(local variable) bool atEnd
atEnd
?
(local variable) const(int) aHi
aHi
+
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) int anchored_overlays_place_reference.PlacementPolicy.sideOffset

the gutter, in cells, applied BEFORE testing

sideOffset
:
(local variable) const(int) aLo
aLo
-
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) int anchored_overlays_place_reference.PlacementPolicy.sideOffset

the gutter, in cells, applied BEFORE testing

sideOffset
-
(local variable) int mainLen
mainLen
;
const int
(local variable) const(int) mainAsked
mainAsked
=
(local variable) int mainPos
mainPos
;
if (
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjust

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.

adjust
.
bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safe

Bit tests spelled once, so the solver reads as prose.

has
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.slideMain = cast(ubyte)2u

shift along the side axis (detaches; opt-in)

slideMain
) &&
(local variable) int mainPos
mainPos
+
(local variable) int mainLen
mainLen
>
(local variable) const(int) bHi
bHi
)
(local variable) int mainPos
mainPos
=
(local variable) const(int) bHi
bHi
-
(local variable) int mainLen
mainLen
;
if (
(local variable) int mainPos
mainPos
<
(local variable) const(int) bLo
bLo
)
(local variable) int mainPos
mainPos
=
(local variable) const(int) bLo
bLo
; // the START pin — to the boundary, not to 0
if (
(local variable) int mainPos
mainPos
!=
(local variable) const(int) mainAsked
mainAsked
)
(local variable) anchored_overlays_place_reference.Adjust applied
applied
=
(local variable) anchored_overlays_place_reference.Adjust applied
applied
.
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 @safe

Bit tests spelled once, so the solver reads as prose.

plus
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.slideMain = cast(ubyte)2u

shift along the side axis (detaches; opt-in)

slideMain
);
// --- cross (edge) axis ------------------------------------------------- const int
(local variable) const(int) cbLo
cbLo
=
(local variable) const(bool) vertical
vertical
?
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
:
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
;
const int
(local variable) const(int) cbHi
cbHi
=
(local variable) const(bool) vertical
vertical
?
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
:
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
.
int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

bottom
;
const int
(local variable) const(int) caLo
caLo
=
(local variable) const(bool) vertical
vertical
?
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
:
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
;
const int
(local variable) const(int) caHi
caHi
=
(local variable) const(bool) vertical
vertical
?
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
:
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

bottom
;
const int
(local variable) const(int) crossWant
crossWant
=
(local variable) const(bool) vertical
vertical
?
(parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) content
content
.
(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).width
width
:
(parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) content
content
.
(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).height
height
;
int
(local variable) int crossLen
crossLen
=
(local variable) const(int) crossWant
crossWant
;
if (
(local variable) int crossLen
crossLen
>
(local variable) const(int) cbHi
cbHi
-
(local variable) const(int) cbLo
cbLo
&&
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjust

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.

adjust
.
bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safe

Bit tests spelled once, so the solver reads as prose.

has
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.resizeCross = cast(ubyte)32u

shrink to the boundary's cross extent (opt-in)

resizeCross
))
{
(local variable) int crossLen
crossLen
=
(local variable) const(int) cbHi
cbHi
-
(local variable) const(int) cbLo
cbLo
;
(local variable) anchored_overlays_place_reference.Adjust applied
applied
=
(local variable) anchored_overlays_place_reference.Adjust applied
applied
.
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 @safe

Bit tests spelled once, so the solver reads as prose.

plus
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.resizeCross = cast(ubyte)32u

shrink 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 @safe
alignedAt
(
(enum) anchored_overlays_place_reference.Align

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 physical.

Align
(parameter) anchored_overlays_place_reference.Align a
a
) =>
(parameter) anchored_overlays_place_reference.Align a
a
==
(enum) anchored_overlays_place_reference.Align

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 physical.

Align
.
(enum value) anchored_overlays_place_reference.Align.start = cast(ubyte)0u
start
?
(local variable) const(int) caLo
caLo
: (
(parameter) anchored_overlays_place_reference.Align a
a
==
(enum) anchored_overlays_place_reference.Align

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 physical.

Align
.
(enum value) anchored_overlays_place_reference.Align.end = 2
end
?
(local variable) const(int) caHi
caHi
-
(local variable) int crossLen
crossLen
:
(local variable) const(int) caLo
caLo
+ ((
(local variable) const(int) caHi
caHi
-
(local variable) const(int) caLo
caLo
) -
(local variable) int crossLen
crossLen
) / 2);
(enum) anchored_overlays_place_reference.Align

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 physical.

Align
(local variable) anchored_overlays_place_reference.Align align_
align_
=
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacementPolicy.align_

the preferred cross-axis alignment

align_
;
int
(local variable) int crossPos
crossPos
=
int anchored_overlays_place_reference.place.alignedAt(anchored_overlays_place_reference.Align a) pure nothrow @nogc @safe
alignedAt
(
(local variable) anchored_overlays_place_reference.Align align_
align_
) +
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) int anchored_overlays_place_reference.PlacementPolicy.alignOffset

a nudge along the edge axis, in cells

alignOffset
;
// RTL mirroring already happened in `physical`; report it as a cross flip. bool
(local variable) bool flippedCross
flippedCross
=
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(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) policy
policy
.
(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) req
req
.
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjust

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.

adjust
.
bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safe

Bit tests spelled once, so the solver reads as prose.

has
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.flipCross = cast(ubyte)4u

mirror the alignment (opt-in; Floating UI's rule)

flipCross
) && (
(local variable) int crossPos
crossPos
<
(local variable) const(int) cbLo
cbLo
||
(local variable) int crossPos
crossPos
+
(local variable) int crossLen
crossLen
>
(local variable) const(int) cbHi
cbHi
))
{ const
(local variable) const(anchored_overlays_place_reference.Align) m
m
=
anchored_overlays_place_reference.Align anchored_overlays_place_reference.mirror(anchored_overlays_place_reference.Align a) pure nothrow @nogc @safe

The mirrored alignment. center is its own mirror.

mirror
(
(local variable) anchored_overlays_place_reference.Align align_
align_
);
const
(local variable) const(int) mp
mp
=
int anchored_overlays_place_reference.place.alignedAt(anchored_overlays_place_reference.Align a) pure nothrow @nogc @safe
alignedAt
(
(local variable) const(anchored_overlays_place_reference.Align) m
m
) +
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) int anchored_overlays_place_reference.PlacementPolicy.alignOffset

a nudge along the edge axis, in cells

alignOffset
;
if (
(local variable) const(int) mp
mp
>=
(local variable) const(int) cbLo
cbLo
&&
(local variable) const(int) mp
mp
+
(local variable) int crossLen
crossLen
<=
(local variable) const(int) cbHi
cbHi
)
{
(local variable) anchored_overlays_place_reference.Align align_
align_
=
(local variable) const(anchored_overlays_place_reference.Align) m
m
;
(local variable) int crossPos
crossPos
=
(local variable) const(int) mp
mp
;
(local variable) bool flippedCross
flippedCross
= !
(local variable) bool flippedCross
flippedCross
;
(local variable) anchored_overlays_place_reference.Adjust applied
applied
=
(local variable) anchored_overlays_place_reference.Adjust applied
applied
.
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 @safe

Bit tests spelled once, so the solver reads as prose.

plus
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.flipCross = cast(ubyte)4u

mirror the alignment (opt-in; Floating UI's rule)

flipCross
);
} } const int
(local variable) const(int) crossAsked
crossAsked
=
(local variable) int crossPos
crossPos
;
if (
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjust

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.

adjust
.
bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safe

Bit tests spelled once, so the solver reads as prose.

has
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.slideCross = cast(ubyte)8u

shift along the edge axis

slideCross
) &&
(local variable) int crossPos
crossPos
+
(local variable) int crossLen
crossLen
>
(local variable) const(int) cbHi
cbHi
)
(local variable) int crossPos
crossPos
=
(local variable) const(int) cbHi
cbHi
-
(local variable) int crossLen
crossLen
; // end edge first …
if (
(local variable) int crossPos
crossPos
<
(local variable) const(int) cbLo
cbLo
)
(local variable) int crossPos
crossPos
=
(local variable) const(int) cbLo
cbLo
; // … START pin last, so the start edge wins
if (
(local variable) int crossPos
crossPos
!=
(local variable) const(int) crossAsked
crossAsked
)
(local variable) anchored_overlays_place_reference.Adjust applied
applied
=
(local variable) anchored_overlays_place_reference.Adjust applied
applied
.
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 @safe

Bit tests spelled once, so the solver reads as prose.

plus
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.slideCross = cast(ubyte)8u

shift along the edge axis

slideCross
);
const
(local variable) const(sparkles.ui.geometry.Rect) rect
rect
=
(local variable) const(bool) vertical
vertical
?
(struct) sparkles.ui.geometry.Rect

A 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 @safe

From an origin + extent, or from the four components directly (the spelling every call site uses).

crossPos
,
(local variable) int mainPos
mainPos
,
(local variable) int crossLen
crossLen
,
(local variable) int mainLen
mainLen
)
:
(struct) sparkles.ui.geometry.Rect

A 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 @safe

From an origin + extent, or from the four components directly (the spelling every call site uses).

mainPos
,
(local variable) int crossPos
crossPos
,
(local variable) int mainLen
mainLen
,
(local variable) int crossLen
crossLen
);
// --- 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 arrowCell
arrowCell
= -1;
bool
(local variable) bool arrowCentred
arrowCentred
;
if (
(parameter) const(anchored_overlays_place_reference.PlacementPolicy) policy
policy
.
(field) bool anchored_overlays_place_reference.PlacementPolicy.arrow

reserve an arrow cell on the attached edge

arrow
&&
(local variable) int crossLen
crossLen
>= 3)
{ const int
(local variable) const(int) lo
lo
= 1,
(local variable) const(int) hi
hi
=
(local variable) int crossLen
crossLen
- 2;
assert(
(local variable) const(int) lo
lo
<=
(local variable) const(int) hi
hi
, "an arrow interval must never invert");
const int
(local variable) const(int) want
want
=
(local variable) const(int) caLo
caLo
+ (
(local variable) const(int) caHi
caHi
-
(local variable) const(int) caLo
caLo
) / 2 -
(local variable) int crossPos
crossPos
;
(local variable) int arrowCell
arrowCell
=
(local variable) const(int) want
want
<
(local variable) const(int) lo
lo
?
(local variable) const(int) lo
lo
: (
(local variable) const(int) want
want
>
(local variable) const(int) hi
hi
?
(local variable) const(int) hi
hi
:
(local variable) const(int) want
want
);
(local variable) bool arrowCentred
arrowCentred
=
(local variable) int arrowCell
arrowCell
==
(local variable) const(int) want
want
;
} const
(local variable) const(bool) inside
inside
=
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
.
sparkles.ui.geometry.Rect sparkles.ui.geometry.Rect.intersection(in sparkles.ui.geometry.Rect other) const pure nothrow @nogc @safe

The overlap of two rectangles (an empty one when disjoint).

intersection
(
(local variable) const(sparkles.ui.geometry.Rect) rect
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 @safe

Component-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) fit
fit
= !
(local variable) const(bool) inside
inside
?
(enum) anchored_overlays_place_reference.Fit

How good the resulting placement is, worst-wins.

Fit
.
(enum value) anchored_overlays_place_reference.Fit.overflowing = 4

it does not fit and we are the host — nobody clips for us

overflowing
:
(local variable) anchored_overlays_place_reference.Adjust applied
applied
.
bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safe

Bit tests spelled once, so the solver reads as prose.

has
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.resizeMain = cast(ubyte)16u

shrink to the room at the resolved side

resizeMain
) ||
(local variable) anchored_overlays_place_reference.Adjust applied
applied
.
bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safe

Bit tests spelled once, so the solver reads as prose.

has
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.resizeCross = cast(ubyte)32u

shrink to the boundary's cross extent (opt-in)

resizeCross
)
?
(enum) anchored_overlays_place_reference.Fit

How good the resulting placement is, worst-wins.

Fit
.
(enum value) anchored_overlays_place_reference.Fit.shrunk = 3

the content was capped

shrunk
:
(local variable) bool flippedMain
flippedMain
||
(local variable) anchored_overlays_place_reference.Adjust applied
applied
.
bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safe

Bit tests spelled once, so the solver reads as prose.

has
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.flipCross = cast(ubyte)4u

mirror the alignment (opt-in; Floating UI's rule)

flipCross
)
?
(enum) anchored_overlays_place_reference.Fit

How good the resulting placement is, worst-wins.

Fit
.
(enum value) anchored_overlays_place_reference.Fit.flipped = 2

crossed to the other side of the anchor

flipped
:
(local variable) anchored_overlays_place_reference.Adjust applied
applied
.
bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safe

Bit tests spelled once, so the solver reads as prose.

has
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.slideCross = cast(ubyte)8u

shift along the edge axis

slideCross
) ||
(local variable) anchored_overlays_place_reference.Adjust applied
applied
.
bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safe

Bit tests spelled once, so the solver reads as prose.

has
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.slideMain = cast(ubyte)2u

shift along the side axis (detaches; opt-in)

slideMain
)
?
(enum) anchored_overlays_place_reference.Fit

How good the resulting placement is, worst-wins.

Fit
.
(enum value) anchored_overlays_place_reference.Fit.slid = 1

shifted along an axis to stay inside

slid
:
(enum) anchored_overlays_place_reference.Fit

How good the resulting placement is, worst-wins.

Fit
.
(enum value) anchored_overlays_place_reference.Fit.exact = cast(ubyte)0u

placed as asked

exact
;
return
(struct) anchored_overlays_place_reference.PlacedOverlay

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, ../avalonia.md and hue's three clampOrigin call sites each ended up doing, differently.

PlacedOverlay
(
rect:
(local variable) const(sparkles.ui.geometry.Rect) rect
rect
,
side:
(local variable) bool flippedMain
flippedMain
?
anchored_overlays_place_reference.Side anchored_overlays_place_reference.opposite(anchored_overlays_place_reference.Side s) pure nothrow @nogc @safe

The opposite side, for a main-axis flip.

opposite
(
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.side

the preferred anchor edge

side
) :
(local variable) const(anchored_overlays_place_reference.PlacementPolicy) req
req
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.side

the preferred anchor edge

side
,
align_:
(local variable) anchored_overlays_place_reference.Align align_
align_
,
arrowCell:
(local variable) int arrowCell
arrowCell
,
arrowCentred:
(local variable) bool arrowCentred
arrowCentred
,
flippedMain:
(local variable) bool flippedMain
flippedMain
,
flippedCross:
(local variable) bool flippedCross
flippedCross
,
anchorHidden:
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
.
bool anchored_overlays_place_reference.Anchor.hidden() const pure nothrow @nogc @safe

The anchor left its clip entirely — a HIDE verdict, not a close.

hidden
,
available:
(local variable) const(bool) vertical
vertical
?
(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 @safe

Initializes the first i components from constructor arguments.

cbHi
-
(local variable) const(int) cbLo
cbLo
,
(local variable) int room
room
) :
(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 @safe

Initializes the first i components from constructor arguments.

room
,
(local variable) const(int) cbHi
cbHi
-
(local variable) const(int) cbLo
cbLo
),
applied:
(local variable) anchored_overlays_place_reference.Adjust applied
applied
,
fit:
(local variable) const(anchored_overlays_place_reference.Fit) fit
fit
,
); } /** `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 @safe

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.

clampOriginToday
(int
(parameter) int anchor
anchor
, int
(parameter) int width
width
, int
(parameter) int extent
extent
) @safe pure nothrow @nogc
{ const
(local variable) const(int) over
over
=
(parameter) int anchor
anchor
+
(parameter) int width
width
-
(parameter) int extent
extent
;
const
(local variable) const(int) shifted
shifted
=
(local variable) const(int) over
over
> 0 ?
(parameter) int anchor
anchor
-
(local variable) const(int) over
over
:
(parameter) int anchor
anchor
;
return
(local variable) const(int) shifted
shifted
< 0 ? 0 :
(local variable) const(int) shifted
shifted
;
} // --------------------------------------------------------------------------- // 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) @safe
checkInvariants
(in
(struct) anchored_overlays_place_reference.Anchor

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).

Anchor
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
, in
(struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])
Size
(parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) content
content
, in
(struct) sparkles.ui.geometry.Rect

A 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) boundary
boundary
,
in
(struct) anchored_overlays_place_reference.PlacementPolicy

The 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) policy
policy
, in
(struct) anchored_overlays_place_reference.PlacedOverlay

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, ../avalonia.md and hue's three clampOrigin call sites each ended up doing, differently.

PlacedOverlay
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
) @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) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
>=
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
&&
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
>=
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The 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) r
r
.
(field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fit

the worst thing that happened

fit
!=
(enum) anchored_overlays_place_reference.Fit

How good the resulting placement is, worst-wins.

Fit
.
(enum value) anchored_overlays_place_reference.Fit.overflowing = 4

it does not fit and we are the host — nobody clips for us

overflowing
)
assert(
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
.
sparkles.ui.geometry.Rect sparkles.ui.geometry.Rect.intersection(in sparkles.ui.geometry.Rect other) const pure nothrow @nogc @safe

The overlap of two rectangles (an empty one when disjoint).

intersection
(
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, 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 @safe

Component-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 @safe

Component-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) vertical
vertical
=
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.side

post-flip anchor edge we attached to

side
==
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.top = cast(ubyte)0u

above the anchor

top
||
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.side

post-flip anchor edge we attached to

side
==
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.bottom = 1

below the anchor

bottom
;
const
(local variable) const(int) edgeLen
edgeLen
=
(local variable) const(bool) vertical
vertical
?
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

width
:
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.height() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

height
;
if (
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCell

overlay-local index along the attached edge; -1 = none

arrowCell
>= 0)
{ assert(
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCell

overlay-local index along the attached edge; -1 = none

arrowCell
>= 1 &&
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCell

overlay-local index along the attached edge; -1 = none

arrowCell
<=
(local variable) const(int) edgeLen
edgeLen
- 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) r
r
.
(field) bool anchored_overlays_place_reference.PlacedOverlay.arrowCentred

false ⇒ the arrow could not reach the anchor's centre

arrowCentred
)
{ const
(local variable) const(int) base
base
=
(local variable) const(bool) vertical
vertical
?
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
:
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
;
const
(local variable) const(int) aLo
aLo
=
(local variable) const(bool) vertical
vertical
?
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
:
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
;
const
(local variable) const(int) aHi
aHi
=
(local variable) const(bool) vertical
vertical
?
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
:
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

bottom
;
assert(
(local variable) const(int) base
base
+
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCell

overlay-local index along the attached edge; -1 = none

arrowCell
==
(local variable) const(int) aLo
aLo
+ (
(local variable) const(int) aHi
aHi
-
(local variable) const(int) aLo
aLo
) / 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.PlacementPolicy

The 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 again
again
=
(parameter) const(anchored_overlays_place_reference.PlacementPolicy) policy
policy
;
(local variable) anchored_overlays_place_reference.PlacementPolicy again
again
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.side

the preferred anchor edge

side
=
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.side

post-flip anchor edge we attached to

side
;
(local variable) anchored_overlays_place_reference.PlacementPolicy again
again
.
(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) r
r
.
(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 again
again
.
(field) anchored_overlays_place_reference.Direction anchored_overlays_place_reference.PlacementPolicy.direction

resolved away before the solve

direction
=
(enum) anchored_overlays_place_reference.Direction

Reading 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)0u
ltr
;
(local variable) anchored_overlays_place_reference.PlacementPolicy again
again
.
(field) int anchored_overlays_place_reference.PlacementPolicy.alignOffset

a nudge along the edge axis, in cells

alignOffset
=
(parameter) const(anchored_overlays_place_reference.PlacementPolicy) policy
policy
.
(field) anchored_overlays_place_reference.Direction anchored_overlays_place_reference.PlacementPolicy.direction

resolved away before the solve

direction
==
(enum) anchored_overlays_place_reference.Direction

Reading direction. An input to the resolution step, never a flag consulted inside the solver.

Direction
.
(enum value) anchored_overlays_place_reference.Direction.rtl = 1
rtl
? -
(parameter) const(anchored_overlays_place_reference.PlacementPolicy) policy
policy
.
(field) int anchored_overlays_place_reference.PlacementPolicy.alignOffset

a nudge along the edge axis, in cells

alignOffset
:
(parameter) const(anchored_overlays_place_reference.PlacementPolicy) policy
policy
.
(field) int anchored_overlays_place_reference.PlacementPolicy.alignOffset

a nudge along the edge axis, in cells

alignOffset
;
const
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) twice
twice
=
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 @safe

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.

place
(
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
,
(parameter) const(sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])) content
content
,
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
,
(local variable) anchored_overlays_place_reference.PlacementPolicy again
again
);
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) twice
twice
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, 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 @safe

Component-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 @safe

Component-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) twice
twice
.
(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCell

overlay-local index along the attached edge; -1 = none

arrowCell
==
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCell

overlay-local index along the attached edge; -1 = none

arrowCell
, "re-placement moved the arrow");
assert(!
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) twice
twice
.
(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedMain

the side axis crossed to the other side of the anchor

flippedMain
&& !
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) twice
twice
.
(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedCross

the 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.Grid

A character grid covering world, so a placement can be seen.

Grid
{ enum int
(constant) int anchored_overlays_place_reference.Grid.maxW = 96
maxW
= 96,
(constant) int anchored_overlays_place_reference.Grid.maxH = 40
maxH
= 40;
(struct) sparkles.ui.geometry.Rect

A 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.world
world
;
char[
(constant) int anchored_overlays_place_reference.Grid.maxW = 96
maxW
*
(constant) int anchored_overlays_place_reference.Grid.maxH = 40
maxH
]
(field) char[3840] anchored_overlays_place_reference.Grid.cells
cells
= '.';
@safe pure nothrow @nogc: this(in
(struct) sparkles.ui.geometry.Rect

A 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) world
world
)
in (
(parameter) const(sparkles.ui.geometry.Rect) world
world
.
int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

width
> 0 &&
(parameter) const(sparkles.ui.geometry.Rect) world
world
.
int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

width
<=
(constant) int anchored_overlays_place_reference.Grid.maxW = 96
maxW
, "world too wide to draw")
in (
(parameter) const(sparkles.ui.geometry.Rect) world
world
.
int sparkles.ui.geometry.Rect.height() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

height
> 0 &&
(parameter) const(sparkles.ui.geometry.Rect) world
world
.
int sparkles.ui.geometry.Rect.height() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

height
<=
(constant) int anchored_overlays_place_reference.Grid.maxH = 40
maxH
, "world too tall to draw")
{ this.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Grid.world
world
=
(parameter) const(sparkles.ui.geometry.Rect) world
world
;
(field) char[3840] anchored_overlays_place_reference.Grid.cells
cells
[] = '.';
} void
void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safe
set
(int
(parameter) int x
x
, int
(parameter) int y
y
, char
(parameter) char c
c
) scope
{ if (
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Grid.world
world
.
bool sparkles.ui.geometry.Rect.contains(in sparkles.math.vector.Vector!(int, 2LU, ["x", "y"]) p) const pure nothrow @nogc @safe

true 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 @safe

Initializes 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 @safe

Initializes the first i components from constructor arguments.

y
)))
(field) char[3840] anchored_overlays_place_reference.Grid.cells
cells
[(
(parameter) int y
y
-
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Grid.world
world
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
) *
(constant) int anchored_overlays_place_reference.Grid.maxW = 96
maxW
+ (
(parameter) int x
x
-
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Grid.world
world
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
)] =
(parameter) char c
c
;
} void
void anchored_overlays_place_reference.Grid.fill(in sparkles.ui.geometry.Rect r, char c) pure nothrow @nogc @safe
fill
(in
(struct) sparkles.ui.geometry.Rect

A 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) r
r
, char
(parameter) char c
c
) scope
{ foreach (
(local variable) int y
y
;
(parameter) const(sparkles.ui.geometry.Rect) r
r
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
..
(parameter) const(sparkles.ui.geometry.Rect) r
r
.
int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

bottom
)
foreach (
(local variable) int x
x
;
(parameter) const(sparkles.ui.geometry.Rect) r
r
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
..
(parameter) const(sparkles.ui.geometry.Rect) r
r
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
)
void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safe
set
(
(local variable) int x
x
,
(local variable) int y
y
,
(parameter) char c
c
);
} } /// The union of two rectangles (either may be empty).
(struct) sparkles.ui.geometry.Rect

A 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 @safe

The union of two rectangles (either may be empty).

unite
(in
(struct) sparkles.ui.geometry.Rect

A 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) a
a
, in
(struct) sparkles.ui.geometry.Rect

A 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) b
b
) @safe pure nothrow @nogc
{ if (
(parameter) const(sparkles.ui.geometry.Rect) a
a
.
bool sparkles.ui.geometry.Rect.empty() const pure nothrow @nogc @safe

true iff the rectangle covers no cells.

empty
)
return
(parameter) const(sparkles.ui.geometry.Rect) b
b
;
if (
(parameter) const(sparkles.ui.geometry.Rect) b
b
.
bool sparkles.ui.geometry.Rect.empty() const pure nothrow @nogc @safe

true iff the rectangle covers no cells.

empty
)
return
(parameter) const(sparkles.ui.geometry.Rect) a
a
;
const
(local variable) const(int) x0
x0
=
(parameter) const(sparkles.ui.geometry.Rect) a
a
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
<
(parameter) const(sparkles.ui.geometry.Rect) b
b
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
?
(parameter) const(sparkles.ui.geometry.Rect) a
a
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
:
(parameter) const(sparkles.ui.geometry.Rect) b
b
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
;
const
(local variable) const(int) y0
y0
=
(parameter) const(sparkles.ui.geometry.Rect) a
a
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
<
(parameter) const(sparkles.ui.geometry.Rect) b
b
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
?
(parameter) const(sparkles.ui.geometry.Rect) a
a
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
:
(parameter) const(sparkles.ui.geometry.Rect) b
b
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
;
const
(local variable) const(int) x1
x1
=
(parameter) const(sparkles.ui.geometry.Rect) a
a
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
>
(parameter) const(sparkles.ui.geometry.Rect) b
b
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
?
(parameter) const(sparkles.ui.geometry.Rect) a
a
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
:
(parameter) const(sparkles.ui.geometry.Rect) b
b
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
;
const
(local variable) const(int) y1
y1
=
(parameter) const(sparkles.ui.geometry.Rect) a
a
.
int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

bottom
>
(parameter) const(sparkles.ui.geometry.Rect) b
b
.
int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

bottom
?
(parameter) const(sparkles.ui.geometry.Rect) a
a
.
int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

bottom
:
(parameter) const(sparkles.ui.geometry.Rect) b
b
.
int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

bottom
;
return
(struct) sparkles.ui.geometry.Rect

A 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 @safe

From 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 @safe

From an origin + extent, or from the four components directly (the spelling every call site uses).

y0
,
(local variable) const(int) x1
x1
-
(local variable) const(int) x0
x0
,
(local variable) const(int) y1
y1
-
(local variable) const(int) y0
y0
);
} /// `r` grown by `n` cells on every side.
(struct) sparkles.ui.geometry.Rect

A 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 @safe

r grown by n cells on every side.

inflate
(in
(struct) sparkles.ui.geometry.Rect

A 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) r
r
, int
(parameter) int n
n
) @safe pure nothrow @nogc
=>
(struct) sparkles.ui.geometry.Rect

A 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 @safe

From 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 @safe

From an origin + extent, or from the four components directly (the spelling every call site uses).

x
-
(parameter) int n
n
,
(parameter) const(sparkles.ui.geometry.Rect) r
r
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
-
(parameter) int n
n
,
(parameter) const(sparkles.ui.geometry.Rect) r
r
.
int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

width
+ 2 *
(parameter) int n
n
,
(parameter) const(sparkles.ui.geometry.Rect) r
r
.
int sparkles.ui.geometry.Rect.height() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

height
+ 2 *
(parameter) int n
n
);
/// 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 @safe

The arrow glyph for the edge the overlay attached along.

arrowGlyph
(
(enum) anchored_overlays_place_reference.Side

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.

Side
(parameter) anchored_overlays_place_reference.Side s
s
) @safe pure nothrow @nogc
{ final switch (
(parameter) anchored_overlays_place_reference.Side s
s
)
{ case
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.bottom = 1

below the anchor

bottom
: return '^'; // overlay below ⇒ arrow on its top edge
case
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.top = cast(ubyte)0u

above the anchor

top
: return 'v';
case
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.right = 3

right of the anchor

right
: return '<';
case
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.left = 2

left of the anchor

left
: return '>';
} } /// Paint the boundary frame, the anchor and the placed overlay into one grid.
(struct) anchored_overlays_place_reference.Grid

A 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 @safe

Paint the boundary frame, the anchor and the placed overlay into one grid.

draw
(in
(struct) anchored_overlays_place_reference.Anchor

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).

Anchor
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
, in
(struct) sparkles.ui.geometry.Rect

A 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) boundary
boundary
, in
(struct) anchored_overlays_place_reference.PlacedOverlay

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, ../avalonia.md and hue's three clampOrigin call sites each ended up doing, differently.

PlacedOverlay
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
) @safe pure nothrow @nogc
{ const
(local variable) const(sparkles.ui.geometry.Rect) world
world
=
sparkles.ui.geometry.Rect anchored_overlays_place_reference.unite(in sparkles.ui.geometry.Rect a, in sparkles.ui.geometry.Rect b) pure nothrow @nogc @safe

The 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 @safe

r grown by n cells on every side.

inflate
(
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
, 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 @safe

The union of two rectangles (either may be empty).

unite
(
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
,
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
));
auto
(local variable) anchored_overlays_place_reference.Grid g
g
=
(struct) anchored_overlays_place_reference.Grid

A 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 @safe
world
);
(local variable) anchored_overlays_place_reference.Grid g
g
.
void anchored_overlays_place_reference.Grid.fill(in sparkles.ui.geometry.Rect r, char c) pure nothrow @nogc @safe
fill
(
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
, ' ');
// 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) f
f
=
sparkles.ui.geometry.Rect anchored_overlays_place_reference.inflate(in sparkles.ui.geometry.Rect r, int n) pure nothrow @nogc @safe

r grown by n cells on every side.

inflate
(
(parameter) const(sparkles.ui.geometry.Rect) boundary
boundary
, 1);
foreach (
(local variable) int x
x
;
(local variable) const(sparkles.ui.geometry.Rect) f
f
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
..
(local variable) const(sparkles.ui.geometry.Rect) f
f
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
)
{
(local variable) anchored_overlays_place_reference.Grid g
g
.
void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safe
set
(
(local variable) int x
x
,
(local variable) const(sparkles.ui.geometry.Rect) f
f
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
, '-');
(local variable) anchored_overlays_place_reference.Grid g
g
.
void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safe
set
(
(local variable) int x
x
,
(local variable) const(sparkles.ui.geometry.Rect) f
f
.
int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

bottom
- 1, '-');
} foreach (
(local variable) int y
y
;
(local variable) const(sparkles.ui.geometry.Rect) f
f
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
..
(local variable) const(sparkles.ui.geometry.Rect) f
f
.
int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

bottom
)
{
(local variable) anchored_overlays_place_reference.Grid g
g
.
void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safe
set
(
(local variable) const(sparkles.ui.geometry.Rect) f
f
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
,
(local variable) int y
y
, '|');
(local variable) anchored_overlays_place_reference.Grid g
g
.
void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safe
set
(
(local variable) const(sparkles.ui.geometry.Rect) f
f
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
- 1,
(local variable) int y
y
, '|');
}
(local variable) anchored_overlays_place_reference.Grid g
g
.
void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safe
set
(
(local variable) const(sparkles.ui.geometry.Rect) f
f
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
,
(local variable) const(sparkles.ui.geometry.Rect) f
f
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
, '+');
(local variable) anchored_overlays_place_reference.Grid g
g
.
void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safe
set
(
(local variable) const(sparkles.ui.geometry.Rect) f
f
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
- 1,
(local variable) const(sparkles.ui.geometry.Rect) f
f
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
, '+');
(local variable) anchored_overlays_place_reference.Grid g
g
.
void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safe
set
(
(local variable) const(sparkles.ui.geometry.Rect) f
f
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
,
(local variable) const(sparkles.ui.geometry.Rect) f
f
.
int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

bottom
- 1, '+');
(local variable) anchored_overlays_place_reference.Grid g
g
.
void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safe
set
(
(local variable) const(sparkles.ui.geometry.Rect) f
f
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
- 1,
(local variable) const(sparkles.ui.geometry.Rect) f
f
.
int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

bottom
- 1, '+');
(local variable) anchored_overlays_place_reference.Grid g
g
.
void anchored_overlays_place_reference.Grid.fill(in sparkles.ui.geometry.Rect r, char c) pure nothrow @nogc @safe
fill
(
(parameter) const(anchored_overlays_place_reference.Anchor) anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
, 'A');
(local variable) anchored_overlays_place_reference.Grid g
g
.
void anchored_overlays_place_reference.Grid.fill(in sparkles.ui.geometry.Rect r, char c) pure nothrow @nogc @safe
fill
(
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
, '#');
if (
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCell

overlay-local index along the attached edge; -1 = none

arrowCell
>= 0)
{ const
(local variable) const(char) c
c
=
char anchored_overlays_place_reference.arrowGlyph(anchored_overlays_place_reference.Side s) pure nothrow @nogc @safe

The arrow glyph for the edge the overlay attached along.

arrowGlyph
(
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.side

post-flip anchor edge we attached to

side
);
final switch (
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.side

post-flip anchor edge we attached to

side
)
{ case
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.bottom = 1

below the anchor

bottom
:
(local variable) anchored_overlays_place_reference.Grid g
g
.
void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safe
set
(
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
+
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCell

overlay-local index along the attached edge; -1 = none

arrowCell
,
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
,
(local variable) const(char) c
c
); break;
case
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.top = cast(ubyte)0u

above the anchor

top
:
(local variable) anchored_overlays_place_reference.Grid g
g
.
void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safe
set
(
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
+
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCell

overlay-local index along the attached edge; -1 = none

arrowCell
,
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

bottom
- 1,
(local variable) const(char) c
c
); break;
case
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.right = 3

right of the anchor

right
:
(local variable) anchored_overlays_place_reference.Grid g
g
.
void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safe
set
(
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
,
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
+
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCell

overlay-local index along the attached edge; -1 = none

arrowCell
,
(local variable) const(char) c
c
); break;
case
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.left = 2

left of the anchor

left
:
(local variable) anchored_overlays_place_reference.Grid g
g
.
void anchored_overlays_place_reference.Grid.set(int x, int y, char c) pure nothrow @nogc @safe
set
(
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
- 1,
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
+
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCell

overlay-local index along the attached edge; -1 = none

arrowCell
,
(local variable) const(char) c
c
); break;
} } return
(local variable) anchored_overlays_place_reference.Grid g
g
;
} void
void anchored_overlays_place_reference.printGrid(in anchored_overlays_place_reference.Grid g) @safe
printGrid
(in
(struct) anchored_overlays_place_reference.Grid

A character grid covering world, so a placement can be seen.

Grid
(parameter) const(anchored_overlays_place_reference.Grid) g
g
) @safe
{ foreach (
(local variable) int i
i
; 0 ..
(parameter) const(anchored_overlays_place_reference.Grid) g
g
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Grid.world
world
.
int sparkles.ui.geometry.Rect.height() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

height
)
{ char[
(struct) anchored_overlays_place_reference.Grid

A character grid covering world, so a placement can be seen.

Grid
.
(constant) int anchored_overlays_place_reference.Grid.maxW = 96
maxW
]
(local variable) char[96] buf
buf
;
const
(local variable) const(int) w
w
=
(parameter) const(anchored_overlays_place_reference.Grid) g
g
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Grid.world
world
.
int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

width
;
(local variable) char[96] buf
buf
[0 ..
(local variable) const(int) w
w
] =
(parameter) const(anchored_overlays_place_reference.Grid) g
g
.
(field) char[3840] anchored_overlays_place_reference.Grid.cells
cells
[
(local variable) int i
i
*
(struct) anchored_overlays_place_reference.Grid

A character grid covering world, so a placement can be seen.

Grid
.
(constant) int anchored_overlays_place_reference.Grid.maxW = 96
maxW
..
(local variable) int i
i
*
(struct) anchored_overlays_place_reference.Grid

A character grid covering world, so a placement can be seen.

Grid
.
(constant) int anchored_overlays_place_reference.Grid.maxW = 96
maxW
+
(local variable) const(int) w
w
];
void std.stdio.writeln!(string, string)(string __param_0, string __param_1) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(" ",
(local variable) char[96] buf
buf
[0 ..
(local variable) const(int) w
w
].
string object.idup!char(char[] a) pure nothrow @property @safe

Provide the .idup array property, which creates an immutable duplicate.

idup
);
} } // --------------------------------------------------------------------------- // Reporting // ---------------------------------------------------------------------------
(alias) object.string = string
string
string anchored_overlays_place_reference.rectText(in sparkles.ui.geometry.Rect r) @safe
rectText
(in
(struct) sparkles.ui.geometry.Rect

A 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) r
r
) @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 @safe

Examples

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) r
r
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
,
(parameter) const(sparkles.ui.geometry.Rect) r
r
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
,
(parameter) const(sparkles.ui.geometry.Rect) r
r
.
int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

width
,
(parameter) const(sparkles.ui.geometry.Rect) r
r
.
int sparkles.ui.geometry.Rect.height() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

height
);
(alias) object.string = string
string
string anchored_overlays_place_reference.adjustText(anchored_overlays_place_reference.Adjust a) @safe
adjustText
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
(parameter) anchored_overlays_place_reference.Adjust a
a
) @safe
{ if (
(parameter) anchored_overlays_place_reference.Adjust a
a
==
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.none = cast(ubyte)0u
none
)
return "none";
(alias) object.string = string
string
(local variable) string s
s
;
static foreach (name; ["flipMain", "slideMain", "flipCross", "slideCross", "resizeMain", "resizeCross"]) if (
(parameter) anchored_overlays_place_reference.Adjust a
a
.
bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safe

Bit tests spelled once, so the solver reads as prose.

has
(__traits(getMember, Adjust, name)))
(local variable) string s
s
~= (
(local variable) string s
s
.
(field) ulong string.length
length
? "|" : "") ~
(constant) string anchored_overlays_place_reference.adjustText.name = "flipMain"
name
;
return
(local variable) string s
s
;
} /// One row of the case table. struct
(struct) anchored_overlays_place_reference.Case

One row of the case table.

Case
{
(alias) object.string = string
string
(field) string anchored_overlays_place_reference.Case.label
label
;
(struct) anchored_overlays_place_reference.Anchor

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).

Anchor
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
;
(struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])
Size
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
;
(struct) sparkles.ui.geometry.Rect

A 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.boundary
boundary
;
(struct) anchored_overlays_place_reference.PlacementPolicy

The 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.policy
policy
;
(alias) object.string = string
string
(field) string anchored_overlays_place_reference.Case.note
note
;
} void
void anchored_overlays_place_reference.report(int n, const(anchored_overlays_place_reference.Case) c, in anchored_overlays_place_reference.PlacedOverlay r) @safe
report
(int
(parameter) int n
n
, const
(struct) anchored_overlays_place_reference.Case

One row of the case table.

Case
(parameter) const(anchored_overlays_place_reference.Case) c
c
, in
(struct) anchored_overlays_place_reference.PlacedOverlay

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, ../avalonia.md and hue's three clampOrigin call sites each ended up doing, differently.

PlacedOverlay
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
) @safe
{
void std.stdio.writefln!("=== %d. %s ===", int, string)(int __param_0, string __param_1) @safe

Equivalent to writef(fmt, args, '\n').

writefln
!"=== %d. %s ==="(
(parameter) int n
n
,
(parameter) const(anchored_overlays_place_reference.Case) c
c
.
(field) string anchored_overlays_place_reference.Case.label
label
);
void anchored_overlays_place_reference.printGrid(in anchored_overlays_place_reference.Grid g) @safe
printGrid
(
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 @safe

Paint the boundary frame, the anchor and the placed overlay into one grid.

draw
(
(parameter) const(anchored_overlays_place_reference.Case) c
c
.
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
,
(parameter) const(anchored_overlays_place_reference.Case) c
c
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
,
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
));
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) @safe

Equivalent 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) c
c
.
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacementPolicy.side

the preferred anchor edge

side
,
(parameter) const(anchored_overlays_place_reference.Case) c
c
.
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
.
(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) c
c
.
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
.
(field) anchored_overlays_place_reference.Direction anchored_overlays_place_reference.PlacementPolicy.direction

resolved away before the solve

direction
,
(parameter) const(anchored_overlays_place_reference.Case) c
c
.
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
.
(field) int anchored_overlays_place_reference.PlacementPolicy.sideOffset

the gutter, in cells, applied BEFORE testing

sideOffset
,
(parameter) const(anchored_overlays_place_reference.Case) c
c
.
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
.
(field) int anchored_overlays_place_reference.PlacementPolicy.alignOffset

a nudge along the edge axis, in cells

alignOffset
,
string anchored_overlays_place_reference.adjustText(anchored_overlays_place_reference.Adjust a) @safe
adjustText
(
(parameter) const(anchored_overlays_place_reference.Case) c
c
.
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
.
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjust

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.

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) @safe

Equivalent 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) @safe
rectText
(
(parameter) const(anchored_overlays_place_reference.Case) c
c
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
),
string anchored_overlays_place_reference.rectText(in sparkles.ui.geometry.Rect r) @safe
rectText
(
(parameter) const(anchored_overlays_place_reference.Case) c
c
.
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
),
(parameter) const(anchored_overlays_place_reference.Case) c
c
.
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
.
(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).width
width
,
(parameter) const(anchored_overlays_place_reference.Case) c
c
.
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
.
(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).height
height
);
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) @safe

Equivalent 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) @safe
rectText
(
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
),
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.side

post-flip anchor edge we attached to

side
,
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(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) r
r
.
(field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fit

the worst thing that happened

fit
,
string anchored_overlays_place_reference.adjustText(anchored_overlays_place_reference.Adjust a) @safe
adjustText
(
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacedOverlay.applied

which 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) @safe

Equivalent to writef(fmt, args, '\n').

writefln
!" metadata arrowCell=%d (centred %s) flippedMain=%s flippedCross=%s"(
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) int anchored_overlays_place_reference.PlacedOverlay.arrowCell

overlay-local index along the attached edge; -1 = none

arrowCell
,
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) bool anchored_overlays_place_reference.PlacedOverlay.arrowCentred

false ⇒ the arrow could not reach the anchor's centre

arrowCentred
? "yes" : "no",
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedMain

the side axis crossed to the other side of the anchor

flippedMain
,
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedCross

the 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) @safe

Equivalent to writef(fmt, args, '\n').

writefln
!" anchorHidden=%s available=%dx%d"(
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) bool anchored_overlays_place_reference.PlacedOverlay.anchorHidden

the anchor left its clip

anchorHidden
,
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.PlacedOverlay.available

room actually left at the resolved side

available
.
(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).width
width
,
(parameter) const(anchored_overlays_place_reference.PlacedOverlay) r
r
.
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.PlacedOverlay.available

room actually left at the resolved side

available
.
(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).height
height
);
if (
(parameter) const(anchored_overlays_place_reference.Case) c
c
.
(field) string anchored_overlays_place_reference.Case.note
note
.
(field) ulong const(string).length
length
)
void std.stdio.writeln!(string, string)(string __param_0, string __param_1) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(" note ",
(parameter) const(anchored_overlays_place_reference.Case) c
c
.
(field) string anchored_overlays_place_reference.Case.note
note
);
void std.stdio.writeln!()() @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
();
} // --------------------------------------------------------------------------- void
void D main() @safe
main
() @safe
{
void std.stdio.writeln!string(string __param_0) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("place() — the reference placement pipeline, in cells");
void std.stdio.writeln!string(string __param_0) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("legend: '+-|' the boundary frame (drawn just outside it), 'A' anchor,");
void std.stdio.writeln!string(string __param_0) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(" '#' overlay, '^v<>' the arrow cell, '.' outside the boundary");
void std.stdio.writeln!()() @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
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.PlacementPolicy

The 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 pol
pol
;
auto
(local variable) anchored_overlays_place_reference.PlacementPolicy crossFlip
crossFlip
=
(local variable) anchored_overlays_place_reference.PlacementPolicy pol
pol
;
(local variable) anchored_overlays_place_reference.PlacementPolicy crossFlip
crossFlip
.
(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacementPolicy.align_

the preferred cross-axis alignment

align_
=
(enum) anchored_overlays_place_reference.Align

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 physical.

Align
.
(enum value) anchored_overlays_place_reference.Align.start = cast(ubyte)0u
start
;
(local variable) anchored_overlays_place_reference.PlacementPolicy crossFlip
crossFlip
.
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjust

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.

adjust
=
(local variable) anchored_overlays_place_reference.PlacementPolicy pol
pol
.
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjust

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.

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 @safe

Bit tests spelled once, so the solver reads as prose.

plus
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.flipCross = cast(ubyte)4u

mirror the alignment (opt-in; Floating UI's rule)

flipCross
);
auto
(local variable) anchored_overlays_place_reference.PlacementPolicy rtl
rtl
=
(local variable) anchored_overlays_place_reference.PlacementPolicy pol
pol
;
(local variable) anchored_overlays_place_reference.PlacementPolicy rtl
rtl
.
(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacementPolicy.align_

the preferred cross-axis alignment

align_
=
(enum) anchored_overlays_place_reference.Align

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 physical.

Align
.
(enum value) anchored_overlays_place_reference.Align.start = cast(ubyte)0u
start
;
(local variable) anchored_overlays_place_reference.PlacementPolicy rtl
rtl
.
(field) anchored_overlays_place_reference.Direction anchored_overlays_place_reference.PlacementPolicy.direction

resolved away before the solve

direction
=
(enum) anchored_overlays_place_reference.Direction

Reading direction. An input to the resolution step, never a flag consulted inside the solver.

Direction
.
(enum value) anchored_overlays_place_reference.Direction.rtl = 1
rtl
;
auto
(local variable) anchored_overlays_place_reference.Case[] cases
cases
= [
(struct) anchored_overlays_place_reference.Case

One row of the case table.

Case
("fits as preferred",
(struct) anchored_overlays_place_reference.Anchor

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).

Anchor
.
anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safe

An anchor with no clipping ancestor: it clips to itself, so it is always visible.

unclipped
(
(struct) sparkles.ui.geometry.Rect

A 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.Rect

A 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 pol
pol
,
"nothing fired: the arrow sits on the anchor's centre cell"),
(struct) anchored_overlays_place_reference.Case

One row of the case table.

Case
("flips on the main axis (no room below)",
(struct) anchored_overlays_place_reference.Anchor

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).

Anchor
.
anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safe

An anchor with no clipping ancestor: it clips to itself, so it is always visible.

unclipped
(
(struct) sparkles.ui.geometry.Rect

A 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.Rect

A 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 pol
pol
,
"2 cells below, 6 above: the side is REPORTED, so the backend " ~ "picks 'v' without re-deriving it"),
(struct) anchored_overlays_place_reference.Case

One row of the case table.

Case
("shifts on the cross axis (near the right edge)",
(struct) anchored_overlays_place_reference.Anchor

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).

Anchor
.
anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safe

An anchor with no clipping ancestor: it clips to itself, so it is always visible.

unclipped
(
(struct) sparkles.ui.geometry.Rect

A 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.Rect

A 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 pol
pol
,
"the rect slid 4 cells left; the arrow tracked the anchor and is " ~ "still centred"),
(struct) anchored_overlays_place_reference.Case

One row of the case table.

Case
("BOTH axes constrained",
(struct) anchored_overlays_place_reference.Anchor

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).

Anchor
.
anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safe

An anchor with no clipping ancestor: it clips to itself, so it is always visible.

unclipped
(
(struct) sparkles.ui.geometry.Rect

A 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.Rect

A 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 pol
pol
,
"flip on the main axis AND slide on the cross axis, in one solve"),
(struct) anchored_overlays_place_reference.Case

One row of the case table.

Case
("content wider than the boundary",
(struct) anchored_overlays_place_reference.Anchor

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).

Anchor
.
anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safe

An anchor with no clipping ancestor: it clips to itself, so it is always visible.

unclipped
(
(struct) sparkles.ui.geometry.Rect

A 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.Rect

A 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 pol
pol
,
"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.Case

One row of the case table.

Case
("content taller than the boundary",
(struct) anchored_overlays_place_reference.Anchor

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).

Anchor
.
anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safe

An anchor with no clipping ancestor: it clips to itself, so it is always visible.

unclipped
(
(struct) sparkles.ui.geometry.Rect

A 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.Rect

A 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 pol
pol
,
"neither side fits, so no flip is accepted (revertUnlessFree) and " ~ "the height is capped to the room actually there"),
(struct) anchored_overlays_place_reference.Case

One row of the case table.

Case
("clipped / offscreen anchor",
(struct) anchored_overlays_place_reference.Anchor

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).

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 @safe

An anchor inside a scrolling viewport, which may have scrolled out of it.

within
(
(struct) sparkles.ui.geometry.Rect

A 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.Rect

A 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.Rect

A 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 pol
pol
,
"anchorHidden is a HIDE verdict, not a close; the arrow could not " ~ "reach the anchor, and says so"),
(struct) anchored_overlays_place_reference.Case

One row of the case table.

Case
("RTL alignment",
(struct) anchored_overlays_place_reference.Anchor

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).

Anchor
.
anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safe

An anchor with no clipping ancestor: it clips to itself, so it is always visible.

unclipped
(
(struct) sparkles.ui.geometry.Rect

A 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.Rect

A 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 rtl
rtl
,
"align=start resolved to the RIGHT edge BEFORE the solver ran; the " ~ "solver itself is purely physical"),
(struct) anchored_overlays_place_reference.Case

One row of the case table.

Case
("boundary whose origin is NOT (0,0)",
(struct) anchored_overlays_place_reference.Anchor

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).

Anchor
.
anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safe

An anchor with no clipping ancestor: it clips to itself, so it is always visible.

unclipped
(
(struct) sparkles.ui.geometry.Rect

A 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.Rect

A 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 pol
pol
,
"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.Case

One row of the case table.

Case
("cross-axis alignment flip (opt-in)",
(struct) anchored_overlays_place_reference.Anchor

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).

Anchor
.
anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safe

An anchor with no clipping ancestor: it clips to itself, so it is always visible.

unclipped
(
(struct) sparkles.ui.geometry.Rect

A 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.Rect

A 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 crossFlip
crossFlip
,
"Floating UI's rule: try the other alignment on the SAME side " ~ "before sliding"), ]; foreach (
(parameter) ulong i
i
, ref
(parameter) anchored_overlays_place_reference.Case c
c
;
(local variable) anchored_overlays_place_reference.Case[] cases
cases
)
{ const
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) r
r
=
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 @safe

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.

place
(
(local variable) anchored_overlays_place_reference.Case c
c
.
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
,
(local variable) anchored_overlays_place_reference.Case c
c
.
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
,
(local variable) anchored_overlays_place_reference.Case c
c
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
,
(local variable) anchored_overlays_place_reference.Case c
c
.
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
);
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) @safe
checkInvariants
(
(local variable) anchored_overlays_place_reference.Case c
c
.
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
,
(local variable) anchored_overlays_place_reference.Case c
c
.
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
,
(local variable) anchored_overlays_place_reference.Case c
c
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
,
(local variable) anchored_overlays_place_reference.Case c
c
.
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
,
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) r
r
);
void anchored_overlays_place_reference.report(int n, const(anchored_overlays_place_reference.Case) c, in anchored_overlays_place_reference.PlacedOverlay r) @safe
report
(cast(int)
(local variable) ulong i
i
+ 1,
(local variable) anchored_overlays_place_reference.Case c
c
,
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) r
r
);
} // -- The case-specific assertions, stated as the specification will state them.
void std.stdio.writeln!string(string __param_0) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("=== what the cases pin ===");
const
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) fits
fits
=
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 @safe

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.

place
(
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[0].
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[0].
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[0].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[0].
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
);
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) fits
fits
.
(field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fit

the worst thing that happened

fit
==
(enum) anchored_overlays_place_reference.Fit

How good the resulting placement is, worst-wins.

Fit
.
(enum value) anchored_overlays_place_reference.Fit.exact = cast(ubyte)0u

placed as asked

exact
&&
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) fits
fits
.
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacedOverlay.applied

which adjustments fired

applied
==
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.none = cast(ubyte)0u
none
);
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) fits
fits
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.side

post-flip anchor edge we attached to

side
==
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.bottom = 1

below the anchor

bottom
&& !
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) fits
fits
.
(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedMain

the side axis crossed to the other side of the anchor

flippedMain
);
void std.stdio.writeln!string(string __param_0) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(" 1 a preferred placement fires no adjustment at all");
const
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) flipped
flipped
=
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 @safe

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.

place
(
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[1].
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[1].
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[1].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[1].
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
);
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) flipped
flipped
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.side

post-flip anchor edge we attached to

side
==
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.top = cast(ubyte)0u

above the anchor

top
&&
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) flipped
flipped
.
(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedMain

the side axis crossed to the other side of the anchor

flippedMain
);
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) flipped
flipped
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.bottom() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

bottom
<=
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[1].
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.y() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

y
, "a flipped overlay must clear the anchor");
void std.stdio.writeln!string(string __param_0) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(" 2 a main-axis flip is reported as a resolved side, not inferred");
const
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) slid
slid
=
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 @safe

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.

place
(
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[2].
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[2].
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[2].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[2].
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
);
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) slid
slid
.
(field) anchored_overlays_place_reference.Side anchored_overlays_place_reference.PlacedOverlay.side

post-flip anchor edge we attached to

side
==
(enum) anchored_overlays_place_reference.Side

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.

Side
.
(enum value) anchored_overlays_place_reference.Side.bottom = 1

below the anchor

bottom
&&
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) slid
slid
.
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacedOverlay.applied

which adjustments fired

applied
.
bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safe

Bit tests spelled once, so the solver reads as prose.

has
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.slideCross = cast(ubyte)8u

shift along the edge axis

slideCross
));
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) slid
slid
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
==
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[2].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
, "a cross-axis slide pins the end edge");
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) slid
slid
.
(field) bool anchored_overlays_place_reference.PlacedOverlay.arrowCentred

false ⇒ 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) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(" 3 sliding moves the rect and the arrow independently");
const
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) both
both
=
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 @safe

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.

place
(
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[3].
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[3].
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[3].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[3].
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
);
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) both
both
.
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacedOverlay.applied

which adjustments fired

applied
.
bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safe

Bit tests spelled once, so the solver reads as prose.

has
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.flipMain = cast(ubyte)1u

cross to the opposite side of the anchor

flipMain
) &&
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) both
both
.
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacedOverlay.applied

which adjustments fired

applied
.
bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safe

Bit tests spelled once, so the solver reads as prose.

has
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.slideCross = cast(ubyte)8u

shift along the edge axis

slideCross
));
void std.stdio.writeln!string(string __param_0) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(" 4 the two axes are solved independently, so both may fire");
const
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) wide
wide
=
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 @safe

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.

place
(
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[4].
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[4].
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[4].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[4].
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
);
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) wide
wide
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
==
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[4].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The 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) wide
wide
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
>
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[4].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
&&
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) wide
wide
.
(field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fit

the worst thing that happened

fit
==
(enum) anchored_overlays_place_reference.Fit

How good the resulting placement is, worst-wins.

Fit
.
(enum value) anchored_overlays_place_reference.Fit.overflowing = 4

it does not fit and we are the host — nobody clips for us

overflowing
);
void std.stdio.writeln!string(string __param_0) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(" 5 oversize content pins its start edge and REPORTS the overflow");
const
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) tall
tall
=
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 @safe

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.

place
(
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[5].
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[5].
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[5].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[5].
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
);
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) tall
tall
.
(field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fit

the worst thing that happened

fit
==
(enum) anchored_overlays_place_reference.Fit

How good the resulting placement is, worst-wins.

Fit
.
(enum value) anchored_overlays_place_reference.Fit.shrunk = 3

the content was capped

shrunk
&&
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) tall
tall
.
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacedOverlay.applied

which adjustments fired

applied
.
bool anchored_overlays_place_reference.has(anchored_overlays_place_reference.Adjust a, anchored_overlays_place_reference.Adjust f) pure nothrow @nogc @safe

Bit tests spelled once, so the solver reads as prose.

has
(
(enum) anchored_overlays_place_reference.Adjust

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.

Adjust
.
(enum value) anchored_overlays_place_reference.Adjust.resizeMain = cast(ubyte)16u

shrink to the room at the resolved side

resizeMain
));
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) tall
tall
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.height() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

height
==
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) tall
tall
.
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.PlacedOverlay.available

room actually left at the resolved side

available
.
(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).height
height
, "a capped overlay takes the room reported");
assert(!
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) tall
tall
.
(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedMain

the 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) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(" 6 resize is the LAST resort, and the cap equals the reported room");
const
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) hidden
hidden
=
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 @safe

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.

place
(
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[6].
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[6].
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[6].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[6].
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
);
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) hidden
hidden
.
(field) bool anchored_overlays_place_reference.PlacedOverlay.anchorHidden

the anchor left its clip

anchorHidden
, "an anchor outside its clip must be reported hidden");
assert(!
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) hidden
hidden
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
bool sparkles.ui.geometry.Rect.empty() const pure nothrow @nogc @safe

true 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) hidden
hidden
.
(field) bool anchored_overlays_place_reference.PlacedOverlay.arrowCentred

false ⇒ the arrow could not reach the anchor's centre

arrowCentred
, "the arrow clamped, and said so");
void std.stdio.writeln!string(string __param_0) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
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 asLtr
asLtr
=
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[7].
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
;
(local variable) anchored_overlays_place_reference.PlacementPolicy asLtr
asLtr
.
(field) anchored_overlays_place_reference.Direction anchored_overlays_place_reference.PlacementPolicy.direction

resolved away before the solve

direction
=
(enum) anchored_overlays_place_reference.Direction

Reading 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)0u
ltr
;
const
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) rtlPlaced
rtlPlaced
=
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 @safe

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.

place
(
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[7].
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[7].
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[7].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[7].
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
);
const
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) ltrPlaced
ltrPlaced
=
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 @safe

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.

place
(
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[7].
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[7].
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[7].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
,
(local variable) anchored_overlays_place_reference.PlacementPolicy asLtr
asLtr
);
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) rtlPlaced
rtlPlaced
.
(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacedOverlay.align_

post-flip, post-RTL cross alignment

align_
==
(enum) anchored_overlays_place_reference.Align

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 physical.

Align
.
(enum value) anchored_overlays_place_reference.Align.end = 2
end
&&
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) rtlPlaced
rtlPlaced
.
(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedCross

the alignment was mirrored (RTL resolution, or flipCross)

flippedCross
);
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) ltrPlaced
ltrPlaced
.
(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacedOverlay.align_

post-flip, post-RTL cross alignment

align_
==
(enum) anchored_overlays_place_reference.Align

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 physical.

Align
.
(enum value) anchored_overlays_place_reference.Align.start = cast(ubyte)0u
start
&& !
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) ltrPlaced
ltrPlaced
.
(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedCross

the alignment was mirrored (RTL resolution, or flipCross)

flippedCross
);
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) rtlPlaced
rtlPlaced
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
==
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[7].
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
, "RTL start aligns the RIGHT edges");
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) ltrPlaced
ltrPlaced
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
==
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[7].
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The 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) @safe

Equivalent 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) rtlPlaced
rtlPlaced
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
,
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) ltrPlaced
ltrPlaced
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The 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) off
off
=
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 @safe

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.

place
(
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[8].
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[8].
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[8].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[8].
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
);
const
(local variable) const(int) aligned
aligned
=
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[8].
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
+ (
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[8].
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

width
-
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[8].
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
.
(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).width
width
) / 2;
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) off
off
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
==
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[8].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
, "the pin is the boundary's start edge");
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) off
off
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The 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) off
off
.
(field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fit

the worst thing that happened

fit
!=
(enum) anchored_overlays_place_reference.Fit

How good the resulting placement is, worst-wins.

Fit
.
(enum value) anchored_overlays_place_reference.Fit.overflowing = 4

it does not fit and we are the host — nobody clips for us

overflowing
&&
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[8].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
.
sparkles.ui.geometry.Rect sparkles.ui.geometry.Rect.intersection(in sparkles.ui.geometry.Rect other) const pure nothrow @nogc @safe

The overlap of two rectangles (an empty one when disjoint).

intersection
(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) off
off
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, 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 @safe

Component-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 @safe

Component-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) todayAbs
todayAbs
=
int anchored_overlays_place_reference.clampOriginToday(int anchor, int width, int extent) pure nothrow @nogc @safe

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.

clampOriginToday
(
(local variable) const(int) aligned
aligned
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[8].
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
.
(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).width
width
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[8].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
);
const
(local variable) const(int) todayRel
todayRel
=
int anchored_overlays_place_reference.clampOriginToday(int anchor, int width, int extent) pure nothrow @nogc @safe

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.

clampOriginToday
(
(local variable) const(int) aligned
aligned
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[8].
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
.
(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).width
width
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[8].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
.
int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safe

The 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) @safe

Equivalent to writef(fmt, args, '\n').

writefln
!" 9 centred x would be %d; place() pins %d (boundary.x)"(
(local variable) const(int) aligned
aligned
,
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) off
off
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The 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) @safe

Equivalent 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) aligned
aligned
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[8].
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
.
(field) int sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]).width
width
,
(local variable) const(int) todayAbs
todayAbs
,
(local variable) const(int) todayRel
todayRel
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[8].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
-
(local variable) const(int) todayAbs
todayAbs
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[8].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The 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) negBoundary
negBoundary
=
(struct) sparkles.ui.geometry.Rect

A 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) negAnchor
negAnchor
=
(struct) anchored_overlays_place_reference.Anchor

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).

Anchor
.
anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Anchor.unclipped(in sparkles.ui.geometry.Rect r) pure nothrow @nogc @safe

An anchor with no clipping ancestor: it clips to itself, so it is always visible.

unclipped
(
(struct) sparkles.ui.geometry.Rect

A 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) neg
neg
=
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 @safe

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.

place
(
(local variable) const(anchored_overlays_place_reference.Anchor) negAnchor
negAnchor
,
(struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])
Size
(14, 3),
(local variable) const(sparkles.ui.geometry.Rect) negBoundary
negBoundary
,
(local variable) anchored_overlays_place_reference.PlacementPolicy pol
pol
);
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) @safe
checkInvariants
(
(local variable) const(anchored_overlays_place_reference.Anchor) negAnchor
negAnchor
,
(struct) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"])
Size
(14, 3),
(local variable) const(sparkles.ui.geometry.Rect) negBoundary
negBoundary
,
(local variable) anchored_overlays_place_reference.PlacementPolicy pol
pol
,
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) neg
neg
);
const
(local variable) const(int) negAligned
negAligned
=
(local variable) const(anchored_overlays_place_reference.Anchor) negAnchor
negAnchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
+ (
(local variable) const(anchored_overlays_place_reference.Anchor) negAnchor
negAnchor
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Anchor.rect

the anchor's cell rect

rect
.
int sparkles.ui.geometry.Rect.width() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

width
- 14) / 2;
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) neg
neg
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
==
(local variable) const(sparkles.ui.geometry.Rect) negBoundary
negBoundary
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
&&
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) neg
neg
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The 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) @safe

Equivalent 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) @safe
rectText
(
(local variable) const(sparkles.ui.geometry.Rect) negBoundary
negBoundary
),
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) neg
neg
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
,
int anchored_overlays_place_reference.clampOriginToday(int anchor, int width, int extent) pure nothrow @nogc @safe

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.

clampOriginToday
(
(local variable) const(int) negAligned
negAligned
, 14,
(local variable) const(sparkles.ui.geometry.Rect) negBoundary
negBoundary
.
int sparkles.ui.geometry.Rect.right() const pure nothrow @nogc @safe

Right edge (exclusive) and bottom edge (exclusive).

right
));
const
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) crossFlipped
crossFlipped
=
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 @safe

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.

place
(
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[9].
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[9].
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[9].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[9].
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
);
auto
(local variable) anchored_overlays_place_reference.PlacementPolicy noFlip
noFlip
=
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[9].
(field) anchored_overlays_place_reference.PlacementPolicy anchored_overlays_place_reference.Case.policy
policy
;
(local variable) anchored_overlays_place_reference.PlacementPolicy noFlip
noFlip
.
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjust

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.

adjust
=
(local variable) anchored_overlays_place_reference.PlacementPolicy pol
pol
.
(field) anchored_overlays_place_reference.Adjust anchored_overlays_place_reference.PlacementPolicy.adjust

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.

adjust
;
(local variable) anchored_overlays_place_reference.PlacementPolicy noFlip
noFlip
.
(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacementPolicy.align_

the preferred cross-axis alignment

align_
=
(enum) anchored_overlays_place_reference.Align

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 physical.

Align
.
(enum value) anchored_overlays_place_reference.Align.start = cast(ubyte)0u
start
;
const
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) wouldSlide
wouldSlide
=
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 @safe

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.

place
(
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[9].
(field) anchored_overlays_place_reference.Anchor anchored_overlays_place_reference.Case.anchor
anchor
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[9].
(field) sparkles.math.vector.Vector!(int, 2LU, ["width", "height"]) anchored_overlays_place_reference.Case.content
content
,
(local variable) anchored_overlays_place_reference.Case[] cases
cases
[9].
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.Case.boundary
boundary
,
(local variable) anchored_overlays_place_reference.PlacementPolicy noFlip
noFlip
);
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) crossFlipped
crossFlipped
.
(field) anchored_overlays_place_reference.Align anchored_overlays_place_reference.PlacedOverlay.align_

post-flip, post-RTL cross alignment

align_
==
(enum) anchored_overlays_place_reference.Align

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 physical.

Align
.
(enum value) anchored_overlays_place_reference.Align.end = 2
end
&&
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) crossFlipped
crossFlipped
.
(field) bool anchored_overlays_place_reference.PlacedOverlay.flippedCross

the alignment was mirrored (RTL resolution, or flipCross)

flippedCross
);
assert(
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) crossFlipped
crossFlipped
.
(field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fit

the worst thing that happened

fit
==
(enum) anchored_overlays_place_reference.Fit

How good the resulting placement is, worst-wins.

Fit
.
(enum value) anchored_overlays_place_reference.Fit.flipped = 2

crossed to the other side of the anchor

flipped
&&
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) wouldSlide
wouldSlide
.
(field) anchored_overlays_place_reference.Fit anchored_overlays_place_reference.PlacedOverlay.fit

the worst thing that happened

fit
==
(enum) anchored_overlays_place_reference.Fit

How good the resulting placement is, worst-wins.

Fit
.
(enum value) anchored_overlays_place_reference.Fit.slid = 1

shifted 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) @safe

Equivalent 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) crossFlipped
crossFlipped
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
,
(local variable) const(anchored_overlays_place_reference.PlacedOverlay) wouldSlide
wouldSlide
.
(field) sparkles.ui.geometry.Rect anchored_overlays_place_reference.PlacedOverlay.rect

resolved, integer cells, already pinned

rect
.
int sparkles.ui.geometry.Rect.x() const pure nothrow @nogc @safe

The components, forwarded from origin/size.

x
);
void std.stdio.writeln!()() @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
();
void std.stdio.writeln!string(string __param_0) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("=== invariants held for every case ===");
void std.stdio.writeln!string(string __param_0) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(" I1 rect.origin >= boundary.origin (the pin is the boundary, not 0)");
void std.stdio.writeln!string(string __param_0) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(" I2 fit != overflowing => rect inside boundary");
void std.stdio.writeln!string(string __param_0) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(" I3 1 <= arrowCell <= edgeLen - 2 (never a corner glyph)");
void std.stdio.writeln!string(string __param_0) @safe

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);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(" I4 place(resolved side/align) == the same rect, with no further flip");
}