Skip to content

Commit 5b4dea6

Browse files
committed
fix(sketch): Add text selection to SketchToolWindow
1 parent 8bdb546 commit 5b4dea6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ class SketchToolWindow(val project: Project, val editor: Editor?, private val sh
7878

7979
addMouseListener(object : MouseAdapter() {
8080
override fun mouseClicked(e: MouseEvent?) {
81-
val selection = StringSelection(myText)
81+
var allText = historyPanel.components.filterIsInstance<LangSketch>().joinToString("\n") { it.getViewText() }
82+
allText += myList.components.filterIsInstance<LangSketch>().joinToString("\n") { it.getViewText() }
83+
84+
val selection = StringSelection(allText)
8285
val clipboard = Toolkit.getDefaultToolkit().systemClipboard
8386
clipboard.setContents(selection, null)
8487
}
@@ -159,6 +162,7 @@ class SketchToolWindow(val project: Project, val editor: Editor?, private val sh
159162
isInterrupted = false
160163
inputSection.showStopButton()
161164
}
165+
162166
override fun onAfter() {
163167
inputSection.showSendButton()
164168
}
@@ -191,6 +195,7 @@ class SketchToolWindow(val project: Project, val editor: Editor?, private val sh
191195
fun beforeRun() {
192196
processListeners.forEach { it.onBefore() }
193197
}
198+
194199
fun AfterRun() {
195200
processListeners.forEach { it.onAfter() }
196201
}

0 commit comments

Comments
 (0)