Bug 1746149 - [devtools] Remove OSX-specific Cmd+G shortcut in debugger. r=jdescottes.

The keyboard shortcut was supposed to move to the next search
result, but was only working on OSX. As you can already cycle
through search results with Enter, and given that Cmd+G only (barely)
work on OSX, it's safe to remove it.

Differential Revision: https://phabricator.services.mozilla.com/D134128
This commit is contained in:
Nicolas Chevobbe 2021-12-17 13:53:55 +00:00
Родитель e42701e569
Коммит 997279c94d
5 изменённых файлов: 6 добавлений и 87 удалений

Просмотреть файл

@ -29,16 +29,8 @@ import "./SearchBar.css";
const { PluralForm } = require("devtools/shared/plural-form");
const { debounce } = require("devtools/shared/debounce");
function getShortcuts() {
const searchAgainKey = L10N.getStr("sourceSearch.search.again.key3");
const searchAgainPrevKey = L10N.getStr("sourceSearch.search.againPrev.key3");
const searchKey = L10N.getStr("sourceSearch.search.key2");
return {
shiftSearchAgainShortcut: searchAgainPrevKey,
searchAgainShortcut: searchAgainKey,
searchShortcut: searchKey,
};
function getSearchShortcut() {
return L10N.getStr("sourceSearch.search.key2");
}
class SearchBar extends Component {
@ -55,16 +47,10 @@ class SearchBar extends Component {
componentWillUnmount() {
const { shortcuts } = this.context;
const {
searchShortcut,
searchAgainShortcut,
shiftSearchAgainShortcut,
} = getShortcuts();
shortcuts.off(searchShortcut);
shortcuts.off("Escape");
shortcuts.off(searchAgainShortcut);
shortcuts.off(shiftSearchAgainShortcut);
shortcuts.off(getSearchShortcut(), this.toggleSearch);
shortcuts.off("Escape", this.onEscape);
this.doSearch.cancel();
}
@ -73,18 +59,9 @@ class SearchBar extends Component {
// reduce frequency of queries
this.doSearch = debounce(this.doSearch, 100);
const { shortcuts } = this.context;
const {
searchShortcut,
searchAgainShortcut,
shiftSearchAgainShortcut,
} = getShortcuts();
shortcuts.on(searchShortcut, this.toggleSearch);
shortcuts.on(getSearchShortcut(), this.toggleSearch);
shortcuts.on("Escape", this.onEscape);
shortcuts.on(shiftSearchAgainShortcut, e => this.traverseResults(e, true));
shortcuts.on(searchAgainShortcut, e => this.traverseResults(e, false));
}
componentDidUpdate(prevProps, prevState) {

Просмотреть файл

@ -70,10 +70,6 @@ export class ShortcutsModal extends Component {
L10N.getStr("shortcuts.fileSearch2"),
formatKeyShortcut(L10N.getStr("sources.search.key2"))
)}
{this.renderShorcutItem(
L10N.getStr("shortcuts.searchAgain2"),
formatKeyShortcut(L10N.getStr("sourceSearch.search.again.key3"))
)}
{this.renderShorcutItem(
L10N.getStr("shortcuts.projectSearch2"),
formatKeyShortcut(L10N.getStr("projectTextSearch.key"))

Просмотреть файл

@ -144,19 +144,6 @@ exports[`ShortcutsModal renders when enabled 1`] = `
</span>
</span>
</li>
<li>
<span>
Find next
</span>
<span>
<span
className="keystroke"
key="Cmd+G"
>
Cmd+G
</span>
</span>
</li>
<li>
<span>
Find in files

Просмотреть файл

@ -4,8 +4,6 @@
// Tests the search bar correctly responds to queries, enter, shift enter
const IS_MAC_OSX = AppConstants.platform === "macosx";
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "simple1.js");
const {
@ -112,25 +110,6 @@ add_task(async function() {
"Enter cycles forward through the results"
);
if (IS_MAC_OSX) {
info(
"cmd+G and cmdShift+G shortcut for traversing results only work for macOS"
);
await navigateWithKey(
dbg,
"fileSearchNext",
linesWithResults[1],
"Cmd+G moves forward in the search results"
);
await navigateWithKey(
dbg,
"fileSearchPrev",
linesWithResults[0],
"Cmd+Shift+G moves backward in the search results"
);
}
info("Check that changing the search term works");
pressKey(dbg, "fileSearch");
type(dbg, "doEval");

Просмотреть файл

@ -281,18 +281,6 @@ sourceSearch.search.placeholder=Search in file…
# the source search input bar
sourceSearch.search.placeholder2=Find in file…
# LOCALIZATION NOTE (sourceSearch.search.again.key3): Key shortcut to highlight
# the next occurrence of the last search triggered from a source search
# Do not localize "Cmd+G", or change the format of the string. These are
# key identifiers, not messages displayed to the user.
sourceSearch.search.again.key3=Cmd+G
# LOCALIZATION NOTE (sourceSearch.search.againPrev.key3): Key shortcut to highlight
# the previous occurrence of the last search triggered from a source search
# Do not localize "Cmd+Shift+G", or change the format of the string. These are
# key identifiers, not messages displayed to the user.
sourceSearch.search.againPrev.key3=Cmd+Shift+G
# LOCALIZATION NOTE (sourceSearch.resultsSummary2): Semi-colon list of plural forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
# Shows a summary of the number of matches for autocomplete
@ -893,14 +881,6 @@ shortcuts.fileSearch2=Go to file
# keyboard shortcut for jumping to a specific line
shortcuts.gotoLine=Go to line
# LOCALIZATION NOTE (shortcuts.searchAgain): text describing
# keyboard shortcut action for searching again
shortcuts.searchAgain=Search Again
# LOCALIZATION NOTE (shortcuts.searchAgain2): text describing
# keyboard shortcut action for searching again
shortcuts.searchAgain2=Find next
# LOCALIZATION NOTE (shortcuts.projectSearch): text describing
# keyboard shortcut action for full project search
shortcuts.projectSearch=Full Project Search