feat: add DisableCaps() for individual terminal cap control - #100
Open
mikeschinkel wants to merge 1 commit into
Open
feat: add DisableCaps() for individual terminal cap control#100mikeschinkel wants to merge 1 commit into
mikeschinkel wants to merge 1 commit into
Conversation
Export internal capabilities bitmask as a Capability type alias with named constants (CapVPA, CapHPA, CapCHA, CapCHT, CapCBT, CapREP, CapECH, CapICH, CapSD, CapSU) so consumers can selectively disable specific terminal optimizations. Add TerminalRenderer.DisableCaps() for programmatic use and support UV_DISABLE_CAPS environment variable (comma- separated cap names) for debugging. This is needed for terminal emulators like JediTerm (GoLand/IntelliJ) that mishandle specific escape sequences like CBT (Cursor Backward Tab).
mikeschinkel
force-pushed
the
feat/disable-caps
branch
from
March 25, 2026 05:08
84cf9f5 to
6bbd685
Compare
2 tasks
This was referenced Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DisableCaps(...Capability)method toTerminalRendererto allow disabling specific terminal capabilitiesCapCBT,CapREP,CapECH, etc. so callers can reference themUV_DISABLE_CAPS=CBT,REPenvironment var so end users can adjust for edge-case terminals without code changesMotivation
xtermCaps()mapsTERMvalues to capability sets, but some terminal emulators report a standardTERM(e.g.xterm-256color) while not correctly implementing all the capabilities that implies. Currently there is no way to selectively disable specific optimizations — the only workaround is overridingTERMto a less capable terminal type, which degrades the entire rendering pipeline (e.g. losing TrueColor).This PR adds fine-grained control: disable only the problematic capability while keeping everything else at full quality.
Example: JetBrains GoLand and all IntelliJ-based IDEs use JediTerm, which reports as
xterm-256colorbut mishandles CBT (Cursor Backward Tab), causing invalid rendering. A follow-up PR will add auto-detection for known problematic terminals like JediTerm; this PR provides the underlying API that makes that possible, plus a manual escape hatch for terminals not yet auto-detected.Usage
Programmatic:
Environment variable (useful for debugging):
Changes
disable_caps.go— New file. ExportsCapabilitytype alias, 10 capability constants (CapVPA,CapHPA,CapCHA,CapCHT,CapCBT,CapREP,CapECH,CapICH,CapSD,CapSU), theDisableCaps()method, andapplyDisableCaps()for env var support.disable_caps_test.go— New file. 4 tests covering single disable, multiple disable, exported constant correctness, and env var parsing.terminal_renderer.go— One-line addition: callsapplyDisableCaps()duringNewTerminalRenderer()so the env var is respected automatically.Test plan
TestDisableCaps— single capability disable, others unaffectedTestDisableCapsMultiple— multiple capabilities disabled simultaneouslyTestExportedCapabilityConstants— exported constants match internal valuesTestApplyDisableCapsEnv—UV_DISABLE_CAPSenv var parsing and application