diff --git a/packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/ui/attachment/AttachmentCard.kt b/packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/ui/attachment/AttachmentCard.kt index f433862985a..a54e683355a 100644 --- a/packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/ui/attachment/AttachmentCard.kt +++ b/packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/ui/attachment/AttachmentCard.kt @@ -65,7 +65,6 @@ class AttachmentChip( init { isOpaque = false - border = JBUI.Borders.empty(0, JBUI.scale(SessionUiStyle.View.Attachment.CHIP_HORIZONTAL_PADDING)) cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) toolTipText = tip accessibleContext?.accessibleName = KiloBundle.message("prompt.attachment.open", item.name) @@ -85,21 +84,6 @@ class AttachmentChip( override fun getMinimumSize(): Dimension = preferredSize - override fun paintComponent(g: Graphics) { - val g2 = g.create() as Graphics2D - try { - g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON) - val arc = JBUI.scale(SessionUiStyle.View.Attachment.CORNER_ARC) - g2.color = SessionUiStyle.View.Surface.bgColor() - g2.fillRoundRect(0, 0, width, height, arc, arc) - g2.color = SessionUiStyle.View.Outline.color() - g2.drawRoundRect(0, 0, width - 1, height - 1, arc, arc) - } finally { - g2.dispose() - } - super.paintComponent(g) - } - private fun label(): String { val start = startLine val end = endLine diff --git a/packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/ui/style/SessionUiStyle.kt b/packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/ui/style/SessionUiStyle.kt index aa8ce97a96f..f610298b9b3 100644 --- a/packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/ui/style/SessionUiStyle.kt +++ b/packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/ui/style/SessionUiStyle.kt @@ -122,7 +122,6 @@ object SessionUiStyle { const val CLOSE_SIZE = 18 const val CORNER_ARC = 8 const val CHIP_HEIGHT = 28 - const val CHIP_HORIZONTAL_PADDING = 8 const val CHIP_ICON_GAP = 6 } diff --git a/packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/views/PromptAttachmentView.kt b/packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/views/PromptAttachmentView.kt index fb15e0e1d22..b828c659dad 100644 --- a/packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/views/PromptAttachmentView.kt +++ b/packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/views/PromptAttachmentView.kt @@ -36,11 +36,12 @@ class PromptAttachmentView( init { isOpaque = false + // Align the attachment chips with the prompt text: same left/right/bottom padding as PromptView. border = JBUI.Borders.empty( 0, - 0, + JBUI.scale(SessionUiStyle.View.Prompt.SHELL_HORIZONTAL_PADDING), JBUI.scale(SessionUiStyle.View.Prompt.SHELL_VERTICAL_PADDING), - 0, + JBUI.scale(SessionUiStyle.View.Prompt.SHELL_HORIZONTAL_PADDING), ) add(scroll) } diff --git a/packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/session/views/PromptAttachmentViewTest.kt b/packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/session/views/PromptAttachmentViewTest.kt new file mode 100644 index 00000000000..9e07af5ddae --- /dev/null +++ b/packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/session/views/PromptAttachmentViewTest.kt @@ -0,0 +1,35 @@ +package ai.kilocode.client.session.views + +import ai.kilocode.client.session.model.Text +import ai.kilocode.client.session.ui.attachment.AttachmentCardItem +import ai.kilocode.client.session.ui.attachment.AttachmentChip +import com.intellij.testFramework.fixtures.BasePlatformTestCase + +class PromptAttachmentViewTest : BasePlatformTestCase() { + // The attachment strip should line up with the prompt text: same left, right, and bottom + // padding as PromptView so the selection reference reads as part of the prompt. + fun `test attachment padding matches prompt text`() { + val prompt = PromptView(Text("p1")).insets + val attach = PromptAttachmentView("m1") {}.insets + + assertEquals(prompt.left, attach.left) + assertEquals(prompt.right, attach.right) + assertEquals(prompt.bottom, attach.bottom) + } + + // With the outline removed, the chip owns no internal padding; alignment comes from the + // container so the chip content sits flush against the prompt-matching insets. + fun `test attachment chip has no outline padding`() { + val chip = AttachmentChip( + AttachmentCardItem("HvJwtFilter.java", "text/plain", "file:///HvJwtFilter.java"), + file = true, + startLine = 40, + endLine = 42, + ).insets + + assertEquals(0, chip.left) + assertEquals(0, chip.right) + assertEquals(0, chip.top) + assertEquals(0, chip.bottom) + } +}