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

Fixed wrong indentation in :class:.Code #2725

Merged
merged 2 commits into from
May 23, 2022

Conversation

nyabkun
Copy link
Contributor

@nyabkun nyabkun commented May 19, 2022

Fixed Code mobject wrong indentation at the first line.

Overview: What does this pull request change?

Before:
2
After:
3

Edit: made it into an executable test code

from manim import *


class CodeIndentationTest(Scene):
    def construct(self):
        co = Code(
            code="""\
            def test():
                print("Hello")""",
            language="Python",
            insert_line_no=False,
        )

        self.add(co)
        self.wait()


with tempconfig(
    {
        "quality": "medium_quality",
        "preview": True,
        "save_last_frame": True,
        "write_to_movie": False,
    }
):
    scene = CodeIndentationTest()
    scene.render()

This is caused by pygments' bug. And It seems that they don't have the motivation to change this. pygments/pygments#961

Further Information and Comments

I also added the test code test_code_mobject.py.

I'm new here, so please point out any problems 😍😍😍

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

Copy link
Collaborator

@k4pran k4pran left a comment

Choose a reason for hiding this comment

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

LGTM thanks for this!

@behackl behackl added the pr:bugfix Bug fix for use in PRs solving a specific issue:bug label May 23, 2022
Copy link
Member

@behackl behackl left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! :-)

@behackl behackl enabled auto-merge (squash) May 23, 2022 21:01
@nyabkun
Copy link
Contributor Author

nyabkun commented May 23, 2022

@behackl san, @ryanmccauley211 san.

Thank you very much for the review and approval ! 😄

@behackl behackl merged commit 1bffb1d into ManimCommunity:main May 23, 2022
@behackl behackl changed the title Fix Code mobject wrong indentation Fixed wrong indentation in :class:.Code Jul 7, 2022
@behackl behackl added this to the v0.16.0 milestone Jul 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:bugfix Bug fix for use in PRs solving a specific issue:bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants