Skip to content

Commit

Permalink
Fix Markdown link focus (#608)
Browse files Browse the repository at this point in the history
In #598, for some reason a drawStyle = Stroke(2f) was added to the
bridge focused link style, causing rendering of focused links to look
weird in the bridge. This fixes the issue, and also makes sure the
pressed links are also underlined, matching Swing's behaviour.
  • Loading branch information
rock3r committed Sep 24, 2024
1 parent bc886e6 commit 3ff115b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.ui.graphics.PathEffect
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextStyle
Expand Down Expand Up @@ -349,7 +348,6 @@ public fun InlinesStyling.Companion.create(
),
linkFocused: SpanStyle =
link.copy(
drawStyle = Stroke(width = 2f),
color = JBUI.CurrentTheme.Link.Foreground.ENABLED.toComposeColor(),
background = JBUI.CurrentTheme.ActionButton.hoverBackground().toComposeColor(),
textDecoration = TextDecoration.Underline,
Expand All @@ -358,6 +356,7 @@ public fun InlinesStyling.Companion.create(
link.copy(
color = JBUI.CurrentTheme.Link.Foreground.PRESSED.toComposeColor(),
background = JBUI.CurrentTheme.ActionButton.pressedBackground().toComposeColor(),
textDecoration = TextDecoration.Underline,
),
linkVisited: SpanStyle = link.copy(color = JBUI.CurrentTheme.Link.Foreground.VISITED.toComposeColor()),
emphasis: SpanStyle = textStyle.copy(fontStyle = FontStyle.Italic).toSpanStyle(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ public fun InlinesStyling.Companion.light(
linkDisabled: SpanStyle = link.copy(color = IntUiLightTheme.colors.gray(8)),
linkHovered: SpanStyle = link.copy(textDecoration = TextDecoration.Underline),
linkFocused: SpanStyle = link.copy(background = Color(0x12000000), textDecoration = TextDecoration.Underline),
linkPressed: SpanStyle = link.copy(background = Color(0x1D000000)),
linkPressed: SpanStyle = link.copy(background = Color(0x1D000000), textDecoration = TextDecoration.Underline),
linkVisited: SpanStyle = link,
emphasis: SpanStyle = textStyle.copy(fontStyle = FontStyle.Italic).toSpanStyle(),
strongEmphasis: SpanStyle = textStyle.copy(fontWeight = FontWeight.Bold).toSpanStyle(),
Expand Down Expand Up @@ -633,7 +633,7 @@ public fun InlinesStyling.Companion.dark(
linkDisabled: SpanStyle = link.copy(color = IntUiDarkTheme.colors.gray(8)),
linkHovered: SpanStyle = link.copy(textDecoration = TextDecoration.Underline),
linkFocused: SpanStyle = link.copy(background = Color(0x16FFFFFF), textDecoration = TextDecoration.Underline),
linkPressed: SpanStyle = link.copy(background = Color(0x26FFFFFF)),
linkPressed: SpanStyle = link.copy(background = Color(0x26FFFFFF), textDecoration = TextDecoration.Underline),
linkVisited: SpanStyle = link,
emphasis: SpanStyle = textStyle.copy(fontStyle = FontStyle.Italic).toSpanStyle(),
strongEmphasis: SpanStyle = textStyle.copy(fontWeight = FontWeight.Bold).toSpanStyle(),
Expand Down

0 comments on commit 3ff115b

Please sign in to comment.