native macOS codings agent orchestrator
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

Polish custom command popovers and selection behavior

onevcat 005e5ccf 43c86c69

+45 -11
+39 -11
supacode/Features/Settings/Views/RepositorySettingsView.swift
··· 175 175 if store.settings.setupScript.isEmpty { 176 176 Text("claude --dangerously-skip-permissions") 177 177 .foregroundStyle(.secondary) 178 - .padding(.leading, 6) 178 + .padding(.leading, plainTextPlaceholderLeading) 179 + .padding(.top, plainTextPlaceholderTop) 179 180 .font(.body) 180 181 .allowsHitTesting(false) 181 182 } ··· 199 200 if store.settings.archiveScript.isEmpty { 200 201 Text("docker compose down") 201 202 .foregroundStyle(.secondary) 202 - .padding(.leading, 6) 203 + .padding(.leading, plainTextPlaceholderLeading) 204 + .padding(.top, plainTextPlaceholderTop) 203 205 .font(.body) 204 206 .allowsHitTesting(false) 205 207 } ··· 223 225 if store.settings.runScript.isEmpty { 224 226 Text("npm run dev") 225 227 .foregroundStyle(.secondary) 226 - .padding(.leading, 6) 228 + .padding(.leading, plainTextPlaceholderLeading) 229 + .padding(.top, plainTextPlaceholderTop) 227 230 .font(.body) 228 231 .allowsHitTesting(false) 229 232 } ··· 667 670 668 671 ScrollView { 669 672 LazyVGrid( 670 - columns: Array(repeating: GridItem(.fixed(24), spacing: 12), count: 8), 671 - spacing: 12 673 + columns: Array(repeating: GridItem(.fixed(24), spacing: 8), count: 10), 674 + spacing: 8 672 675 ) { 673 676 ForEach(Self.symbolPresets, id: \.self) { symbol in 674 677 Button { ··· 710 713 ZStack(alignment: .topLeading) { 711 714 PlainTextEditor( 712 715 text: command.command, 713 - isMonospaced: true 716 + isMonospaced: true, 717 + shouldFocus: true 714 718 ) 715 719 .frame(height: 140) 716 720 717 721 if command.wrappedValue.command.isEmpty { 718 722 Text(scriptPlaceholder(for: command.wrappedValue.execution)) 719 723 .foregroundStyle(.secondary) 720 - .padding(.leading, 6) 724 + .padding(.leading, plainTextPlaceholderLeading) 725 + .padding(.top, plainTextPlaceholderTop) 721 726 .font(.body.monospaced()) 722 727 .allowsHitTesting(false) 723 728 } ··· 977 982 978 983 let commandsBinding = $store.userSettings.customCommands 979 984 var commands = commandsBinding.wrappedValue 980 - if let removalIndex = commands.firstIndex(where: { $0.id == selectedCommandID }) { 981 - commands.remove(at: removalIndex) 985 + let removalIndex: Int? 986 + if let index = commands.firstIndex(where: { $0.id == selectedCommandID }) { 987 + removalIndex = index 988 + commands.remove(at: index) 982 989 } else if !commands.isEmpty { 990 + removalIndex = commands.count - 1 983 991 commands.removeLast() 984 992 } else { 993 + removalIndex = nil 994 + } 995 + 996 + guard let removalIndex else { 985 997 return 986 998 } 999 + 987 1000 let normalizedCommands = UserRepositorySettings.normalizedCommands(commands) 988 1001 commandsBinding.wrappedValue = normalizedCommands 989 - syncSelectedCommandID(with: commandsBinding.wrappedValue) 990 - clearRemovedCommandState(using: commandsBinding.wrappedValue) 1002 + 1003 + if normalizedCommands.isEmpty { 1004 + selectedCustomCommandID = nil 1005 + } else if removalIndex < normalizedCommands.count { 1006 + selectedCustomCommandID = normalizedCommands[removalIndex].id 1007 + } else { 1008 + selectedCustomCommandID = normalizedCommands[normalizedCommands.count - 1].id 1009 + } 1010 + clearRemovedCommandState(using: normalizedCommands) 1011 + } 1012 + 1013 + private var plainTextPlaceholderLeading: CGFloat { 1014 + 4 1015 + } 1016 + 1017 + private var plainTextPlaceholderTop: CGFloat { 1018 + -2 991 1019 } 992 1020 993 1021 private func clearShortcut(for commandID: UserCustomCommand.ID) {
+6
supacode/Support/PlainTextEditor.swift
··· 4 4 struct PlainTextEditor: NSViewRepresentable { 5 5 @Binding var text: String 6 6 var isMonospaced: Bool = false 7 + var shouldFocus: Bool = false 7 8 8 9 func makeCoordinator() -> Coordinator { 9 10 Coordinator(text: $text) ··· 47 48 let updatedFont = editorFont 48 49 if textView.font != updatedFont { 49 50 textView.font = updatedFont 51 + } 52 + if shouldFocus, 53 + textView.window?.firstResponder !== textView 54 + { 55 + textView.window?.makeFirstResponder(textView) 50 56 } 51 57 } 52 58