Skip to content

Commit 61fd6a1

Browse files
CopilotMte90
andcommitted
Fix font size and prevent horizontal scrollbar in chat messages
Co-authored-by: Mte90 <403283+Mte90@users.noreply.github.com>
1 parent 43de00a commit 61fd6a1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ide-plugins/src/main/kotlin/com/picocode/PicoCodeToolWindowContent.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ class PicoCodeToolWindowContent(private val project: Project) {
233233
// Convert line breaks (but not inside pre/code tags)
234234
html = html.replace("\n", "<br/>")
235235

236-
return "<html><body style='font-family: sans-serif; font-size: 12px;'>$html</body></html>"
236+
return "<html><body style='font-family: sans-serif; font-size: 11px;'>$html</body></html>"
237237
}
238238

239239
private fun renderChatHistory() {
@@ -261,6 +261,9 @@ class PicoCodeToolWindowContent(private val project: Project) {
261261
editorPane.isEditable = false
262262
editorPane.isOpaque = true
263263

264+
// Set preferred size to prevent excessive growth
265+
editorPane.preferredSize = null
266+
264267
// Use theme-aware background colors
265268
editorPane.background = if (msg.sender == "You")
266269
JBColor.namedColor("EditorPane.inactiveBackground", JBColor(0xE6F0FF, 0x2D3239))
@@ -286,6 +289,10 @@ class PicoCodeToolWindowContent(private val project: Project) {
286289
// Wrap editorPane in a scroll pane for long messages
287290
val messageScrollPane = JBScrollPane(editorPane)
288291
messageScrollPane.border = null
292+
messageScrollPane.horizontalScrollBarPolicy = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER
293+
messageScrollPane.verticalScrollBarPolicy = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED
294+
// Set maximum height to prevent messages from becoming too tall
295+
messageScrollPane.maximumSize = Dimension(Integer.MAX_VALUE, 300)
289296
messagePanel.add(messageScrollPane, BorderLayout.CENTER)
290297

291298
// Add context information if available

0 commit comments

Comments
 (0)