Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

__terminal__ output reappears after clearing the element

Open Beginner friendly
#913 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript, python
Domain
frontend, web-dev

Research direction

Start in transcrypt/modules/org/transcrypt/runtime.py at the Terminal implementation and the module-level print/input bindings linked in the issue. Check how init sets the element and how output rewrites it from self.buffer. Done means a clear() method resets both buffer and displayed content so later output does not restore stale text.

Written by the indexing model from the issue text.

Description

Problem

Output written to __terminal__ cannot be cleared. Clearing the target element from application code removes the rendered text only. The next print puts everything back.

Cause

__Terminal__ keeps the output history in self.buffer and rewrites the whole element from that buffer on every call:

https://github.com/TranscryptOrg/Transcrypt/blob/32b216bcd3cb08c81645528c1a108a78be0b2325/transcrypt/modules/org/transcrypt/__runtime__.py#L284-L288

The class offers no method to reset self.buffer. Replacing the module-level instance does not help either, because print and input are bound to the original instance when the runtime module is loaded:

https://github.com/TranscryptOrg/Transcrypt/blob/32b216bcd3cb08c81645528c1a108a78be0b2325/transcrypt/modules/org/transcrypt/__runtime__.py#L301-L304

Proposed fix

Add a clear() method that resets buffer and element together, so the buffer cannot restore stale output:

    def clear (self):
        self.buffer = ''

        if self.element:
            self.element.innerHTML = '_'

'_' is the initial content written by __init__, so clear() returns the terminal to its start state.

Workaround

Reset both parts by hand:

__terminal__.buffer = ''
__terminal__.element.innerHTML = ''

Version

Transcrypt 3.9.5

Contribution

I am happy to write the pull request for this change if the proposed approach is acceptable.

Dominant language
Python
Stars
2.9k
Forks
218
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from TranscryptOrg/Transcrypt

All issues in TranscryptOrg/Transcrypt

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.