Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 25, 2025

Summary

The fix successfully resolves the issue by adding logic to RangeUtilities.TryParse() to trim whitespace and pipe symbols from input text before parsing. The optimization reduces the trimming operation from 3 method calls to 1, improving performance while maintaining all functionality. This allows users to copy First/Last columns with the new markdown pipe format and paste them directly into the Start text box, restoring the previous user-friendly behavior while maintaining the new markdown formatting benefits.

Original prompt

This section details on the original issue you should resolve

<issue_title>Copying First/Last cannot be directly pasted in the time range</issue_title>
<issue_description>With older version of PerfView you can do this:

  1. Select First/Last columns and press CTRL+C
  2. Paste in Start and press ENTER

This would update Start/End with both values.

In newer versions this now breaks because copying the times inserts pipes around the values:

Old version:
1,395.251 2,626.358

New version:

| 1,395.251 2,626.358 |

I get bitten by this new behavior daily.</issue_description>

<agent_instructions>The issue here is that when we cut and paste the start and end times from the First/Last column in the StackViewer, it now includes the | symbols because we're trying to make the data show up nicely in markdown.

I think we should just update the logic in the stackviewer that takes the start/end times when pasted into the start text box and have it remove the | symbols if they are present. Effectively trim the string since there is likely to be whitespace before and after the | symbols.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Fixes #2303

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Copying First/Last cannot be directly pasted in the time range Fix copying First/Last columns with pipe symbols to work in time range input Sep 26, 2025
Copilot finished work on behalf of brianrob September 26, 2025 00:04
Copilot AI requested a review from brianrob September 26, 2025 00:04
Copilot finished work on behalf of cincuranet September 29, 2025 07:36
Copilot AI requested a review from cincuranet September 29, 2025 07:36
// e.g., "| 1,395.251 2,626.358 |" becomes "1,395.251 2,626.358"
if (!string.IsNullOrEmpty(text))
{
text = text.Trim(' ', '\t', '\n', '\r', '|');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it not be better to include those as range separators and leave it to text.Split? We are lucky here since string is a weird beast, hence we are not actually mutating the incoming text parameter, but in general it feels uneasy when the function parameter is being modified without explicitly being marked by ref or something like that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it is trimming beginning and end. Split would split it everywhere. I guess we could probably after splitting work out only the ones at the start/end of resulting array, but that would be cumbersome. But anyway, feel free to propose better implementation.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh. Missed the part that it would split everywhere. So another approach could be "string index walk" identifying each char and collecting desired indices to be able to cut after a single walk. But I digress, most probably an overkill here.

@brianrob
Copy link
Member

brianrob commented Oct 7, 2025

@cincuranet and @tomuxmon thanks for the feedback on this.

@brianrob brianrob marked this pull request as ready for review October 7, 2025 00:37
Copy link
Member

@mconnew mconnew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copying First/Last cannot be directly pasted in the time range

5 participants