Skip to content

Strip trailing spaces from log-formatter cursor output. #28056

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

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Apr 11, 2024

The trailing spaces were fine when the cursor position was shown as
x=... y=..., but become very ugly now that it's
(x, y) = (..., ...). (#25556)

(test e.g. with moving the cursor on a loglog() axes and looking at the coordinates display)

PR summary

PR checklist

The trailing spaces were fine when the cursor position was shown as
`x=...    y=...`, but become very ugly now that it's
`(x, y) = (...,    ...)`.
@anntzer anntzer added this to the v3.9.0 milestone Apr 11, 2024
@timhoffm timhoffm merged commit 27f6031 into matplotlib:main Apr 12, 2024
41 of 45 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Apr 12, 2024
@anntzer anntzer deleted the striplog branch April 12, 2024 08:41
@@ -1024,7 +1024,7 @@ def format_data(self, value):

def format_data_short(self, value):
# docstring inherited
return '%-12g' % value
return ('%-12g' % value).rstrip()
Copy link
Member

Choose a reason for hiding this comment

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

Sorry for the post merge comment here, but why not just:

    return f"{value:g}"

The 12 in the format is adding padding that we are then just stripping away...

rcomer added a commit that referenced this pull request Apr 13, 2024
…056-on-v3.9.x

Backport PR #28056 on branch v3.9.x (Strip trailing spaces from log-formatter cursor output.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants