mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 911916 - Search set to identifier under cursor if no text selected. r=vp
This commit is contained in:
parent
b072bd765c
commit
f915adbfe8
@ -1068,7 +1068,24 @@ FilterView.prototype = {
|
||||
_doSearch: function(aOperator = "", aText = "") {
|
||||
this._searchbox.focus();
|
||||
this._searchbox.value = ""; // Need to clear value beforehand. Bug 779738.
|
||||
this._searchbox.value = aOperator + (aText || DebuggerView.editor.getSelection());
|
||||
|
||||
if (aText) {
|
||||
this._searchbox.value = aOperator + aText;
|
||||
}
|
||||
else if (DebuggerView.editor.somethingSelected()) {
|
||||
this._searchbox.value = aOperator + DebuggerView.editor.getSelection();
|
||||
}
|
||||
else {
|
||||
let cursor = DebuggerView.editor.getCursor();
|
||||
let content = DebuggerView.editor.getText();
|
||||
let location = DebuggerView.Sources.selectedValue;
|
||||
let source = DebuggerController.Parser.get(content, location);
|
||||
let identifier = source.getIdentifierAt({ line: cursor.line+1, column: cursor.ch });
|
||||
|
||||
if (identifier && identifier.name) {
|
||||
this._searchbox.value = aOperator + identifier.name;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -247,6 +247,7 @@ support-files =
|
||||
[browser_dbg_variables-view-webidl.js]
|
||||
[browser_dbg_watch-expressions-01.js]
|
||||
[browser_dbg_watch-expressions-02.js]
|
||||
[browser_dbg_search-function.js]
|
||||
[browser_dbg_chrome-create.js]
|
||||
skip-if = os == "linux" # Bug 847558
|
||||
[browser_dbg_on-pause-raise.js]
|
||||
|
@ -0,0 +1,28 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Tests that Debugger Search uses the identifier under cursor
|
||||
* if nothing is selected or manually passed
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
function test() {
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_function-search.html";
|
||||
|
||||
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
|
||||
let Source = 'code_function-search-01.js';
|
||||
let Debugger = aPanel.panelWin;
|
||||
let Editor = Debugger.DebuggerView.editor;
|
||||
let Filtering = Debugger.DebuggerView.Filtering;
|
||||
|
||||
waitForSourceShown(aPanel, Source).then(() => {
|
||||
Editor.setCursor({ line: 7, ch: 0});
|
||||
Filtering._doSearch("@");
|
||||
is(Filtering._searchbox.value, "@test", "Searchbox value should be set to the identifier under cursor if no aText or selection provided");
|
||||
closeDebuggerAndFinish(aPanel);
|
||||
});
|
||||
});
|
||||
};
|
Loading…
Reference in New Issue
Block a user