fix: complete paste artifact storage contract

This commit is contained in:
2026-09-01 17:51:24 +09:00
parent 04e296a4ef
commit 2bb661f1cf
11 changed files with 188 additions and 15 deletions
+10 -2
View File
@@ -76,8 +76,13 @@ impl Atom {
Atom::PasteArtifact(artifact) => Some((
Style::default().fg(Color::Magenta),
format!(
"[Paste artifact {} | {} chars, {} lines]",
artifact.artifact_id, artifact.char_count, artifact.line_count
"[Paste artifact {} | {} chars, {} lines, {}, {}, created {} ms]",
artifact.artifact_id,
artifact.char_count,
artifact.line_count,
artifact.media_type.as_str(),
artifact.availability.as_str(),
artifact.created_at_ms
),
)),
Atom::FileRef(r) => Some((Style::default().fg(Color::Cyan), r.label())),
@@ -932,6 +937,9 @@ mod submit_segments_tests {
fn restored_paste_artifact_remains_a_typed_segment() {
let artifact = protocol::PasteArtifactRef {
artifact_id: "019ca7c8-57b6-7f05-8edf-524147aba7b2".to_string(),
created_at_ms: 1_700_000_000_000,
media_type: protocol::PasteArtifactMediaType::TextPlainUtf8,
availability: protocol::PasteArtifactAvailability::Available,
byte_len: 65_536,
char_count: 65_530,
line_count: 200,
+14 -4
View File
@@ -1299,8 +1299,13 @@ fn chip_span_for(seg: &Segment, fallback: Style) -> (Style, String) {
Segment::PasteArtifact { artifact } => (
Style::default().fg(Color::Magenta),
format!(
"[Paste artifact {} | {} chars, {} lines]",
artifact.artifact_id, artifact.char_count, artifact.line_count
"[Paste artifact {} | {} chars, {} lines, {}, {}, created {} ms]",
artifact.artifact_id,
artifact.char_count,
artifact.line_count,
artifact.media_type.as_str(),
artifact.availability.as_str(),
artifact.created_at_ms
),
),
Segment::FileRef { path } => (Style::default().fg(Color::Cyan), format!("@{path}")),
@@ -1322,8 +1327,13 @@ fn segment_display_text(seg: &Segment) -> String {
id, chars, lines, ..
} => format!("[Clipboard #{id} | {chars} chars, {lines} lines]"),
Segment::PasteArtifact { artifact } => format!(
"[Paste artifact {} | {} chars, {} lines]",
artifact.artifact_id, artifact.char_count, artifact.line_count
"[Paste artifact {} | {} chars, {} lines, {}, {}, created {} ms]",
artifact.artifact_id,
artifact.char_count,
artifact.line_count,
artifact.media_type.as_str(),
artifact.availability.as_str(),
artifact.created_at_ms
),
Segment::FileRef { path } => format!("@{path}"),
Segment::Flow { selector } => format!("[Flow: {selector}]"),