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

Fix trimTextMid #431

Merged
merged 1 commit into from
Jun 23, 2023
Merged

Fix trimTextMid #431

merged 1 commit into from
Jun 23, 2023

Conversation

jlfwong
Copy link
Owner

@jlfwong jlfwong commented Jun 23, 2023

There was a subtle bug in trimTextMid caused by calling substring methods with non-integer values. This happens because findValueBisect returns non-integer values, and there was no special handling of this.

The bug results in strings cutting off many of the last few characters in a string, rather than always displaying it when possible.

Before:
image

After:
image

Fixes #411

Comment on lines +46 to +47
const prefix = text.substring(0, prefixLength)
const suffix = text.substring(text.length - suffixLength, text.length)
Copy link
Owner Author

Choose a reason for hiding this comment

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

@coveralls
Copy link

Coverage Status

coverage: 42.978%. remained the same when pulling b2be6d6 on jlfwong/fix-trimTextMid into 693545b on main.

@jlfwong jlfwong merged commit bb063e4 into main Jun 23, 2023
8 checks passed
@jlfwong jlfwong deleted the jlfwong/fix-trimTextMid branch June 23, 2023 20:22
jackerghan pushed a commit to jackerghan/speedscope that referenced this pull request Jul 28, 2023
There was a subtle bug in `trimTextMid` caused by calling substring methods with non-integer values. This happens because `findValueBisect` returns non-integer values, and there was no special handling of this.

The bug results in strings cutting off many of the last few characters in a string, rather than always displaying it when possible.

Before:
<img width="368" alt="image" src="https://github.com/jlfwong/speedscope/assets/150329/754a25f1-a6f7-46f1-8e34-059503d9e4cf">

After:
<img width="386" alt="image" src="https://github.com/jlfwong/speedscope/assets/150329/b2688ca1-54af-4d2e-b704-9f3322d2e5b4">

Fixes jlfwong#411
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.

Frame label truncates to second last character instead of last
2 participants