-
Notifications
You must be signed in to change notification settings - Fork 7
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 input #217
Conversation
ebd211e
to
85dd90b
Compare
25047a3
to
fc42dcb
Compare
Older discussions can be found on #196 |
fc42dcb
to
fd9de12
Compare
Can this be deployed somewhere? https://papyros.dodona.be/dev shows a blank page for me. |
I didn't get a blank page, but I have also scheduled a deployment as the deployed version wasn't this one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I had to manually uninstall the service worker through devtools to get this to load on /dev
- The gutter is very narrow, can you add some padding left and right of the icon?
- I don't think the green color is needed
- Can we somehow highlight the next line to be used as "active" using a light bg-color?
- Tooltip: "This line has already been used as input", "Deze regel werd al gebruikt als invoer"
- There seems to be a slight misalignment between the editor and gutter (both code and input). The vertical alignment of the gutter is off, you can easily see this for highlighted lines:
That's odd. The service worker hasn't been changed in quite a while, so I'm unsure what could cause this issue. |
ab266b9
to
6cac934
Compare
Does this mean the part containing the prompt it answered should be omitted? Or should I append that to these strings? |
@winniederidder: The version that is deplyoyed right now on |
Correct, I re-deployed the run-python-doctest branch so that @bmesuere can review that branch more easily, as I applied the suggested changes. |
df761dc
to
c7c858d
Compare
5cef67e
to
78163e7
Compare
Highlighting line that will be consumed next is a bit weird as a feature, as there is no guarantee that another line will be consumed. On the other side, the highligting is so subtle that almost need to know this feature exists, to notice it. |
Just as the code in the editor is stored and reused after a page load, it might be interesting to do the same for batch input. |
Chan background color doesn’t look great in dark mode. |
Misalignment between editor and gutter now even seems worse. Hadn’t noticed it myself before, but now I clearly see it on iPad. |
So, after the recent changes it is visible on iPad yet better on the desktop version? |
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 #216 (to be able to use cleaned version of onChange in the new Editor base class)