-
Notifications
You must be signed in to change notification settings - Fork 3
Drop various legacy things #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.)
WalkthroughThe 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this 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 behaviorWith delays removed,
$<...>segments are parsed but the computed values (usec,mult,dot,valid) and theflushdelegate 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
flushdelegate 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 removalThe unit tests here still carry timing‑related imports and variables that are no longer used:
- First
unittest:Clock,seconds, andnoware unused.- Second
unittest:Clock,now, andendare unused—only the final string assertion matters.- Third
unittest:Clockimport andendare unused;Flusher.flushesis never asserted now thatflushis 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
📒 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 fromclear,attrOff,underline,bold,blink,reverse,setCursor, andcursorUp1is 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 50msseqTimethreshold 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 onlyparsePaste(),parseRune(),parseFnKey(), andparseSgrMouse(). No remaining references toparseLegacyMouseexist 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, andsetCursor. The escape sequences are now standard ANSI without legacy timing padding.
44-45: LGTM - ACS sequences aligned with vt220.The
enterACSandexitACSchanges 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 consistentYear bump to 2025 is straightforward and consistent with the PR’s stated modernization goal.
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
Performance Improvements
✏️ Tip: You can customize this high-level summary in your review settings.