Repository navigation
Fix scripting terminal editor bugs (scroll, cursor, focus, sync) - #77
Merged
Merged
Conversation
Editing reset the first visible row to the top, while the scrollbar stayed in place. Only reset it when a new script is loaded, and clamp the scroll position when the text shrinks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
Only up and down arrow keys scrolled the editor, so typing, pressing enter, home/end and pasting could move the cursor out of view. Scroll to the cursor after every handled key or typed character, and allow the cursor to be placed on the empty line after a trailing newline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
Pressing a key the editor doesn't handle, such as tab or a function key, unfocused it, so a following 'e' closed the terminal. Consume all keys except escape while focused. Typing only worked before because of this unfocusing: once the widget stays focused, EditBox.charTyped consumes every character into its own unused value. Handle characters without delegating to EditBox. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
String.split dropped trailing empty strings, so blank lines at the end of a script were lost when sending it between client and server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
Script error messages count lines from 1, so a 0-based gutter made them off by one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
The wrap width didn't account for the scrollbar, so long lines were drawn underneath it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
Both keys were consumed without doing anything. Move the cursor and the viewport by one page instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
Coverage Report for CI Build 39131310929Coverage decreased (-0.6%) to 46.751%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions312 previously-covered lines in 2 files lost coverage.
Coverage Stats
💛 - Coveralls |
This was referenced Oct 17, 2026
Resizing the window, or changing the GUI scale, recreated the editor without the open script. The next key press then replaced the whole script with what was typed into the empty editor. Restore the open script and cursor position when the screen is initialized again, and close the removal dialog if it was open, as its widgets are removed as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
This was referenced Oct 17, 2026
On macOS, Cmd+Left/Right jumped by word, while native text fields use Option+Left/Right for that, and Cmd+Left/Right to go to the start or end of the line. The editor now follows these conventions on macOS, including Option+Backspace to delete a word and Cmd+Up/Down to go to the start or end of the script. Other platforms keep using Ctrl. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
When a selection continued below the last visible line, the highlight of the hidden next line was drawn over the editor's bottom border. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
The script editor claimed every mouse drag, even outside of it, so spreading a held stack over inventory slots by dragging put the whole stack in one slot. The editor now only claims drags it handles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
… line The editor has room for part of a row below its last visible line. Clicking or dragging there put the cursor on that hidden line, and the cursor was drawn over the editor's bottom border. Such positions now go to the last visible line instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
This was referenced Oct 18, 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.
Phase 1 of the scripting terminal UX improvements, and the base of a stack: #77 ← #78 ← #79 ← #80 ← #81 ← #82. Each commit fixes one problem.
Each problem below was first reproduced on
master-1.21-ltsin a dev client driven by clientdevbridge, then checked again with this branch.String.splitdropped trailing empty lines when syncing."a\n\n"became"a") and passes here.script0.js:2:6).z).About the focus fix
Since
WidgetTextAreaextendsEditBox(bfe27b7, #40),EditBox.charTypedconsumes every character into its own unused value while the widget is focused. Typing only worked because each key press unfocused the widget right before its character arrived. This PR keeps focus, so it also stops delegatingcharTypedtoEditBox. I checked that normal typing still works with real key press and character events.Testing
./gradlew buildpasses, including the new unit tests../gradlew runGameTestServer: all 22 tests pass.Not fixed here
While testing, the terminal's disk list contained a disk with ID
-1. I didn't look into the cause.🤖 Generated with Claude Code
https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9