mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Merge pull request #1303 from RooVetGit/cycle_custom_modes_too
Include custom modes in mode switching keyboard shortcut
This commit is contained in:
commit
108e97843f
2 changed files with 13 additions and 6 deletions
5
.changeset/honest-queens-pump.md
Normal file
5
.changeset/honest-queens-pump.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"roo-cline": patch
|
||||
---
|
||||
|
||||
Include custom modes in mode switching keyboard shortcut
|
||||
|
|
@ -28,7 +28,7 @@ import TaskHeader from "./TaskHeader"
|
|||
import AutoApproveMenu from "./AutoApproveMenu"
|
||||
import { AudioType } from "../../../../src/shared/WebviewMessage"
|
||||
import { validateCommand } from "../../utils/command-validation"
|
||||
import { modes } from "../../../../src/shared/modes"
|
||||
import { getAllModes } from "../../../../src/shared/modes"
|
||||
|
||||
interface ChatViewProps {
|
||||
isHidden: boolean
|
||||
|
|
@ -60,6 +60,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
|
|||
setMode,
|
||||
autoApprovalEnabled,
|
||||
alwaysAllowModeSwitch,
|
||||
customModes,
|
||||
} = useExtensionState()
|
||||
|
||||
//const task = messages.length > 0 ? (messages[0].say === "task" ? messages[0] : undefined) : undefined) : undefined
|
||||
|
|
@ -967,12 +968,13 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
|
|||
isWriteToolAction,
|
||||
])
|
||||
|
||||
// Add this new function to handle mode switching
|
||||
// Function to handle mode switching
|
||||
const switchToNextMode = useCallback(() => {
|
||||
const currentModeIndex = modes.findIndex((m) => m.slug === mode)
|
||||
const nextModeIndex = (currentModeIndex + 1) % modes.length
|
||||
setMode(modes[nextModeIndex].slug)
|
||||
}, [mode, setMode])
|
||||
const allModes = getAllModes(customModes)
|
||||
const currentModeIndex = allModes.findIndex((m) => m.slug === mode)
|
||||
const nextModeIndex = (currentModeIndex + 1) % allModes.length
|
||||
setMode(allModes[nextModeIndex].slug)
|
||||
}, [mode, setMode, customModes])
|
||||
|
||||
// Add keyboard event handler
|
||||
const handleKeyDown = useCallback(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue