Skip to content

Add focus mode and script renaming to the scripting terminal - #82

Closed
rubensworks wants to merge 17 commits into
terminal-ux/5-highlighting-performancefrom
terminal-ux/6-layout-and-files
Closed

rubensworks wants to merge 17 commits into
terminal-ux/5-highlighting-performancefrom
terminal-ux/6-layout-and-files

Conversation

@rubensworks

@rubensworks rubensworks commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Phase 6, the last of the scripting terminal UX stack. Stacked on #81 (then #80, #79, #78, #77).

I checked each problem in a dev client driven by clientdevbridge before fixing it, then checked it again with this branch.

Commit Problem before Result with this PR
Show full script paths when hovering the script list inventory_sorting_main.js and inventory_sorting_test.js both showed as inventory_sorting..., and lib/helpers/math_utils.js was cut off. Hovering a script shows its full path, plus a "Right-click to rename" hint. The tooltip isn't drawn over open dialogs.
Allow renaming scripts in the scripting terminal New scripts were always scriptN.js, and could only be renamed or moved through the file system, which players on a server can't reach. Right-click a script for a rename dialog. A path like util/a/new.js moves it into folders, and changing the extension changes its language. The open script stays open with its undo history. Checked in-game: renames into new folders keep content on disk; renaming onto an existing name is refused; ../escape.js is rejected by the server, which then corrects the client, and nothing is written outside the disk folder.
Add a focus mode to enlarge the script editor (see #44) The editor is 168×115 GUI pixels: 7 lines of the sample script, wrapped. A button in the editor corner switches to an editor using most of the screen: 22 unwrapped lines at GUI scale 3. Escape or the button goes back. Typing, scrolling and the cursor position carry over, and clicks don't reach the hidden slots.
Show the focus mode button in the editor toolbar With the toolbar from #79, the focus button in the editor corner was a separate control in a different style. Focus mode is the rightmost toolbar button, with enter/exit icons. In focus mode the toolbar moves along above the enlarged editor, so all actions stay reachable. The exit tooltip mentions Escape.
Keep the full English terminal title next to the toolbar With the extra button, the English title "Scripting Terminal" was cut off. The title margin is reduced to 1px so the English title fits; pt_br is cut off with ….
Document focus mode and renaming keys in the info book These were listed in the shortcuts button that #79 removed. They are in the info book's "Editor Shortcuts" section from #79.

File watcher reloads

This branch first had a commit, "Don't let file watcher reloads discard unflushed script changes", because a reload during rename testing lost the renamed file. #78 now fixes the underlying problem more generally: reloads only apply changes made outside the mod. The merge from #81 therefore drops this branch's separate handling of unflushed changes. Its test, testDiskReloadKeepsUnflushedChanges, still passes, and I rechecked renaming in-game on the final code (three renames into new folders, all on disk with their content).

A fix for a resize data-loss bug I found while working on this (the editor came back empty after a window resize, and the next keystroke overwrote the script) is in #77 instead, since it affects master and should land first.

Dropped from the original plan

  • Disk labels: the disk item's tooltip already shows its ID, so disks can already be matched to the terminal's disk selector.
  • Marking .stdout/.stderr log files: they already open as readable text in the terminal, and I found no actual problem with how they're shown today.
  • Delete key to delete scripts: the existing delete button covers it.

Testing

  • ./gradlew build passes, including the new unit test.
  • ./gradlew runGameTestServer: all 22 tests pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9

Paths in the script list are truncated, so files with a common prefix,
such as inventory_sorting_main.js and inventory_sorting_test.js, or
files in subdirectories could not be told apart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
When the file watcher reloaded a disk directory, for example because the
server just wrote or deleted a script there, it replaced all scripts in
memory with the disk contents. Changes that were not flushed to disk yet
were lost, such as the new file of a rename when the old one was deleted
first. Keep unflushed changes when reloading.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
New scripts were always named script0.js, script1.js and so on, and could
only be renamed or moved into directories through the file system, which
players on a server can't access. Right-click a script to rename it,
which also allows moving it into a directory or changing its language
through its extension.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
…x/6-layout-and-files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
The editor only uses a small part of the screen, showing about a dozen
wrapped lines. Add a button to show only the editor, using most of the
screen. Escape or the button returns to the normal terminal.

See #44

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
@coveralls

coveralls commented Oct 17, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 39132296337

Coverage decreased (-1.9%) to 41.789%

Details

  • Coverage decreased (-1.9%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 343 coverage regressions across 5 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

343 previously-covered lines in 5 files lost coverage.

File Lines Losing Coverage Coverage
org/cyclops/integratedscripting/client/gui/container/ContainerScreenTerminalScripting.java 259 0.0%
org/cyclops/integratedscripting/inventory/container/ContainerTerminalScripting.java 51 21.66%
org/cyclops/integratedscripting/client/gui/component/input/WidgetDialog.java 30 0.0%
org/cyclops/integratedscripting/client/gui/image/ScriptImages.java 2 0.0%
org/cyclops/integratedscripting/proxy/CommonProxy.java 1 88.89%

Coverage Stats

Coverage Status
Relevant Lines: 3564
Covered Lines: 1627
Line Coverage: 45.65%
Relevant Branches: 1533
Covered Branches: 503
Branch Coverage: 32.81%
Branches in Coverage %: Yes
Coverage Strength: 22.21 hits per line

💛 - Coveralls

…x/6-layout-and-files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
…x/6-layout-and-files

The file watcher reloads now only apply changes made outside of the mod,
which also covers unflushed changes, so the separate handling of dirty
paths during reloads is dropped. Its test still passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
…x/6-layout-and-files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
…x/6-layout-and-files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
…x/6-layout-and-files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
…x/6-layout-and-files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
The focus mode button overlapped the new toolbar. Show it as the last
toolbar button with its own icons, keep the toolbar available in focus
mode, and list renaming and focus mode in the shortcut overview.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
…x/6-layout-and-files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
With the focus mode button in the toolbar, the margin before the toolbar
cut off the last letters of the English title, while it fits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
These were listed in the removed shortcuts button, so they now go in the
info book section with the other shortcuts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9

Copy link
Copy Markdown
Member Author

Replaced by #89: same changes, rebased with every commit as one standalone change.


Generated by Claude Code

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.

3 participants