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
40 changes: 7 additions & 33 deletions Cotabby/UI/Settings/Panes/GeneralPaneView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ struct GeneralPaneView: View {
}
}

Section("Behavior") {
// Split from the old catch-all "Behavior" group: what the model is allowed to read
// (Context) reads differently from what a suggestion may contain (Suggestions). The
// acceptance toggles that used to live here now sit with Writing, next to the other
// controls that shape inserted text.
Section("Context") {
Toggle(isOn: clipboardContextEnabledBinding) {
SettingsRowLabel(
title: "Include Clipboard Context",
Expand All @@ -61,7 +65,9 @@ struct GeneralPaneView: View {
systemImage: "macwindow"
)
}
}

Section("Suggestions") {
Toggle(isOn: multiLineEnabledBinding) {
SettingsRowLabel(
title: "Allow Multi-line Suggestions",
Expand All @@ -70,24 +76,6 @@ struct GeneralPaneView: View {
)
}

Toggle(isOn: autoAcceptTrailingPunctuationBinding) {
SettingsRowLabel(
title: "Accept Punctuation With Word",
description: "When you accept a word, also accept the punctuation that follows it " +
"(commas, periods) so you don't have to type it.",
systemImage: "textformat.abc"
)
}

Toggle(isOn: addSpaceAfterAcceptBinding) {
SettingsRowLabel(
title: "Add Space After Accepting",
description: "When accepting a suggestion finishes a word, also add a space so you can " +
"keep typing. Skipped when it already ends in punctuation or a space.",
systemImage: "space"
)
}

Toggle(isOn: macroExpansionEnabledBinding) {
SettingsRowLabel(
title: "Inline Macros",
Expand Down Expand Up @@ -199,20 +187,6 @@ struct GeneralPaneView: View {
)
}

private var autoAcceptTrailingPunctuationBinding: Binding<Bool> {
Binding(
get: { suggestionSettings.autoAcceptTrailingPunctuation },
set: { suggestionSettings.setAutoAcceptTrailingPunctuation($0) }
)
}

private var addSpaceAfterAcceptBinding: Binding<Bool> {
Binding(
get: { suggestionSettings.addSpaceAfterAccept },
set: { suggestionSettings.setAddSpaceAfterAccept($0) }
)
}

private var macroExpansionEnabledBinding: Binding<Bool> {
Binding(
get: { suggestionSettings.isMacroExpansionEnabled },
Expand Down
36 changes: 36 additions & 0 deletions Cotabby/UI/Settings/Panes/WritingPaneView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,28 @@ struct WritingPaneView: View {
}
}

// What an accept inserts beyond the bare word. These shape the written output, so they sit
// with Writing rather than General; the accept keys themselves live in the Shortcuts pane.
Section("Acceptance") {
Toggle(isOn: autoAcceptTrailingPunctuationBinding) {
SettingsRowLabel(
title: "Accept Punctuation With Word",
description: "When you accept a word, also accept the punctuation that follows it " +
"(commas, periods) so you don't have to type it.",
systemImage: "textformat.abc"
)
}

Toggle(isOn: addSpaceAfterAcceptBinding) {
SettingsRowLabel(
title: "Add Space After Accepting",
description: "When accepting a suggestion finishes a word, also add a space so you can " +
"keep typing. Skipped when it already ends in punctuation or a space.",
systemImage: "space"
)
}
}

Section("Corrections") {
Toggle(isOn: suppressCompletionsOnTypoBinding) {
SettingsRowLabel(
Expand Down Expand Up @@ -128,6 +150,20 @@ struct WritingPaneView: View {
)
}

private var autoAcceptTrailingPunctuationBinding: Binding<Bool> {
Binding(
get: { suggestionSettings.autoAcceptTrailingPunctuation },
set: { suggestionSettings.setAutoAcceptTrailingPunctuation($0) }
)
}

private var addSpaceAfterAcceptBinding: Binding<Bool> {
Binding(
get: { suggestionSettings.addSpaceAfterAccept },
set: { suggestionSettings.setAddSpaceAfterAccept($0) }
)
}

private var suppressCompletionsOnTypoBinding: Binding<Bool> {
Binding(
get: { suggestionSettings.suppressCompletionsOnTypo },
Expand Down
8 changes: 4 additions & 4 deletions Cotabby/UI/Settings/SettingsIndex.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ enum SettingsItem: String, CaseIterable, Identifiable {
case includeClipboardContext
case includeAppContext
case allowMultiLine
case acceptPunctuation
case addSpaceAfterAccept
case inlineMacros
case onboarding
// Appearance
Expand All @@ -36,6 +34,8 @@ enum SettingsItem: String, CaseIterable, Identifiable {
case emojiHistory
// Writing
case length
case acceptPunctuation
case addSpaceAfterAccept
case name
case languages
case customRules
Expand Down Expand Up @@ -222,14 +222,14 @@ enum SettingsItem: String, CaseIterable, Identifiable {
var category: SettingsCategory {
switch self {
case .enableGlobally, .fastMode, .openAtLogin, .includeClipboardContext, .includeAppContext,
.allowMultiLine, .acceptPunctuation, .addSpaceAfterAccept, .inlineMacros, .onboarding:
.allowMultiLine, .inlineMacros, .onboarding:
return .general
case .suggestionDisplay, .streamWhileGenerating, .showFieldIndicator, .showWordCount, .showKeyHint,
.ghostTextColor, .ghostTextOpacity, .ghostTextSize:
return .appearance
case .emojiPicker, .emojiSkinTone, .emojiPeopleStyle, .emojiHistory:
return .emoji
case .length, .name, .languages, .customRules,
case .length, .acceptPunctuation, .addSpaceAfterAccept, .name, .languages, .customRules,
.hideSuggestionsOnTypo, .offerTypoCorrections, .spellingDictionaries, .automaticallyFixTypos:
return .writing
case .extendedContext, .contextLivePreview:
Expand Down