Skip to content

KodeKit: headless widget behaviour (from ui-sdk), command palette, shortcuts and more - #2789

Merged
sarbian merged 11 commits into
devfrom
ui/sdk-all-squashed
Nov 22, 2026
Merged

sarbian merged 11 commits into
devfrom
ui/sdk-all-squashed

Conversation

@sarbian

@sarbian sarbian commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Sometimes you stumble on an idea that seems nice. You know that it will be a bit overkill, but it would make some things easier.
And 23 hours later you end up with 47k more lines. And this is not finished.

Anyway. Took some ideas from UI SDK. It is halfway there.
This first half adds enough UI improvementst to merge it.


What players get

  • Command palette (MechJeb menu or a bindable key): windows, autopilots and node commands; a flight change needs a second Enter. With an empty search the flight commands come first.
  • Keyboard shortcuts for windows (Settings, none bound by default; keys KSP uses are refused, with the reason).
  • Maneuver preview on hover, throttle and acceleration meters in Utilities, window snapping (all off by default, in Settings).
  • Delta-V Stats and PSG Stages copy as text or a Markdown table; custom windows copy as Markdown; right-click menu on values; hover cards.
  • Undo and redo icons in the Maneuver Planner and Node Editor.
  • Steppers ×10 on Right Shift or Alt (Left Shift stays KSP's throttle); typeable drop-downs; fields keep their edit across window rebuilds; recent values with Up/Down; read-outs edited in place.
  • Custom Window Editor: filter, drag to reorder, check boxes for several rows, an "All" tree, fast long lists.
  • Graphs: pan and zoom, ranges and points, an events timeline; hovering the Flight Recorder or PSG Solution graph shows the values under the pointer, with a cursor line.
  • Confirmation dialogs (delete a window, restore factory defaults), toasts.
  • Numbers right-aligned in fields, text left, stepper values centred.
  • An opened window comes above the others; a clicked button no longer clicks again on Enter.

For tools

  • Agent bridge, off unless KSP is launched with -mechjeb-ui-agent <port> (or MECHJEB_UI_AGENT_PORT is set): HTTP on 127.0.0.1 with a token, protocol version 2. Controls have language-independent names: fields and buttons by their #key, windows by their module name (MechJebModuleManeuverPlanner, CustomInfoWindow:<id>).

Under the hood

Widget behaviour moved into Unity-free headless models in MechJeb2.UI/KodeKit/Headless, tested in MechJebLibTest (a C# 7.3 build checks them); one commit path with a source for every edit; keyboard scopes; one popup stack. MechJeb2.UI/KodeKit/LAYOUTS.md, "The headless pattern", is the guide, with an index of every model.

The 10 commits are grouped by area for review; only the last one builds.

Tests

  • Debug build: 0 errors. MechJebLibTest: 16,683 passed, 0 failed.
  • In game (KSP 1.12.5, development player, Windows and macOS, the 3.2x system with KSPCommunityFixes): every part was tested through scripted test mods, with real mouse and keyboard input where it matters (the palette, shortcuts, steppers, selection, a French AZERTY layout for the shortcuts), and the merged branch was rechecked as a whole.
  • Compared with dev: every window side by side in Flat, Classic and Chinese, with no unexplained difference; frame time and garbage per frame within noise.

…copes, focus recovery, input history, inline edit, field alignment
… reorder, trees, selection, styling rules, window drag and snapping
…graph pan and zoom, ranges, timeline, hover read-out
…commands with a second Enter for flight changes; opt-in window keys checked against KSP's bindings
…KSP is launched with -mechjeb-ui-agent <port>, language-independent names
…meters, copy menus, settings for the new options, opened windows on top
… Mono

On Mono, xunit reads an enum array's items as Int32 and finds them unequal to a List of that enum, so 27 KodeKit tests failed in CI.
AssertionExtensions.EqualSequence copies both sides into a List<T> first; the 35 enum-array asserts in the KodeKit tests use it.

On Mono, List.Sort allocates 128 bytes per call even with a cached IComparer, so FuzzyFilter's ranked queries allocate there.
The fuzzy filter and combo filter allocation tests now check only on .NET Framework (AssertionExtensions.OnMono).
@github-actions

Copy link
Copy Markdown
Contributor

✅ Build Artifact 🚀

MechJeb2-3fc2e6c.zip (built from 8a10af3)

@sarbian
sarbian merged commit 48b8c2f into dev Nov 22, 2026
3 checks passed
@sarbian
sarbian deleted the ui/sdk-all-squashed branch November 22, 2026 00:29
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.

1 participant