Skip to content

Renderer.reset is called 3 times during application startup. #1967

Open
@jonathanslenders

Description

@jonathanslenders

This results in some output escape sequences to be produced multiple times without reason, like showing the cursor.

Renderer.reset() is called three times when we create/start an application, like ptpython for instance:

  • Once Application.__init__()-> Renderer.__init__() -> Renderer.reset().
  • Once Application.__init__() -> Application.reset() ->Renderer.reset().
  • Once Application._run_async() -> Application.__init__() -> Application.reset() ->Renderer.reset().

Each time, we call self.output.show_cursor().

Either we should keep track in the Renderer, which terminal state was changed, and only reset that (cursor shapes changed, cursor hidden/shown, alternate screen entered/left, ...) or we should create the Renderer instance only at the point that the application actually starts in Application._run_async(), so that we only reset once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions