bugfix(jb): UI bugs with inline edit

This commit is contained in:
Test 2024-10-29 16:39:41 -07:00
parent c5003e7f7a
commit 31c562117d
5 changed files with 37 additions and 49 deletions

1
.idea/gradle.xml generated
View file

@ -5,7 +5,6 @@
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$/extensions/intellij" />
<option name="gradleJvm" value="17" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$/extensions/intellij" />

View file

@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Continue" type="CompoundRunConfigurationType">
<toRun name="Run Extension" type="GradleRunConfiguration" />
<toRun name="Start Core Dev Server" type="NodeJSConfigurationType" />
<toRun name="Prompt Logs" type="ShConfigurationType" />
<toRun name="Start Core Dev Server" type="Unknown" />
<toRun name="Start GUI Dev Server" type="ShConfigurationType" />
<method v="2" />
</configuration>

View file

@ -1,15 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Start Dev Server (gui)" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/gui/package.json" />
<command value="run" />
<scripts>
<script value="dev" />
</scripts>
<node-interpreter value="project" />
<envs />
<EXTENSION ID="com.intellij.lang.javascript.buildTools.npm.rc.StartBrowserRunConfigurationExtension">
<browser start="true" with-js-debugger="true" url="http://localhost:5173/jetbrains_index.html" />
</EXTENSION>
<method v="2" />
</configuration>
</component>

View file

@ -48,7 +48,7 @@ fun makeTextArea(): JTextArea {
isOpaque = false
background = GetTheme().getSecondaryDark()
maximumSize = Dimension(400, Short.MAX_VALUE.toInt())
margin = JBUI.insets(6, 4, 6, 4)
margin = JBUI.insets(6, 8, 6, 4)
font = UIUtil.getFontWithFallback("Arial", Font.PLAIN, MAIN_FONT_SIZE)
preferredSize = Dimension(400, 75)
}
@ -398,13 +398,32 @@ class CustomPanel(
isEditable = true
background = defaultBackground
foreground = Color(128, 128, 128, 200)
font = UIUtil.getFontWithFallback("Arial", Font.PLAIN, 11)
border = EmptyBorder(2, 4, 2, 4)
font = UIUtil.getFontWithFallback("Arial", Font.PLAIN, 12)
border = EmptyBorder(8, 8, 8, 8)
isOpaque = false
isEditable = false
cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)
renderer =
DefaultListCellRenderer().apply { horizontalAlignment = SwingConstants.LEFT }
preferredSize = Dimension(200, 30)
renderer = object : DefaultListCellRenderer() {
override fun getListCellRendererComponent(
list: JList<*>?,
value: Any?,
index: Int,
isSelected: Boolean,
cellHasFocus: Boolean
): Component {
val component =
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus)
if (component is JLabel) {
component.border = EmptyBorder(4, 6, 4, 6)
}
return component
}
}.apply {
horizontalAlignment = SwingConstants.LEFT
}
selectedIndex =
continueSettingsService.continueState.lastSelectedInlineEditModel?.let {
if (modelTitles.isEmpty()) -1
@ -430,19 +449,16 @@ class CustomPanel(
border = EmptyBorder(2, 6, 2, 6)
}
val rightPanel =
JPanel(MigLayout("insets 0, fillx")).apply {
isOpaque = false
border = EmptyBorder(0, 0, 0, 0)
add(dropdown, "align right")
add(rightButton, "align right")
}
val rightPanel = JPanel(MigLayout("insets 0, fillx")).apply {
isOpaque = false
add(rightButton, "align right")
}
border = EmptyBorder(0, 0, 16, 12)
isOpaque = false
add(dropdown, "align left")
add(rightPanel, "align right, split 2")
isOpaque = false
add(rightPanel, "align right")
cursor = Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)
}
@ -620,18 +636,7 @@ class CustomButton(text: String, onClick: () -> Unit) : JLabel(text, CENTER) {
cornerRadius.toFloat(),
cornerRadius.toFloat()
)
if (isHovered) {
val brightenFactor = 1.1f
val brighterColor =
Color(
(background.red * brightenFactor).coerceIn(0f, 255f).toInt(),
(background.green * brightenFactor).coerceIn(0f, 255f).toInt(),
(background.blue * brightenFactor).coerceIn(0f, 255f).toInt()
)
g2.color = brighterColor
} else {
g2.color = background
}
g2.color = background
g2.fill(roundRect)
g2.color = foreground
g2.drawString(
@ -653,7 +658,7 @@ class CustomTextArea(rows: Int, columns: Int) : JXTextArea("") {
if (text.isEmpty()) {
g.color = Color(128, 128, 128, 255)
g.font = UIUtil.getFontWithFallback("Arial", Font.PLAIN, MAIN_FONT_SIZE)
g.drawString("Enter instructions...", 3, 20)
g.drawString("Enter instructions...", 8, 20)
}
super.paintComponent(g)

View file

@ -116,7 +116,7 @@ class VerticalDiffBlock(
)
acceptButton.setBounds(
x + rejectButton.width + 5,
x + rejectButton.width + 2,
y,
acceptButton.preferredSize.width,
acceptButton.preferredSize.height
@ -220,13 +220,12 @@ class VerticalDiffBlock(
g2.dispose()
}
}.apply {
// This isn't working currently, font color is transparent
foreground = JBColor.WHITE
foreground = Color(240, 240, 240)
font = Font("Arial", Font.BOLD, 9)
isContentAreaFilled = false
isOpaque = false
border = null
preferredSize = Dimension(preferredSize.width, 16)
border = BorderFactory.createEmptyBorder(4, 2, 4, 2)
preferredSize = Dimension(preferredSize.width - 30, 16)
cursor = Cursor(Cursor.HAND_CURSOR)
}
}