-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Highlight consumed batch input #196
Conversation
@winniederidder: can you deploy on /dev? Would help to see it in action |
Branch is being deployed, should be available in a minute or two. |
This is indeed linting becoming active when a lintSource is provided. Currently, the gutters are absent until linting is possible, but I can add them by default again if this is unwanted behaviour. |
Unwanted behaviour according to me. |
ef539be
to
57c83fc
Compare
534dae5
to
d5e86a7
Compare
d5e86a7
to
ec7d824
Compare
Also check UI in dark mode |
LGTM Papyros.-.Google.Chrome.2022-05-27.10-39-33.mp4 |
If the goal was to make consumed input read-only, this still doesn't work. I can still edit lines after they have been consumed. |
72e28f5
to
2f61af6
Compare
Currently, these are indeed not made read-only. This might indeed be something that we want. |
I have now also added support to making consumed lines read-only while the run is happening. |
We might add the prompt that was used when a line of input was consumed, to the tooltip of the icon (check mark) in the gutter of the input field. This way, students can inspect which line was consumed by which prompt. Extension: if the same prompt is used more than once in the same run, we could add a number indicating what instance of the prompt we refer to (e.g. “What is your name? (3)” = third instance). |
This PR adds support for highlighting the lines that have been consumed in batch mode.
A div element with contenteditable=true has some undesirable default behaviour that is very clunky and error-prone to work with (first child is a TextNode before using divs, replacing that TextNode with a div causes new elements to appear, ...) so I decided to stop using it. Instead, CodeMirror already provides an editor with plenty of flexiblity and a useful API. This editor can then share some code with the CodeEditor-class.
To provide actual highlighting and gutters, I added new classes. The Gutters base class allows creating arbitrary gutters (such as the checkmark gutter, but also a breakpoint gutter (useful for #109)). To prevent code duplication in the BatchInputEditor, I created a base class grouping similar functionality between the input and the code editor together. I also used the CodeMirror theme extension to properly fix the layout of the editor is always correct.
The highlight-style is still up for debate. I currently use the built-in CodeMirror activeLine classes.
Closes #82
Depends on #195 (to be able to use cleaned version of onChange in the new Editor base class)