Render the escapes in an error, and drop the manifest field nobody read
Two loose ends from the per-component work. The card's error is the tail of what the build actually printed, and a compiler marks its own errors in colour -- so it arrived as `[1;31merror`, with punctuation welded onto the one line somebody is trying to read. It now goes through the same `ansiAnnotated` the log dialog uses: the colour is drawn, and the sequences with no meaning on a phone are consumed rather than printed, so a cursor movement cannot arrive looking like corruption either. One composable covers it because every failure already went through OutputText. Selection copies AnnotatedString.text, which is the message with every escape already gone, so what lands on the clipboard is what was on screen rather than what was on the wire. And `/manifest` carried a `build` object that nothing on the phone ever parsed. It was going to be how a running build survived leaving the app; that is not built, so it is gone rather than left looking finished. `RunningBuild` went with it -- it was split out of `BuildStatus` for that one reader and had become an indirection with one user, so `status()` fills one flat struct again. `/status` is byte-identical either way, since the split was flattened on the wire; checked against the running server rather than assumed. Looked at on the emulator against a failing build: bold red `error`, blue `-->`, no escape text anywhere, and long-pressing it still raises the handles and the Copy toolbar.
This commit is contained in:
1 parent
3685ab107d
commit
aa8e2b97a5
4 files changed
+44
-70
No files matched your search
@@ -10,6 +10,7 @@ import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
@@ -206,7 +207,23 @@ fun OutputText(
|
||||
color: Color = MaterialTheme.colorScheme.error,
|
||||
style: TextStyle = LocalTextStyle.current,
|
||||
) {
|
||||
SelectionContainer { Text(text, style = style, color = color) }
|
||||
// The same rendering the log dialog gets, and for the same reason: a
|
||||
// compiler marks its own errors in colour, and the tail of a failed
|
||||
// build is that output verbatim. Printed raw it read as `[1;31merror`
|
||||
// -- which is not merely ugly, it is the one line of the message a
|
||||
// person is trying to read with punctuation welded onto it. The
|
||||
// sequences with no meaning on a phone are consumed rather than
|
||||
// printed (see `ansiAnnotated`), so a cursor movement cannot arrive
|
||||
// looking like corruption either.
|
||||
//
|
||||
// [color] stays the colour of everything the escapes did not claim,
|
||||
// which is what keeps a message with no escapes in it -- git's stderr,
|
||||
// this app's own fallbacks -- looking exactly as it did.
|
||||
val rendered = remember(text, color) { ansiAnnotated(text, color) }
|
||||
// Selection copies `AnnotatedString.text`, which is the message with
|
||||
// every escape already gone -- so what lands on the clipboard is what
|
||||
// was on screen rather than what was on the wire.
|
||||
SelectionContainer { Text(rendered, style = style) }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user