Skip to content

Commit 2cc6f15

Browse files
Copilotbrianrob
andcommitted
Fix clipboard copy for single cell to exclude markdown formatting
When copying a single cell value from Stack Viewer, the clipboard now contains just the value without markdown table delimiters. Multiple cell selections still use markdown table format with leading "| " and trailing " |" characters. This fixes the regression where single cell copy would wrap values in "|" characters unnecessarily. Co-authored-by: brianrob <[email protected]>
1 parent c40f773 commit 2cc6f15

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/PerfView/StackViewer/PerfDataGrid.xaml.cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,20 @@ public PerfDataGrid()
6363
morphedContent = PadForColumn(morphedContent, i + e.StartColumnDisplayIndex);
6464
}
6565

66-
// Add a leading | character to the first column to ensure GitHub renders the content as table
67-
if (i == 0)
66+
// Add markdown table formatting only when multiple columns are selected
67+
if (e.ClipboardRowContent.Count > 1)
6868
{
69-
morphedContent = "| " + morphedContent;
70-
}
71-
72-
// Add a trailing | character to the last column to complete the markdown table row
73-
if (i == e.ClipboardRowContent.Count - 1)
74-
{
75-
morphedContent = morphedContent + " |";
69+
// Add a leading | character to the first column to ensure GitHub renders the content as table
70+
if (i == 0)
71+
{
72+
morphedContent = "| " + morphedContent;
73+
}
74+
75+
// Add a trailing | character to the last column to complete the markdown table row
76+
if (i == e.ClipboardRowContent.Count - 1)
77+
{
78+
morphedContent = morphedContent + " |";
79+
}
7680
}
7781

7882
// TODO Ugly, morph two cells on different rows into one line for the correct cut/paste experience

0 commit comments

Comments
 (0)