Skip to content

Commit f774c6d

Browse files
committed
fix(gui): improve focus handling in AutoDevVariableList #51
The commit addresses an issue where the focus handling in the AutoDevVariableList component was not properly managed, leading to inconsistent visual feedback for selected cells. The fix ensures that the selected cells are highlighted with the appropriate border, regardless of the focus state, by conditionally setting the border based on the cell's focus and selection status.
1 parent 6f6bdb1 commit f774c6d

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/main/kotlin/cc/unitmesh/devti/gui/chat/AutoDevVariableList.kt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,16 @@ class VariableListCellRenderer : ListCellRenderer<AutoDevVariableListItemCompone
5050
value.foreground = if (isSelected) jList.selectionForeground else jList.foreground
5151
value.isEnabled = jList.isEnabled
5252
value.font = jList.font
53-
54-
var border: Border? = null
55-
if (cellHasFocus) {
53+
value.border = if (cellHasFocus) {
5654
if (isSelected) {
57-
border = UIManager.getBorder("List.focusSelectedCellHighlightBorder")
58-
}
59-
if (border == null) {
60-
border = UIManager.getBorder("List.focusCellHighlightBorder")
55+
UIManager.getBorder("List.focusSelectedCellHighlightBorder")
56+
} else {
57+
UIManager.getBorder("List.focusCellHighlightBorder")
6158
}
6259
} else {
63-
border = this.emptyBorder
60+
emptyBorder
6461
}
6562

66-
value.border = border
6763
return value
6864
}
6965
}

0 commit comments

Comments
 (0)