mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 17:55:50 +00:00
010f6b2666
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). Differential Revision: https://phabricator.services.mozilla.com/D44466 --HG-- extra : moz-landing-system : lando |
||
---|---|---|
.. | ||
client | ||
docs | ||
platform | ||
server | ||
shared | ||
startup | ||
.eslintrc.js | ||
.eslintrc.mochitests.js | ||
.eslintrc.xpcshell.js | ||
CODE_OF_CONDUCT.md | ||
moz.build | ||
templates.mozbuild |