Skip to content

Commit b0e756f

Browse files
committed
fix(ui): set preferred size for buttons in SingleFileDiffView
- Set preferred size for all buttons to 32x32 pixels for consistent UI. - Simplify response handling in DiffStreamHandler by removing unnecessary CodeFence parsing.
1 parent e0ddf1d commit b0e756f

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

core/src/main/kotlin/cc/unitmesh/devti/diff/DiffStreamHandler.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ class DiffStreamHandler(
154154
}
155155
}
156156

157-
handleFinishedResponse(suggestion.toString())
157+
val code = CodeFence.parse(suggestion.toString())
158+
handleFinishedResponse(code.text)
158159
}
159160
}
160161

core/src/main/kotlin/cc/unitmesh/devti/sketch/ui/patch/SingleFileDiffView.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ class SingleFileDiffView(
154154
val rollback = JButton("Rollback").apply {
155155
icon = AllIcons.Actions.Rollback
156156
border = BorderFactory.createEmptyBorder()
157-
preferredSize = Dimension(32, 32)
158157
toolTipText = AutoDevBundle.message("sketch.patch.action.rollback.tooltip")
159158
isEnabled = undoManager.isUndoAvailable(fileEditor)
160159

@@ -170,7 +169,6 @@ class SingleFileDiffView(
170169
val viewDiffButton = JButton("View").apply {
171170
icon = AllIcons.Actions.ListChanges
172171
border = BorderFactory.createEmptyBorder()
173-
preferredSize = Dimension(32, 32)
174172
toolTipText = AutoDevBundle.message("sketch.patch.action.viewDiff.tooltip")
175173

176174
addMouseListener(object : MouseAdapter() {
@@ -182,7 +180,6 @@ class SingleFileDiffView(
182180

183181
val runStreamButton = JButton("Apply").apply {
184182
icon = AllIcons.Actions.RunAll
185-
preferredSize = Dimension(32, 32)
186183
border = BorderFactory.createEmptyBorder()
187184
toolTipText = AutoDevBundle.message("sketch.patch.action.runDiff.tooltip")
188185
isEnabled = appliedPatch?.status == ApplyPatchStatus.SUCCESS
@@ -208,7 +205,6 @@ class SingleFileDiffView(
208205

209206
val repairButton = JButton("Repair").apply {
210207
icon = AllIcons.Toolwindows.ToolWindowBuild
211-
preferredSize = Dimension(32, 32)
212208
border = BorderFactory.createEmptyBorder()
213209
toolTipText = AutoDevBundle.message("sketch.patch.action.repairDiff.tooltip")
214210
isEnabled = appliedPatch?.status != ApplyPatchStatus.SUCCESS

0 commit comments

Comments
 (0)