Closed Bug 1519314 Opened 5 years ago Closed 5 years ago

Handling Enter differently when devtools.webconsole.input.editor is true

Categories

(DevTools :: Console, task, P1)

65 Branch
task

Tracking

(firefox69 fixed)

RESOLVED FIXED
Firefox 69
Tracking Status
firefox69 --- fixed

People

(Reporter: nchevobbe, Assigned: transfusion, Mentored)

References

Details

(Keywords: good-first-bug, Whiteboard: [console-editor-mvp])

Attachments

(1 file, 1 obsolete file)

When the preference is enabled, hitting Enter should create a new line.
Evaluation should be done with Ctrl + Enter (Cmd + Enter on OSX).

Priority: -- → P2
Attachment #9037901 - Attachment is obsolete: true

If someone wants to work on this, they should be able to grab https://phabricator.services.mozilla.com/D17098 which implements what we want.
Then, a test should be added to make sure that hitting Ctrl (or Cmd on OSX) + Enter does execute the input (and Enter does not) when in editor mode.

You can have the JsTerm in editor mode by running firefox with the following: ./mach run --devtools --setpref devtools.webconsole.input.editor=true

To write the test, you can also have a look at what was done in Bug 1519315.

Mentor: nchevobbe

Erik, as discussed on Slack, I assign you this patch. Feel free to ask any question, either here or on slack

Assignee: nobody → okemmadueric
Status: NEW → ASSIGNED

Hello Eric, how is it going on? Is anything blocking you?

Flags: needinfo?(okemmadueric)

Yes, couldn't ascertain why the function is not executing and dev tool debugger couldn't help me

Flags: needinfo?(okemmadueric)

Could you do a screencast and post it here (or on Slack) so we can check what's going on?

Type: defect → enhancement

clearing assignee

Assignee: okemmadueric → nobody
Status: ASSIGNED → NEW
Keywords: good-first-bug
Type: enhancement → task

Summary of the process I went through to fix this bug:

  • Modified JSTerm.js based on https://phabricator.services.mozilla.com/D17098 , added lines 953 to 963, as well as a couple lines below that to handle the case where codeMirror is not enabled with the legacy JSTerm.
  • To write the test, you can also have a look at what was done in Bug 1519315. Bug 1519315 is still open, however, Bug 1519313 was relatively similar and I added the mochitests based on that, 2 subtests where the editor is enabled, and 3 where disabled, each run once without codeMirror and once with, thus 10 subtests in total.

I have a question about EventUtils.sendKey and about the testing framework in general, I was looking for a reference to the current "window" since the 2nd argument is function sendKey(aKey, aWindow) {; I looked in other tests and found some usages like toolbox.getCurrentPanel(), however I didn't completely understand what a panel was and how I should get a reference to it, and since we openNewTabAndConsole, only test on the focus console and I saw other tests not including the 2nd argument I decided to leave it out.

Documentation was also a bit sparse especially about some properties on the hud, but through dxr I was able to understand how findMessages and related functions work.

Assignee: nobody → bryan.wyern1
Status: NEW → ASSIGNED
Priority: P2 → P1
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d23b1e5f649c
Enter should create a new line, Ctrl-Enter should execute the input when 'devtools.webconsole.input.editor' is true. r=nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 69
Blocks: 1557632
Whiteboard: [console-editor-mvp]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: