Skip to content

Commit

Permalink
refactor(ui): set preferred size directly with Dimension
Browse files Browse the repository at this point in the history
Replace minimum width scaling with direct Dimension usage for preferred size in QuickPromptField. This simplifies the size handling and ensures consistent height.
  • Loading branch information
phodal committed Mar 10, 2025
1 parent 5d73d34 commit 7e5edb2
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package cc.unitmesh.devti.gui.quick

import com.intellij.ide.KeyboardAwareFocusOwner
import com.intellij.ui.scale.JBUIScale
import com.intellij.ui.util.minimumWidth
import java.awt.Dimension
import java.awt.event.KeyEvent
import javax.swing.JTextField
import javax.swing.KeyStroke
Expand All @@ -11,8 +10,7 @@ class QuickPromptField : JTextField(), KeyboardAwareFocusOwner {
override fun skipKeyEventDispatcher(event: KeyEvent): Boolean = true

init {
this.minimumWidth = JBUIScale.scale(480)
this.preferredSize = this.minimumSize
this.preferredSize = Dimension(480, minimumSize.height)

inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), QUICK_ASSISTANT_CANCEL_ACTION)
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), QUICK_ASSISTANT_SUBMIT_ACTION)
Expand Down

0 comments on commit 7e5edb2

Please sign in to comment.