Skip to content

Commit a0387b9

Browse files
committed
refactor(sketch): expose isUserScrolling and scrollToBottom
- Change visibility of `isUserScrolling` from protected to public. - Change visibility of `scrollToBottom` from private to public. - Update `TerminalSketchProvider` to use `isUserScrolling` and `scrollToBottom`.
1 parent 3e6a744 commit a0387b9

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ open class SketchToolWindow(
8585
this.isOpaque = true
8686
}
8787

88-
protected var isUserScrolling: Boolean = false
88+
var isUserScrolling: Boolean = false
8989
protected var isInterrupted: Boolean = false
9090

9191
protected var systemPromptPanel: JPanel = JPanel(BorderLayout())
@@ -369,7 +369,7 @@ open class SketchToolWindow(
369369
inputSection.send()
370370
}
371371

372-
private fun scrollToBottom() {
372+
fun scrollToBottom() {
373373
if (!isUserScrolling) {
374374
SwingUtilities.invokeLater {
375375
val verticalScrollBar = scrollPanel.verticalScrollBar

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/service/ShellRunService.kt

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class ShellRunService : RunService {
4949

5050
val configuration = configurationSetting.configuration as ShRunConfiguration
5151
configuration.scriptPath = virtualFile.path
52+
configuration.scriptWorkingDirectory = project.basePath!!
5253
return configurationSetting.configuration
5354
}
5455
}

exts/ext-terminal/src/main/kotlin/cc/unitmesh/terminal/sketch/TerminalSketchProvider.kt

+2
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ class TerminalSketchProvider : LanguageSketchProvider {
195195
private fun sendToSketch(project: Project, output: String) {
196196
val contentManager = ToolWindowManager.getInstance(project).getToolWindow("AutoDev")?.contentManager
197197
contentManager?.component?.components?.filterIsInstance<SketchToolWindow>()?.firstOrNull().let {
198+
it?.isUserScrolling = false
199+
it?.scrollToBottom()
198200
it?.sendInput(output)
199201
}
200202
}

0 commit comments

Comments
 (0)