Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@gdamore
Copy link
Owner

@gdamore gdamore commented Dec 6, 2025

We're looking to modernize this along the lines of tcell, hopefully eliminating terminfo entirely (which has outlived it's usefulness). This should simplify the code somewhat.

Summary by CodeRabbit

Release Notes

  • Removed Features

    • Removed support for legacy terminal types: beterm, cygwin, eterm, hpterm, kterm, pcansi, vt400, vt52, wy50, wy60, wy99aansi, and wy99ansi.
    • Removed legacy mouse sequence parsing.
  • Performance Improvements

    • Removed timing delays from terminal operations in vt100, vt102, vt220, and vt420 terminal definitions for faster screen updates.

✏️ Tip: You can customize this high-level summary in your review settings.

We're moving towards removal of the database entirely, as all terminals
we want to support have a common subset of escape sequences, and a
the key sequences they emit to us are non-overlapping once we discard
outliers like Wyse.
The delays for "modern" VT220 and are believed not to be actually
required (from reading DEC technical manuals), and are absolutely
not required for modern emulations (even for old VT100 clones).

The emulations like VT100 are common place, and these delays really
hurt those emulations.
All terminal emulators with mouse support we care about do have support
for the modern SGR protocol.  (X10 users, you are out of luck, here's a nickel
get yourself a newer system.)
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 6, 2025

Walkthrough

The PR removes legacy mouse parsing functionality from the parser, eliminates runtime delay and flush operations from terminal capability handling, removes delay specifiers from VT terminal definitions, and deletes support for 12 older terminal types while updating copyrights to 2025.

Changes

Cohort / File(s) Summary
Parser refactoring
source/dcell/parser.d
Removes parseLegacyMouse() method from parsing chain. Replaces implementation with comprehensive unit test exercising key, paste, mouse, and Unicode handling. Updates copyright year.
Terminal capability cleanup
source/dcell/termcap.d
Removes runtime delay and flush logic. Removes timing-based unit tests and associated assertions. Updates copyright year and related comments.
VT terminal delay removal
source/dcell/terminfo/vt100.d, vt102.d, vt220.d, vt420.d
Removes $<N> delay specifiers from escape sequences: clear, attrOff, underline, bold, blink, reverse, setCursor, cursorUp1, enterACS, exitACS fields. Terminal capabilities remain functionally available without timing modifiers.
Deleted terminal definitions
source/dcell/terminfo/beterm.d, cygwin.d, eterm.d, hpterm.d, kterm.d, pcansi.d, vt400.d, vt52.d, wy50.d, wy60.d, wy99aansi.d, wy99ansi.d
Removes entire module definitions for 12 legacy terminal types, including Termcap definitions and Database registration logic.
Module exports cleanup
source/dcell/terminfo/package.d
Removes import declarations for the 12 deleted terminal modules.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Verify parser removal: Ensure parseLegacyMouse() removal doesn't break existing mouse input handling or rely on undiscovered call sites.
  • Terminal type dependencies: Confirm no client code or configuration defaults depend on the removed 12 terminal definitions.
  • Delay removal impact: Validate that removing timing specifications from VT terminal sequences doesn't degrade terminal interaction reliability or screen rendering.
  • Test coverage: Verify new parser unit tests adequately cover legacy functionality previously tested at runtime.

Poem

🐰 A parser grows lean, old mice fade away,
Delays drop like leaves on this refactoring day,
Twelve terminals rest as the new dawn breaks,
Cleaner, swifter code—what a rabbit makes!
Copyright updated, legacy cast aside,
2025 brings freshness with humble pride. 🌱

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Drop various legacy things' accurately captures the main objective of the changeset, which removes legacy terminal definitions, parsing logic, and timing features across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch gdamore/drop-legacy-terms

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
source/dcell/termcap.d (2)

218-285: Delay sequences are now parsed but ignored—consider simplifying and clarifying behavior

With delays removed, $<...> segments are parsed but the computed values (usec, mult, dot, valid) and the flush delegate are no longer used. The current implementation is correct but carries dead logic and a now‑semantically‑inactive parameter.

To keep this in sync with the “we drop it” comment and reduce confusion, consider:

  • Either simplifying the body to just strip $<...> sequences without parsing numeric content, and
  • Or updating the doc comment to explicitly say that delay sequences are recognized and removed with no sleep or flush behavior, and that the flush delegate is kept only for API compatibility (or marking it as deprecated).

For example, a minimal simplification of the inner handling could look like:

-            auto val = s[2 .. end];
-            s = s[end + 1 .. $];
-            int usec = 0;
-            int mult = 1000; // 1 ms
-            bool dot = false;
-            bool valid = true;
-
-            while (valid && val.length > 0)
-            {
-                switch (val[0])
-                {
-                case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
-                    usec *= 10;
-                    usec += val[0] - '0';
-                    if (dot && mult > 1)
-                    {
-                        mult /= 10;
-                    }
-                    break;
-
-                case '.':
-                    if (!dot)
-                    {
-                        dot = true;
-                    }
-                    else
-                    {
-                        valid = false;
-                    }
-                    break;
-
-                default:
-                    valid = false;
-                    break;
-                }
-                val = val[1 .. $];
-            }
+            // Drop the delay specification entirely; we no longer sleep or flush here.
+            s = s[end + 1 .. $];

This keeps the new semantics (strip delay markers, no timing) while making the intent clearer.


287-339: Clean up unused timing artifacts in unittests after delay/flush removal

The unit tests here still carry timing‑related imports and variables that are no longer used:

  • First unittest: Clock, seconds, and now are unused.
  • Second unittest: Clock, now, and end are unused—only the final string assertion matters.
  • Third unittest: Clock import and end are unused; Flusher.flushes is never asserted now that flush is not called.

You can simplify these tests to only what they actually verify (string output and “no panic”), e.g.:

     unittest
     {
-        import std.datetime : Clock;
-        import core.time : seconds;
         import std.outbuffer;
-
-        auto now = Clock.currTime();
         auto ob = new OutBuffer();
@@
     unittest
     {
-        import std.datetime;
         import std.outbuffer;
-
-        auto now = Clock.currTime();
         auto ob = new OutBuffer();
@@
-        auto end = Clock.currTime();
-
         assert(ob.toString() == "ABCDEF\n");
@@
     unittest
     {
-        import std.outbuffer;
-        import std.datetime;
+        import std.outbuffer;
@@
         auto f = new Flusher();
         puts(f, "ABC$<100>DEF", &f.flush);
-        auto end = Clock.currTime();
         assert(f.toString() == "ABCDEF");

This keeps the behavioral coverage aligned with the new “no delay / no flush” semantics without carrying legacy timing noise.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 329c5f7 and 89c367c.

📒 Files selected for processing (19)
  • source/dcell/parser.d (3 hunks)
  • source/dcell/termcap.d (2 hunks)
  • source/dcell/terminfo/beterm.d (0 hunks)
  • source/dcell/terminfo/cygwin.d (0 hunks)
  • source/dcell/terminfo/eterm.d (0 hunks)
  • source/dcell/terminfo/hpterm.d (0 hunks)
  • source/dcell/terminfo/kterm.d (0 hunks)
  • source/dcell/terminfo/package.d (0 hunks)
  • source/dcell/terminfo/pcansi.d (0 hunks)
  • source/dcell/terminfo/vt100.d (1 hunks)
  • source/dcell/terminfo/vt102.d (1 hunks)
  • source/dcell/terminfo/vt220.d (1 hunks)
  • source/dcell/terminfo/vt400.d (0 hunks)
  • source/dcell/terminfo/vt420.d (2 hunks)
  • source/dcell/terminfo/vt52.d (0 hunks)
  • source/dcell/terminfo/wy50.d (0 hunks)
  • source/dcell/terminfo/wy60.d (0 hunks)
  • source/dcell/terminfo/wy99aansi.d (0 hunks)
  • source/dcell/terminfo/wy99ansi.d (0 hunks)
💤 Files with no reviewable changes (13)
  • source/dcell/terminfo/wy50.d
  • source/dcell/terminfo/wy99aansi.d
  • source/dcell/terminfo/kterm.d
  • source/dcell/terminfo/wy60.d
  • source/dcell/terminfo/package.d
  • source/dcell/terminfo/beterm.d
  • source/dcell/terminfo/wy99ansi.d
  • source/dcell/terminfo/eterm.d
  • source/dcell/terminfo/hpterm.d
  • source/dcell/terminfo/pcansi.d
  • source/dcell/terminfo/vt400.d
  • source/dcell/terminfo/cygwin.d
  • source/dcell/terminfo/vt52.d
🔇 Additional comments (8)
source/dcell/terminfo/vt220.d (1)

50-51: LGTM - Delay specifiers removed from ACS sequences.

Removing the $<2> and $<4> delay specifiers is appropriate for modern terminal emulators. This aligns with the broader effort across vt100, vt102, and vt420 terminfo definitions.

source/dcell/terminfo/vt102.d (1)

12-22: LGTM - Legacy delay specifiers removed.

The removal of $<50>, $<2>, and $<5> delay padding from clear, attrOff, underline, bold, blink, reverse, setCursor, and cursorUp1 is consistent with the modernization effort. These delays were required for hardware terminals with slow processing but are unnecessary for contemporary terminal emulators.

source/dcell/terminfo/vt100.d (1)

13-23: LGTM - Consistent with vt102 changes.

Same delay specifier removal pattern applied here. The vt100 and vt102 definitions now share consistent capability strings without legacy timing modifiers.

source/dcell/parser.d (2)

735-831: Well-structured unittest covering key parsing scenarios.

The unittest provides good coverage:

  • Key sequence parsing (right arrow)
  • Partial escape sequence timeout handling
  • Lone escape key detection
  • Paste event bracketing
  • SGR mouse event parsing with coordinate translation
  • UTF-8 unicode decoding

The use of Thread.sleep(msecs(100)) to exceed the 50ms seqTime threshold is appropriate for testing timeout behavior.


357-357: Removal of legacy mouse parsing from parse chain is complete.

The parseLegacyMouse() method has been removed from the parse chain at line 357, leaving only parsePaste(), parseRune(), parseFnKey(), and parseSgrMouse(). No remaining references to parseLegacyMouse exist in the codebase, confirming the removal is complete and aligns with the PR objective to drop legacy terminal support in favor of SGR mouse mode, which is the modern standard supported by contemporary terminal emulators.

source/dcell/terminfo/vt420.d (2)

12-20: LGTM - Screen control sequences cleaned up.

Delay specifiers appropriately removed from clear, attrOff, bold, blink, reverse, and setCursor. The escape sequences are now standard ANSI without legacy timing padding.


44-45: LGTM - ACS sequences aligned with vt220.

The enterACS and exitACS changes match the updates in vt220.d, maintaining consistency across the VT terminal family definitions.

source/dcell/termcap.d (1)

1-9: Copyright header update is consistent

Year bump to 2025 is straightforward and consistent with the PR’s stated modernization goal.

@gdamore gdamore merged commit 855a577 into main Dec 6, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants