Hi

On 11/6/26 12:49, Pratik Bhujel wrote:
I've updated the Io\Terminal RFC to version 0.5:

https://wiki.php.net/rfc/io_terminal

It adds examples for raw-mode leases and sequential reads, clarifies
lease restoration, escape-sequence timeouts, resize notifications, and
line endings, and marks enableRawMode() as NoDiscard.

The PR has been updated to match, and its CI checks are green:

https://github.com/php/php-src/pull/23941

As mentioned earlier, I'm holding off on voting while the discussion continues.

Thank you for the update. I've given the RFC another read, it's much more approachable now.

I have another set of comments:

1. “The first lease saves the POSIX terminal attributes”

Can you, for the uninformed reader, spell out what the attributes are? The raw-mode (or not) is obvious. Is the size also an attribute? Anything else?

2. Would it make sense to have a getter that returns the current raw-mode state? This might be useful to check before calling `readLine()`.

3. For my second example:

    $terminal = Terminal::fromStdio();
    $lease = $terminal->enableRawMode();
    unset($terminal); // The lease is still active.

    $terminal = Terminal::fromStdio();
    $terminal->restoreMode($lease);

I would add a comment for the second `Terminal::fromStdio()`: “Starts in raw mode, because the mode lease is active” to be extra explicit about the behavior.

4. For the “Input state and sequential reads” section, an example with two terminal instances might be useful to showcase how two distinct instances interact with each other.

5. For the “Error Model”, I wonder if EOF should be returned as a key instead, similar to `Resize`.

6. It would be nice to avoid duplicating the namespace in class names. Specifically I'm thinking about `Terminal\TerminalSize`. May I suggest `Terminal\Dimensions`? It avoids a bare “Size” when using unqualified and is also a little more precise in what is being returned by it. The getter would then also be called `getDimensions()`.

Best regards
Tim Düsterhus

Reply via email to