mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 956943 - Replace Editor.extendSelection with CM version. r=vporof
This commit is contained in:
parent
5814ec2ee9
commit
ee2d651834
@ -2792,7 +2792,15 @@ GlobalSearchView.prototype = Heritage.extend(WidgetMethods, {
|
||||
let line = lineResultsItem.instance.line;
|
||||
|
||||
DebuggerView.setEditorLocation(url, line + 1, { noDebug: true });
|
||||
DebuggerView.editor.extendSelection(lineResultsItem.lineData.range);
|
||||
|
||||
let range = lineResultsItem.lineData.range;
|
||||
let cursor = DebuggerView.editor.getOffset({ line: line, ch: 0 });
|
||||
let [ anchor, head ] = DebuggerView.editor.getPosition(
|
||||
cursor + range.start,
|
||||
cursor + range.start + range.length
|
||||
);
|
||||
|
||||
DebuggerView.editor.setSelection(anchor, head);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -73,6 +73,7 @@ const CM_MAPPING = [
|
||||
"setSelection",
|
||||
"getSelection",
|
||||
"replaceSelection",
|
||||
"extendSelection",
|
||||
"undo",
|
||||
"redo",
|
||||
"clearHistory",
|
||||
@ -366,18 +367,6 @@ Editor.prototype = {
|
||||
this.setCursor(this.getCursor());
|
||||
},
|
||||
|
||||
/**
|
||||
* Extends the current selection to the position specified
|
||||
* by the provided {line, ch} object.
|
||||
*/
|
||||
extendSelection: function (pos) {
|
||||
let cm = editors.get(this);
|
||||
let cursor = cm.indexFromPos(cm.getCursor());
|
||||
let anchor = cm.posFromIndex(cursor + pos.start);
|
||||
let head = cm.posFromIndex(cursor + pos.start + pos.length);
|
||||
cm.setSelection(anchor, head);
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the first visible line number in the editor.
|
||||
*/
|
||||
|
@ -25,9 +25,6 @@ function test() {
|
||||
ed.setSelection({ line: 0, ch: 0 }, { line: 0, ch: 5 });
|
||||
is(ed.getSelection(), "Hello", "setSelection");
|
||||
|
||||
ed.extendSelection({ start: 0, length: 5 });
|
||||
is(ed.getSelection(), ".\nHow", "extendSelection");
|
||||
|
||||
ed.dropSelection();
|
||||
is(ed.getSelection(), "", "dropSelection");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user