Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions webview-ui/src/components/chat/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
})
const { t } = useAppTranslation()
const { t: tSettings } = useTranslation("settings")
const modeShortcutText = `${isMac ? "⌘" : "Ctrl"} + . ${t("chat:forNextMode")}`
const modeShortcutText = `${isMac ? "⌘" : "Ctrl"} + . ${t("chat:forNextMode")}, ${isMac ? "⌘" : "Ctrl"} + Shift + . ${t("chat:forPreviousMode")}`
const {
clineMessages: messages,
currentTaskItem,
Expand Down Expand Up @@ -1555,16 +1555,33 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
switchToMode(allModes[nextModeIndex].slug)
}, [mode, customModes, switchToMode])

// Function to handle switching to previous mode
const switchToPreviousMode = useCallback(() => {
const allModes = getAllModes(customModes)
const currentModeIndex = allModes.findIndex((m) => m.slug === mode)
const previousModeIndex = (currentModeIndex - 1 + allModes.length) % allModes.length
// Update local state and notify extension to sync mode change
switchToMode(allModes[previousModeIndex].slug)
}, [mode, customModes, switchToMode])

// Add keyboard event handler
const handleKeyDown = useCallback(
(event: KeyboardEvent) => {
// Check for Command + . (period)
if ((event.metaKey || event.ctrlKey) && event.key === ".") {
// Check for Command/Ctrl + Period (with or without Shift)
// Using event.code for better cross-platform compatibility
if ((event.metaKey || event.ctrlKey) && event.code === "Period") {
event.preventDefault() // Prevent default browser behavior
switchToNextMode()

if (event.shiftKey) {
// Shift + Period = Previous mode
switchToPreviousMode()
} else {
// Just Period = Next mode
switchToNextMode()
}
}
},
[switchToNextMode],
[switchToNextMode, switchToPreviousMode],
)

// Add event listener
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/ca/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"separator": "Separador",
"edit": "Edita...",
"forNextMode": "per al següent mode",
"forPreviousMode": "per al mode anterior",
"error": "Error",
"diffError": {
"title": "Edició fallida"
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/de/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"separator": "Trennlinie",
"edit": "Bearbeiten...",
"forNextMode": "für nächsten Modus",
"forPreviousMode": "für vorherigen Modus",
"error": "Fehler",
"diffError": {
"title": "Bearbeitung fehlgeschlagen"
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/en/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
"separator": "Separator",
"edit": "Edit...",
"forNextMode": "for next mode",
"forPreviousMode": "for previous mode",
"apiRequest": {
"title": "API Request",
"failed": "API Request Failed",
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/es/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"separator": "Separador",
"edit": "Editar...",
"forNextMode": "para el siguiente modo",
"forPreviousMode": "para el modo anterior",
"error": "Error",
"diffError": {
"title": "Edición fallida"
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/fr/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"separator": "Séparateur",
"edit": "Éditer...",
"forNextMode": "pour le prochain mode",
"forPreviousMode": "pour le mode précédent",
"error": "Erreur",
"diffError": {
"title": "Modification échouée"
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/hi/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"separator": "विभाजक",
"edit": "संपादित करें...",
"forNextMode": "अगले मोड के लिए",
"forPreviousMode": "पिछले मोड के लिए",
"error": "त्रुटि",
"diffError": {
"title": "संपादन असफल"
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/id/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
"separator": "Pemisah",
"edit": "Edit...",
"forNextMode": "untuk mode selanjutnya",
"forPreviousMode": "untuk mode sebelumnya",
"apiRequest": {
"title": "Permintaan API",
"failed": "Permintaan API Gagal",
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/it/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"separator": "Separatore",
"edit": "Modifica...",
"forNextMode": "per la prossima modalità",
"forPreviousMode": "per la modalità precedente",
"instructions": {
"wantsToFetch": "Roo vuole recuperare istruzioni dettagliate per aiutare con l'attività corrente"
},
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/ja/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"separator": "区切り",
"edit": "編集...",
"forNextMode": "次のモード用",
"forPreviousMode": "前のモード用",
"error": "エラー",
"diffError": {
"title": "編集に失敗しました"
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/ko/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"separator": "구분자",
"edit": "편집...",
"forNextMode": "다음 모드용",
"forPreviousMode": "이전 모드용",
"error": "오류",
"diffError": {
"title": "편집 실패"
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/nl/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"separator": "Scheidingsteken",
"edit": "Bewerken...",
"forNextMode": "voor volgende modus",
"forPreviousMode": "voor vorige modus",
"apiRequest": {
"title": "API-verzoek",
"failed": "API-verzoek mislukt",
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/pl/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"separator": "Separator",
"edit": "Edytuj...",
"forNextMode": "dla następnego trybu",
"forPreviousMode": "dla poprzedniego trybu",
"error": "Błąd",
"diffError": {
"title": "Edycja nieudana"
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/pt-BR/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"separator": "Separador",
"edit": "Editar...",
"forNextMode": "para o próximo modo",
"forPreviousMode": "para o modo anterior",
"error": "Erro",
"diffError": {
"title": "Edição mal-sucedida"
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/ru/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"separator": "Разделитель",
"edit": "Редактировать...",
"forNextMode": "для следующего режима",
"forPreviousMode": "для предыдущего режима",
"apiRequest": {
"title": "API-запрос",
"failed": "API-запрос не выполнен",
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/tr/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"separator": "Ayırıcı",
"edit": "Düzenle...",
"forNextMode": "sonraki mod için",
"forPreviousMode": "önceki mod için",
"error": "Hata",
"diffError": {
"title": "Düzenleme Başarısız"
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/vi/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"separator": "Dấu phân cách",
"edit": "Chỉnh sửa...",
"forNextMode": "cho chế độ tiếp theo",
"forPreviousMode": "cho chế độ trước đó",
"error": "Lỗi",
"diffError": {
"title": "Chỉnh sửa không thành công"
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/zh-CN/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"separator": "分隔符",
"edit": "编辑...",
"forNextMode": "用于下一个模式",
"forPreviousMode": "用于上一个模式",
"error": "错误",
"diffError": {
"title": "编辑失败"
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/zh-TW/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"separator": "分隔符號",
"edit": "編輯...",
"forNextMode": "用於下一個模式",
"forPreviousMode": "用於上一個模式",
"error": "錯誤",
"diffError": {
"title": "編輯失敗"
Expand Down
Loading