File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Core/Sources/ChatGPTChatTab
Tool/Sources/FocusedCodeFinder Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ struct Chat: ReducerProtocol {
3232 var history : [ ChatMessage ] = [ ]
3333 @BindingState var isReceivingMessage = false
3434 var chatMenu = ChatMenu . State ( )
35- @BindingState var focusedField : Field ? = . textField
35+ @BindingState var focusedField : Field ?
3636
3737 enum Field : String , Hashable {
3838 case textField
@@ -95,6 +95,7 @@ struct Chat: ReducerProtocol {
9595 await send ( . isReceivingMessageChanged)
9696 await send ( . systemPromptChanged)
9797 await send ( . extraSystemPromptChanged)
98+ await send ( . focusOnTextField)
9899 }
99100
100101 case . sendButtonTapped:
Original file line number Diff line number Diff line change @@ -67,14 +67,17 @@ public struct UnknownLanguageFocusedCodeFinder: FocusedCodeFinder {
6767 guard !activeDocumentContext. lines. isEmpty else { return . empty }
6868
6969 // when user is not selecting any code.
70- if containingRange. start == containingRange. end {
70+ if containingRange. start == containingRange. end{
7171 // search up and down for up to `proposedSearchRange * 2 + 1` lines.
7272 let lines = activeDocumentContext. lines
7373 let proposedLineCount = proposedSearchRange * 2 + 1
7474 let startLineIndex = max ( containingRange. start. line - proposedSearchRange, 0 )
75- let endLineIndex = max (
76- startLineIndex,
77- min ( startLineIndex + proposedLineCount - 1 , lines. count - 1 )
75+ let endLineIndex = min (
76+ max (
77+ startLineIndex,
78+ min ( startLineIndex + proposedLineCount - 1 , lines. count - 1 )
79+ ) ,
80+ lines. count - 1
7881 )
7982
8083 let focusedLines = lines [ startLineIndex... endLineIndex]
You can’t perform that action at this time.
0 commit comments