Add trailing space setting for CJK languages

This commit is contained in:
Beingpax 2025-09-01 14:34:28 +05:45
parent 6ff9ea8eda
commit 4c940749ab
2 changed files with 17 additions and 2 deletions

View File

@ -5,6 +5,7 @@ struct ModelSettingsView: View {
@AppStorage("SelectedLanguage") private var selectedLanguage: String = "en"
@AppStorage("IsTextFormattingEnabled") private var isTextFormattingEnabled = true
@AppStorage("IsVADEnabled") private var isVADEnabled = true
@AppStorage("AppendTrailingSpace") private var appendTrailingSpace = true
@State private var customPrompt: String = ""
@State private var isEditing: Bool = false
@ -66,6 +67,18 @@ struct ModelSettingsView: View {
Divider().padding(.vertical, 4)
HStack {
Toggle(isOn: $appendTrailingSpace) {
Text("Add space after paste")
}
.toggleStyle(.switch)
InfoTip(
title: "Trailing Space",
message: "Automatically add a space after pasted text. Useful for space-delimited languages."
)
}
HStack {
Toggle(isOn: $isTextFormattingEnabled) {
Text("Automatic text formatting")

View File

@ -355,12 +355,14 @@ class WhisperState: NSObject, ObservableObject {
"""
}
text += " "
let shouldAddSpace = UserDefaults.standard.object(forKey: "AppendTrailingSpace") as? Bool ?? true
if shouldAddSpace {
text += " "
}
if await checkCancellationAndCleanup() { return }
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
CursorPaster.pasteAtCursor(text)
let powerMode = PowerModeManager.shared