Skip to content

Commit d22f0d3

Browse files
committed
fix(sketch): handle empty and newline inputs in SketchInputListener
- Trim user input once and reuse it for checks and processing. - Add explicit check for newline input to prevent unnecessary processing. - Update compiled input to use trimmed input for consistency.
1 parent 2a46997 commit d22f0d3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/src/main/kotlin/cc/unitmesh/devti/sketch/SketchInputListener.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@ open class SketchInputListener(
5757
open fun getInitPrompt(): String = systemPrompt
5858

5959
override fun manualSend(userInput: String) {
60-
if (userInput.trim().isEmpty() || userInput.trim().isBlank()) return
60+
val input = userInput.trim()
61+
if (input.isEmpty() || input.isBlank()) return
62+
if (input == "\n") return
6163

6264
ApplicationManager.getApplication().invokeLater {
6365
val devInProcessor = LanguageProcessor.devin()
64-
val compiledInput = runReadAction { devInProcessor?.compile(project, userInput) } ?: userInput
66+
val compiledInput = runReadAction { devInProcessor?.compile(project, input) } ?: input
6567

6668
toolWindow.beforeRun()
6769
toolWindow.updateHistoryPanel()

0 commit comments

Comments
 (0)