Pressing Tab causes scrolling in the editor when it overflows
Categories
(DevTools :: Console, defect, P2)
Tracking
(firefox71 fixed)
| Tracking | Status | |
|---|---|---|
| firefox71 | --- | fixed |
People
(Reporter: 326374, Assigned: nchevobbe)
References
Details
Attachments
(1 file)
What were you doing?
- Open the new multiline editor in the Console (Ctrl+B)
- Write a long script (that causes a scrollbar)
- Scroll all the way up (so that line 1 is visible)
- Put the cursor on the second line
- Press Tab
What happened?
The window was automatically scrolled, so that the top line is line 2.
What should have happened?
No scrolling.
Anything else we should know?
The bug occurs in safe mode.
Nightly build: 20190902094857
| Assignee | ||
Comment 1•6 years ago
|
||
Thanks for filing this bug Dan.
I do reproduce the issue, and I should have a fix ready today :)
Updated•6 years ago
|
| Assignee | ||
Comment 2•6 years ago
|
||
When we wanted to insert a string in the webconsole input,
we were setting the input value, and setting the cursor
manually. But since the editor setCursor function is calling
alignLine, there could be cases where the editor scroll position
would jump, feeling awkward for the user.
It turns out we can simplify this code a lot since codeMirror
provides a replaceRange function, which is a perfect replacement
for what we were using, without having to manage the cursor position.
The only downside to that is that inserting characters this
way does fire a changes event, that we are listening to
in the JsTerm to request autocompletion (which we don't need
as we only insert characters when accepting a completion or
adding a tab).
To mitigate that, we pass a specific jsterm origin string to
replaceRange, which let's us discriminate in the changes event
listener if those changes originate from jsterm only actions.
A test is added to ensure this works as expected (the test was
failing without the fix).
Comment 4•6 years ago
|
||
| bugherder | ||
Updated•6 years ago
|
Description
•