Closed Bug 612252 Opened 14 years ago Closed 11 years ago

"clear console" needs a keyboard shortcut in a bad way

Categories

(DevTools :: Console, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 24

People

(Reporter: dietrich, Unassigned)

References

Details

(Keywords: dev-doc-needed, uiwanted, Whiteboard: [fixed by bug 879799][strings] [console-1] [good first bug][mentor=msucan][lang=js])

Attachments

(1 file, 2 obsolete files)

using the context menu item requires mouse usage, typing "clear()" is undiscoverable (and too many keystrokes).

it would reduce developer frustration (in my case anyway) if there was a keyboard shortcut to clear the console. that way when you're doing reload-log cycles ad-infinitum you don't have to worry about cursor position or the mouse at all.
Assignee: nobody → pwalton
Blocks: devtools4
Status: NEW → ASSIGNED
What keyboard shortcut should we use here? On the Mac, ⌘K is the shortcut that Terminal.app uses to clear the console, but it's already in use for search in Firefox. ⌘⇧K is in use as well, to close the Web Console.
Keywords: uiwanted
that is the question. I suggested, half-jokingly that we use Ctrl/Cmd-Y a la emacs' yank command and possibly put the contents on the clipboard. Ctrl-G (terminal cancel) could work, but it's used for searching. Function keys are kind of off the beaten path...
Per a discussion with Kevin I'm going to propose ⌘⇧L (for "cLear"?)
Whiteboard: [strings]
I believe this breaks string freeze, so marking as [strings].
Attached patch Proposed patch. (obsolete) — Splinter Review
Proposed patch attached.
Attachment #491621 - Flags: feedback?(mihai.sucan)
This patch also contains a fix for bug 612253 (adding a keyboard shortcut to focus the input line).
One open question is how to make these keyboard shortcuts discoverable...
Comment on attachment 491621 [details] [diff] [review]
Proposed patch.

Patch looks fine. Comments:

+      case "focusInput":
+        let hudBox = HUDService.hudReferences[hudId].HUDBox;
+        hudBox.querySelector(".jsterm-input-node").focus();
+        break;

Why not do hud.jsterm.inputNode.focus() ? Like you did in the mochitest.

+    jsterm.clearOutput();
+    finishTest();

finishTest() will close the tab with the Web Console. Clearing the output is not really needed.

Control-Shift-I is used by the DOM Inspector extension. I cannot focus the input using the shortcut.

To make the keys discoverable I suggest adding the [Ctrl-Shift-L] and [Ctrl-Shift-I] strings to tooltips for each relevant element: to the input, and to the Clear console menuitem (soon the Clear button). Also, these need to be documented in the wiki page about the Web Console.
Attachment #491621 - Flags: feedback?(mihai.sucan) → feedback+
bummer about control-shift-I and DOM Inspector. I don't think we want to compete with that particular extension for the key.

control-shift-M for coMMand line? bleah...

(also, I've cc'ed sheppy and added dev-doc-needed for this so that we make sure the Web Console page is updated...)
Keywords: dev-doc-needed
cmd/ctrl-shift-I is also used by the (non DOMi) Inspector. DOMi overrides this setting in later versions.

I think when we were hunting for an unused key back then, we realized that all the good keys are taken. Q.v., ctrl-E for Panorama.
mass change: filter on PRIORITYSETTING
Priority: -- → P2
Whiteboard: [strings] → [strings] [console-1]
Assignee: pwalton → nobody
No longer blocks: devtools4
Status: ASSIGNED → NEW
Component: Developer Tools → Developer Tools: Console
OS: Linux → All
Hardware: x86 → All
Whiteboard: [strings] [console-1] → [strings] [console-1] [good first bug][mentor=msucan][lang=js]
Status: NEW → ASSIGNED
Component: Developer Tools: Console → Developer Tools
OS: All → Linux
Hardware: All → x86
Status: ASSIGNED → NEW
Component: Developer Tools → Developer Tools: Console
OS: Linux → All
QA Contact: developer.tools → developer.tools.console
Hardware: x86 → All
Assignee: nobody → sonny.piers
Attached patch 0.1 (obsolete) — Splinter Review
I use the accel+shift+C shortcurt but it's probably already used somewhere, need instruction on this.
Attachment #491621 - Attachment is obsolete: true
Attachment #608382 - Flags: review?(paul)
Attached patch 0.1.1Splinter Review
I forgot to remove a debug line in the test.
Attachment #608382 - Attachment is obsolete: true
Attachment #608390 - Flags: review?(paul)
Attachment #608382 - Flags: review?(paul)
Accel+shift+C seems to be used by firebug.
Why don't you keep the <command>?
IIRC it's because I wanted to use the same code for the keyboard shortcut and for the button.
Comment on attachment 608390 [details] [diff] [review]
0.1.1

Sorry for the delay :/

Can you move the `const` somewhere else?
(or not use it at all)

Also, do you think we could not build the <key> dynamically and, instead, add it somewhere here: http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser-sets.inc#234
Attachment #608390 - Flags: review?(paul)
What's the status of this? (Just curious, because I ran into this problem again the other day)
doing a little spelunking, line 472 in webconsole.js:

    let clearButton = doc.getElementsByClassName("webconsole-clear-console-button")[0];
    clearButton.addEventListener("command", function WCF__onClearButton() {
      this.owner._onClearButton();
      this.jsterm.clearOutput(true);
    }.bind(this));

What I'd like to see is a clear command in webconsole.xul associated with this button. No need to set all this up dynamically.
Sonny, are you still working on this bug? I'm checking because it's on the list of mentored bugs. Thanks!
Flags: needinfo?(sonny.piers)
Depends on: 879799
Assignee: sonny.piers → nobody
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: needinfo?(sonny.piers)
Resolution: --- → FIXED
Whiteboard: [strings] [console-1] [good first bug][mentor=msucan][lang=js] → [fixed by bug 879799][strings] [console-1] [good first bug][mentor=msucan][lang=js]
Target Milestone: --- → Firefox 24
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: