Repository navigation
Edit Logic Programmer expressions in place - #1768
Closed
rubensworks wants to merge 7 commits into
Closed
rubensworks wants to merge 7 commits into
rubensworks wants to merge 7 commits into
Conversation
The text of the expression in the panel can now be edited directly, instead of switching to a separate text box with an Edit button. It keeps the colors of the read-only view, and clicking a part places the caret and opens that operator in the slots. Typing makes a draft: Enter applies it, Escape reverts it, and slots wait until then. Applying keeps the open operator if it is still there. Undo and Redo go back and forth through all changes to the expression, from slots, parameters and text alike, and are reset when another expression is opened. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MHtucHo4Qy2pTfBMgeE54y
The font has no undo, redo or copy symbols, so the icons are drawn pixel by pixel, in the same colors and with the same shadow as the text of text buttons. Copying briefly shows a check mark instead of the "Copied" text. The hint when hovering the expression is removed, as the button tooltips and the book already explain the editor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MHtucHo4Qy2pTfBMgeE54y
With icons, Undo, Redo and Copy fit right of the title, so the row of buttons below the expression is removed and the expression gets that height instead. Revert and Apply become a cross and a check there, with tooltips naming Esc and Enter. The add parameter button moves down a pixel so its plus is in line with the Parameters label. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MHtucHo4Qy2pTfBMgeE54y
The label sat right under the title like a second heading, while parameters are optional. The chips now sit under the title on their own, followed by a plus to add another, which reads "+ Parameter" while there are none. Chips are as tall as the button, so they line up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MHtucHo4Qy2pTfBMgeE54y
The main texture covers the left of the panel, so its content had a margin of 2 pixels on the left and 3 on the top and right. It now starts one pixel further right. The footer shows only the type, recognizable by its colors, and names it as the type in its tooltip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MHtucHo4Qy2pTfBMgeE54y
The type is recognizable by its colors, so the tooltip only got in the way when moving the mouse over the footer. Errors and text that does not fit still show a tooltip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MHtucHo4Qy2pTfBMgeE54y
The whole text turned plain as soon as a character was typed, which hid the open operator and the empty slots. The text before and after what was typed now keeps its colors. Errors are left out while typing, as the footer then shows the errors of the draft. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MHtucHo4Qy2pTfBMgeE54y
Member
Author
|
Combined into #1766: its branch was fast-forwarded to include these commits and those of #1767, so this PR is closed. Generated by Claude Code |
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.
Stacked on #1767 (
feature/expression-text), which is itself stacked on #1766, so this PR only shows the commits on top of it. It should be merged after both, or retargeted once they are in. It started as an experiment on its own branch, so #1767 can still go in without it.This replaces the separate text mode of #1767 with a single view: the colored expression in the panel can be edited directly, without an Edit button.
Screenshots from the dev client: https://claude.ai/artifact/Fwyz9rB9VqPMmZY6FYasuF
How it works
+that reads+ Parameterwhile there are none, and that is hidden at the limit of 8.What changed
ExpressionTextField(new, client only): vanillaMultilineTextFieldas the text model, drawn with a color and background per character, a selection, a blinking caret, an underline for parse errors and a scrollbar. Vanilla's edit boxes can only draw a single color. It is kept in the container, so it survives the panel being recreated when navigating.followChangescarries the colors of the printed text over to a draft, for the characters before and after the part that changed.ExpressionHistory(new): undo and redo stacks. Changes are recorded by observing the expression while rendering, so no action needs to know about it.ExpressionPrinter.tokenizeExact: the exact text as tokens with the path of their node, whichprintExactnow joins. This maps each character to its node, for colors and for navigating from the caret.OperatorLPElement.setExpression(expression, editPath)keeps the open operator.ContainerLogicProgrammerBasereplaces the text and one-step undo of Edit Logic Programmer expressions as text #1767 with the text field and the history, whichsetActiveElementresets, except while a set action itself switches the element.ButtonIcon(new): a CyclopsCoreButtonExtendedwith a pixel icon.OperatorLPElementRenderPattern: the merged view, its input (keys, clicks, selecting by dragging, scrolling), the toolbar, and the parameter row. The hover hint of Edit Logic Programmer expressions as text #1767 is gone.+ Parameterare new. Book: the paragraphs on parameters and on text describe the new buttons and editing in place.Things to decide on
Testing
TestExpressionHistory(undo and redo, a new change dropping redo, an equal expression not being a change, and the size limit and clearing) and 5 new inTestExpressionTextField(colors kept around typed, deleted and replaced text, and with repeated characters).testLogicProgrammerSetExpressionKeepsOpenOperator.(a: integer) -> a + #5, which switched to Arithmetic Addition with the real#5card in its slotScreen.hasControlDown()andScreen.hasShiftDown(), so I used the buttons instead.🤖 Generated with Claude Code
https://claude.ai/code/session_01MHtucHo4Qy2pTfBMgeE54y