mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-15 19:20:13 +00:00
Bug 919707 - Make shift-click on a gutter select whole lines in the editor. r=robcee
This commit is contained in:
parent
64cc922f74
commit
6258579c2a
@ -238,9 +238,19 @@ Editor.prototype = {
|
||||
|
||||
cm.on("focus", () => this.emit("focus"));
|
||||
cm.on("change", () => this.emit("change"));
|
||||
cm.on("gutterClick", (cm, line) => this.emit("gutterClick", line));
|
||||
cm.on("cursorActivity", (cm) => this.emit("cursorActivity"));
|
||||
|
||||
cm.on("gutterClick", (cm, line, gutter, ev) => {
|
||||
let head = { line: line, ch: 0 };
|
||||
let tail = { line: line, ch: this.getText(line).length };
|
||||
|
||||
// Shift-click on a gutter selects the whole line.
|
||||
if (ev.shiftKey)
|
||||
return void cm.setSelection(head, tail);
|
||||
|
||||
this.emit("gutterClick", line);
|
||||
});
|
||||
|
||||
win.CodeMirror.defineExtension("l10n", (name) => {
|
||||
return L10N.GetStringFromName(name);
|
||||
});
|
||||
|
@ -31,6 +31,13 @@ function test() {
|
||||
ed.dropSelection();
|
||||
is(ed.getSelection(), "", "dropSelection");
|
||||
|
||||
// Check that shift-click on a gutter selects the whole line (bug 919707)
|
||||
let iframe = win.document.querySelector("iframe");
|
||||
let gutter = iframe.contentWindow.document.querySelector(".CodeMirror-gutters");
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown", shiftKey: true }, gutter, iframe.contentWindow);
|
||||
is(ed.getSelection(), "Hello.", "shift-click");
|
||||
|
||||
teardown(ed, win);
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user