diff --git a/src/devtools/client/debugger/src/components/Editor/NewSourceAdapter.tsx b/src/devtools/client/debugger/src/components/Editor/NewSourceAdapter.tsx index cd1d17ea80d..9b160c4fa7c 100644 --- a/src/devtools/client/debugger/src/components/Editor/NewSourceAdapter.tsx +++ b/src/devtools/client/debugger/src/components/Editor/NewSourceAdapter.tsx @@ -12,7 +12,7 @@ import { KeyboardModifiersContextRoot } from "replay-next/src/contexts/KeyboardM import { SourcesContext } from "replay-next/src/contexts/SourcesContext"; import { getSourceSuspends } from "replay-next/src/suspense/SourcesCache"; import { ReplayClientContext } from "shared/client/ReplayClientContext"; -import { useGraphQLUserData } from "shared/user-data/GraphQL/useGraphQLUserData"; +import { isMacOS } from "shared/utils/os"; import { getSelectedLocation, getSelectedLocationHasScrolled } from "ui/reducers/sources"; import { useAppDispatch, useAppSelector } from "ui/setup/hooks"; @@ -122,7 +122,9 @@ function NewSourceAdapter() { break; } case "g": { - if (event.ctrlKey || event.metaKey) { + // CMD+G should continue an in-progress search + // CTRL+G is for go-to-line though + if (isMacOS() ? event.metaKey : event.ctrlKey) { // Unlike Enter / Shift+Enter, this event handler is external to the Search input // so that we can mirror UIs like Chrome and Code and re-open the search UI if it's been closed sourceSearchActions.enable(); diff --git a/src/devtools/client/inspector/markup/components/InspectorSearch.tsx b/src/devtools/client/inspector/markup/components/InspectorSearch.tsx index bbe42926afa..5ea5e7ccdb6 100644 --- a/src/devtools/client/inspector/markup/components/InspectorSearch.tsx +++ b/src/devtools/client/inspector/markup/components/InspectorSearch.tsx @@ -84,8 +84,8 @@ export function InspectorSearch() { startFullTextSearch(searchText, e.shiftKey); } - // Honestly I have no idea why this was in the original search logic. - // Apparently search if you hit CTRL+G? Weird combo. + // CMD+G should continue an in-progress search + // CTRL+G is for go-to-line though const modifierKey = isMacOS() ? e.metaKey : e.ctrlKey; if (e.key === "g" && modifierKey) { startFullTextSearch(searchText, e.shiftKey); diff --git a/src/ui/components/KeyboardShortcuts.tsx b/src/ui/components/KeyboardShortcuts.tsx index f46877565c4..31a0662798c 100644 --- a/src/ui/components/KeyboardShortcuts.tsx +++ b/src/ui/components/KeyboardShortcuts.tsx @@ -14,6 +14,8 @@ import { userData } from "shared/user-data/GraphQL/UserData"; import { UIThunkAction, actions } from "ui/actions"; import { useGetRecordingId } from "ui/hooks/recordings"; import { selectors } from "ui/reducers"; +import { getSelectedSource } from "ui/reducers/sources"; +import { useAppSelector } from "ui/setup/hooks"; import { UIState } from "ui/state"; import { addGlobalShortcut, isEditableElement, removeGlobalShortcut } from "ui/utils/key-shortcuts"; import { trackEvent } from "ui/utils/telemetry"; @@ -61,6 +63,8 @@ function KeyboardShortcuts({ const { isAuthenticated } = useAuth0(); const [, dismissFindFileNag] = useNag(Nag.FIND_FILE); + const selectedSource = useAppSelector(getSelectedSource); + const [protocolTimeline] = useGraphQLUserData("feature_protocolTimeline"); const globalKeyboardShortcuts = useMemo(() => { const openFullTextSearch = (e: KeyboardEvent) => { @@ -86,6 +90,12 @@ function KeyboardShortcuts({ toggleQuickOpenModal(e, "@"); }; + const toggleGoToLine = (e: KeyboardEvent) => { + if (selectedSource) { + toggleQuickOpenModal(e, ":"); + } + }; + const toggleQuickOpenModal = (e: KeyboardEvent, query = "", project = false) => { dismissFindFileNag(); @@ -172,8 +182,11 @@ function KeyboardShortcuts({ // Quick Open-related toggles "CmdOrCtrl+Shift+P": toggleQuickOpenModal, - // We apparently accept this with or without a Shift key currently "CmdOrCtrl+P": toggleQuickOpenModal, + + // Go to line + "Ctrl+K": toggleGoToLine, + // Can pre-fill the dialog with specific filter prefixes "CmdOrCtrl+Shift+O": toggleFunctionQuickOpenModal, "CmdOrCtrl+O": toggleProjectFunctionQuickOpenModal, @@ -201,6 +214,7 @@ function KeyboardShortcuts({ jumpToPreviousPause, jumpToNextPause, dismissFindFileNag, + selectedSource, ]); useEffect(() => {