-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Console history not accessible with up arrow #3271
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
Comments
Looking at the component tree with the React devtools addon and comparing with the code in ConsoleInput.js:12-14, I can see that the I'm going to guess that the problem comes from the fact that
CC @nahbee10 because it would seem that the previous code, which correctly used state actions for that, was replaced in a466640#diff-5ea6bdfa3c08ded9faeb06a44e8ca992e31c3b5f94c816c390d1cc91266b96ffL45-R48 |
Thanks for raising this @bojidar-bg! I'm currently working on the Console at the moment, and can add this to the next set of changes to it! Hopefully it should be out by sometime next week. |
@raclim I'll Feel very happy to work on this issue |
Thanks for the interest @ujjwaldubey1! I did end up finding a solution to it and am currently in the midst of testing and making a few other edits to the Console, so I think we might be covered here. I'll check out the fix you just submitted for the other issue soon though! |
Okay!! |
@raclim when I reworked this component I found that I had to store both the line number and the array of commands in the same That was for v6 so the actual code will be a little different, but the principle still holds. p5.js-web-editor/client/modules/IDE/components/ConsoleInput.jsx Lines 76 to 79 in 750994d
(I actually feel that it's very bad practice to induce a side effect from within a p5.js-web-editor/client/modules/IDE/components/ConsoleInput.jsx Lines 93 to 101 in 750994d
p5.js-web-editor/client/modules/IDE/components/ConsoleInput.jsx Lines 115 to 122 in 750994d
|
Thanks for identifying the relevant commit. I can see that we actually were using
Stale closures are a major issue when dealing with these CodeMirror components, and it's why I've rejected so many previous attempts to convert this component. There is a lot of explanation and suggestions in my review comments on #2409 that you should look at. |
@lindapaiste I just attached the PR I was working on—in it I continued with some of the newer changes and broke the I found it to work, but it's a bit lengthy and I guess I'm not sure if it's the best approach? |
p5.js version
1.11.1
What is your operating system?
Linux
Web browser and version
Firefox Version: 131.0.3 / 20241014102019
Actual Behavior
Pressing the up arrow key does not bring old code into the console's input field.
Expected Behavior
Pressing the up and down arrow keys cycles through history, so that we don't have to retype any of the code we've just entered
This used to be the case until recently; not sure at what point the regression happened, however.
Steps to reproduce
Steps:
1
. Press enter to execute it.Snippet:
N/A (Default sketch works just fine for reproducing.)
The text was updated successfully, but these errors were encountered: