feat(app): add web input focus shortcut (#12493)

This commit is contained in:
ChangeHow
2026-02-08 03:35:46 +08:00
committed by GitHub
parent 0e1f543646
commit 805207e096
20 changed files with 28 additions and 2 deletions

View File

@@ -1,6 +1,5 @@
{
"lockfileVersion": 1,
"configVersion": 1,
"workspaces": {
"": {
"name": "opencode",

View File

@@ -46,6 +46,7 @@ export const dict = {
"command.file.open": "فتح ملف",
"command.context.addSelection": "إضافة التحديد إلى السياق",
"command.context.addSelection.description": "إضافة الأسطر المحددة من الملف الحالي",
"command.input.focus": "التركيز على حقل الإدخال",
"command.terminal.toggle": "تبديل المحطة الطرفية",
"command.fileTree.toggle": "تبديل شجرة الملفات",
"command.review.toggle": "تبديل المراجعة",

View File

@@ -46,6 +46,7 @@ export const dict = {
"command.file.open": "Abrir arquivo",
"command.context.addSelection": "Adicionar seleção ao contexto",
"command.context.addSelection.description": "Adicionar as linhas selecionadas do arquivo atual",
"command.input.focus": "Focar entrada",
"command.terminal.toggle": "Alternar terminal",
"command.fileTree.toggle": "Alternar árvore de arquivos",
"command.review.toggle": "Alternar revisão",

View File

@@ -47,6 +47,7 @@ export const dict = {
"command.tab.close": "Zatvori karticu",
"command.context.addSelection": "Dodaj odabir u kontekst",
"command.context.addSelection.description": "Dodaj odabrane linije iz trenutne datoteke",
"command.input.focus": "Fokusiraj polje za unos",
"command.terminal.toggle": "Prikaži/sakrij terminal",
"command.fileTree.toggle": "Prikaži/sakrij stablo datoteka",
"command.review.toggle": "Prikaži/sakrij pregled",

View File

@@ -46,6 +46,7 @@ export const dict = {
"command.file.open": "Åbn fil",
"command.context.addSelection": "Tilføj markering til kontekst",
"command.context.addSelection.description": "Tilføj markerede linjer fra den aktuelle fil",
"command.input.focus": "Fokuser inputfelt",
"command.terminal.toggle": "Skift terminal",
"command.fileTree.toggle": "Skift filtræ",
"command.review.toggle": "Skift gennemgang",

View File

@@ -50,6 +50,7 @@ export const dict = {
"command.file.open": "Datei öffnen",
"command.context.addSelection": "Auswahl zum Kontext hinzufügen",
"command.context.addSelection.description": "Ausgewählte Zeilen aus der aktuellen Datei hinzufügen",
"command.input.focus": "Eingabefeld fokussieren",
"command.terminal.toggle": "Terminal umschalten",
"command.fileTree.toggle": "Dateibaum umschalten",
"command.review.toggle": "Überprüfung umschalten",

View File

@@ -47,6 +47,7 @@ export const dict = {
"command.tab.close": "Close tab",
"command.context.addSelection": "Add selection to context",
"command.context.addSelection.description": "Add selected lines from the current file",
"command.input.focus": "Focus input",
"command.terminal.toggle": "Toggle terminal",
"command.fileTree.toggle": "Toggle file tree",
"command.review.toggle": "Toggle review",

View File

@@ -46,6 +46,7 @@ export const dict = {
"command.file.open": "Abrir archivo",
"command.context.addSelection": "Añadir selección al contexto",
"command.context.addSelection.description": "Añadir las líneas seleccionadas del archivo actual",
"command.input.focus": "Enfocar entrada",
"command.terminal.toggle": "Alternar terminal",
"command.fileTree.toggle": "Alternar árbol de archivos",
"command.review.toggle": "Alternar revisión",

View File

@@ -46,6 +46,7 @@ export const dict = {
"command.file.open": "Ouvrir un fichier",
"command.context.addSelection": "Ajouter la sélection au contexte",
"command.context.addSelection.description": "Ajouter les lignes sélectionnées du fichier actuel",
"command.input.focus": "Focus input",
"command.terminal.toggle": "Basculer le terminal",
"command.fileTree.toggle": "Basculer l'arborescence des fichiers",
"command.review.toggle": "Basculer la revue",

View File

@@ -46,6 +46,7 @@ export const dict = {
"command.file.open": "ファイルを開く",
"command.context.addSelection": "選択範囲をコンテキストに追加",
"command.context.addSelection.description": "現在のファイルから選択した行を追加",
"command.input.focus": "入力欄にフォーカス",
"command.terminal.toggle": "ターミナルの切り替え",
"command.fileTree.toggle": "ファイルツリーを切り替え",
"command.review.toggle": "レビューの切り替え",

View File

@@ -50,6 +50,7 @@ export const dict = {
"command.file.open": "파일 열기",
"command.context.addSelection": "선택 영역을 컨텍스트에 추가",
"command.context.addSelection.description": "현재 파일에서 선택한 줄을 추가",
"command.input.focus": "입력창 포커스",
"command.terminal.toggle": "터미널 토글",
"command.fileTree.toggle": "파일 트리 토글",
"command.review.toggle": "검토 토글",

View File

@@ -49,6 +49,7 @@ export const dict = {
"command.file.open": "Åpne fil",
"command.context.addSelection": "Legg til markering i kontekst",
"command.context.addSelection.description": "Legg til valgte linjer fra gjeldende fil",
"command.input.focus": "Fokuser inndata",
"command.terminal.toggle": "Veksle terminal",
"command.fileTree.toggle": "Veksle filtre",
"command.review.toggle": "Veksle gjennomgang",

View File

@@ -46,6 +46,7 @@ export const dict = {
"command.file.open": "Otwórz plik",
"command.context.addSelection": "Dodaj zaznaczenie do kontekstu",
"command.context.addSelection.description": "Dodaj zaznaczone linie z bieżącego pliku",
"command.input.focus": "Fokus na pole wejściowe",
"command.terminal.toggle": "Przełącz terminal",
"command.fileTree.toggle": "Przełącz drzewo plików",
"command.review.toggle": "Przełącz przegląd",

View File

@@ -46,6 +46,7 @@ export const dict = {
"command.file.open": "Открыть файл",
"command.context.addSelection": "Добавить выделение в контекст",
"command.context.addSelection.description": "Добавить выбранные строки из текущего файла",
"command.input.focus": "Фокус на поле ввода",
"command.terminal.toggle": "Переключить терминал",
"command.fileTree.toggle": "Переключить дерево файлов",
"command.review.toggle": "Переключить обзор",

View File

@@ -46,6 +46,7 @@ export const dict = {
"command.file.open": "เปิดไฟล์",
"command.context.addSelection": "เพิ่มส่วนที่เลือกไปยังบริบท",
"command.context.addSelection.description": "เพิ่มบรรทัดที่เลือกจากไฟล์ปัจจุบัน",
"command.input.focus": "โฟกัสช่องป้อนข้อมูล",
"command.terminal.toggle": "สลับเทอร์มินัล",
"command.fileTree.toggle": "สลับต้นไม้ไฟล์",
"command.review.toggle": "สลับการตรวจสอบ",

View File

@@ -50,6 +50,7 @@ export const dict = {
"command.file.open": "打开文件",
"command.context.addSelection": "将所选内容添加到上下文",
"command.context.addSelection.description": "添加当前文件中选中的行",
"command.input.focus": "聚焦输入框",
"command.terminal.toggle": "切换终端",
"command.fileTree.toggle": "切换文件树",
"command.review.toggle": "切换审查",

View File

@@ -50,6 +50,7 @@ export const dict = {
"command.file.open": "開啟檔案",
"command.context.addSelection": "將選取內容加入上下文",
"command.context.addSelection.description": "加入目前檔案中選取的行",
"command.input.focus": "聚焦輸入框",
"command.terminal.toggle": "切換終端機",
"command.fileTree.toggle": "切換檔案樹",
"command.review.toggle": "切換審查",

View File

@@ -917,6 +917,8 @@ export default function Page() {
setFileTreeTab("all")
}
const focusInput = () => inputRef?.focus()
useSessionCommands({
command,
dialog,
@@ -943,6 +945,7 @@ export default function Page() {
setExpanded: (id, fn) => setStore("expanded", id, fn),
setActiveMessage,
addSelectionToContext,
focusInput,
})
const openReviewFile = createOpenReviewFile({

View File

@@ -48,6 +48,7 @@ export const useSessionCommands = (input: {
setExpanded: (id: string, fn: (open: boolean | undefined) => boolean) => void
setActiveMessage: (message: UserMessage | undefined) => void
addSelectionToContext: (path: string, selection: FileSelection) => void
focusInput: () => void
}) => {
const sessionCommands = createMemo(() => [
{
@@ -142,6 +143,13 @@ export const useSessionCommands = (input: {
keybind: "mod+\\",
onSelect: () => input.layout.fileTree.toggle(),
},
{
id: "input.focus",
title: input.language.t("command.input.focus"),
category: input.language.t("command.category.view"),
keybind: "ctrl+l",
onSelect: () => input.focusInput(),
},
{
id: "terminal.new",
title: input.language.t("command.terminal.new"),

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bun
import solidPlugin from "../node_modules/@opentui/solid/scripts/solid-plugin"
import solidPlugin from "../../../node_modules/@opentui/solid/scripts/solid-plugin"
import path from "path"
import fs from "fs"
import { $ } from "bun"