Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text overdraw maintains ANSI characters from behind #717

Open
mattprecious opened this issue Feb 22, 2025 · 0 comments
Open

Text overdraw maintains ANSI characters from behind #717

mattprecious opened this issue Feb 22, 2025 · 0 comments
Labels
bug Something isn't working mosaic/runtime

Comments

@mattprecious
Copy link

Failing test:

@Test
fun overdraw() = runTest {
  runMosaicTest(RenderingSnapshots(rendering)) {
    setContent {
      Box {
        Text(
          buildAnnotatedString {
            withStyle(SpanStyle(textStyle = Underline)) {
              append("Hello")
            }
          }
        )

        Text(
          modifier = Modifier.background(Color(0xffffff)),
          value = "World",
        )
      }
    }

    assertThat(awaitSnapshot()).isEqualTo(
      """
      |${CSI}48;2;255;255;255mWorld${CSI}0m
      |
      """.trimMargin().wrapWithAnsiSynchronizedUpdate().replaceLineEndingsWithCRLF(),
    )
  }
}

It's debatable whether this is a bug or not, but explicitly adding a background color to the second text makes it a stronger argument that the underline should be stripped from the merged output. Otherwise, it's not going to be possible to build UIs with z-index.

Removing the background color and just doing Text("World") could also arguably not have an underline in the merged output, but the counter argument is that technically you would still see the underline because it's below the characters. What about Strikethrough and text color though?

@JakeWharton JakeWharton added bug Something isn't working mosaic/runtime labels Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mosaic/runtime
Projects
None yet
Development

No branches or pull requests

2 participants