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

IDLE Shell: Refine restart line #82222

Closed
terryjreedy opened this issue Sep 5, 2019 · 6 comments
Closed

IDLE Shell: Refine restart line #82222

terryjreedy opened this issue Sep 5, 2019 · 6 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 38041
Nosy @terryjreedy, @miss-islington, @iritkatriel
PRs
  • bpo-38041: Refine IDLE Shell restart lines.  #15709
  • [3.8] bpo-38041: Refine IDLE Shell restart lines. (GH-15709) #15719
  • [3.7] bpo-38041: Refine IDLE Shell restart lines. (GH-15709) #15720
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/terryjreedy'
    closed_at = <Date 2020-10-16.22:59:33.312>
    created_at = <Date 2019-09-05.18:52:14.481>
    labels = ['3.8', 'expert-IDLE', 'type-bug', '3.7', '3.9']
    title = 'IDLE Shell: Refine restart line'
    updated_at = <Date 2020-10-16.22:59:33.311>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2020-10-16.22:59:33.311>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2020-10-16.22:59:33.312>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2019-09-05.18:52:14.481>
    creator = 'terry.reedy'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38041
    keywords = ['patch']
    message_count = 6.0
    messages = ['351218', '351264', '351266', '351267', '378779', '378781']
    nosy_count = 3.0
    nosy_names = ['terry.reedy', 'miss-islington', 'iritkatriel']
    pr_nums = ['15709', '15719', '15720']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue38041'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    @terryjreedy
    Copy link
    Member Author

    Currently, Shell prints restart lines as
    =...= RESTART filename =...=
    where filename is 'Shell' or the full pathname. The code is

            tag = 'RESTART: ' + (filename if filename else 'Shell')
            halfbar = ((int(console.width) -len(tag) - 4) // 2) * '='
            console.write("\n{0} {1} {0}".format(halfbar, tag))

    The initial '\n' is needed because typically the cursor is sitting at a prompt. The -4 is from bpo-21192 when I added 'Shell' or filename. It is -2 for the spaces plus a couple of extra spaces that were there before. I believe -2 is sufficient but will have to test to be sure.

    The number of '='s is the currently the same on both ends. (Because this is easiest.) It does not have to be, and would sometimes not be if we exactly filled the console width. I think we should because it would show the actual non-printable margin and would allow

    The minimum number of '='s is 0. The problem revealed in
    https://stackoverflow.com/questions/57795679/why-is-this-code-printing-an-empty-line-when-run-under-idle
    is that if console.width is exactly 10 + len(filename), the remaining trailing space wraps to the next line, making it look like a spurious print(' ') had occurred.

    Possible solutions:

    1. Do nothing. I rejected this by opening this issue. The SO beginner was apparently genuinely confused and might not be the only such person. With no spec for the restart line, this is not an implementation bug but is a design glitch. As I hinted above, some current details are the result of adding filenames with minimal change.

    2. Delete the ' 's surrounding the tag when there are no '='s. This looks strange because the '='s visually mark a restart line as much as 'RESTART'.

    3. Print a minimum of 1 '=' on each end (by adding them to the format). This could result in a wrap of exactly ' =' or '=', either of which are bad. If there is any wrap, it should be the filename, so the user can recognize it as such.

    4. A hybrid solution with a minimum of 1 '=' on the front and 0 on the end, with no space if no '='. I intend to try this after extracting the restart line into a testable function and writing tests that now fail.

    5. Add a horizontal scrollbar to Shell. This not happening now, might be made optional, and would still require specification decisions.

    @terryjreedy terryjreedy added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes labels Sep 5, 2019
    @terryjreedy terryjreedy self-assigned this Sep 5, 2019
    @terryjreedy terryjreedy added topic-IDLE type-bug An unexpected behavior, bug, or error labels Sep 5, 2019
    @terryjreedy terryjreedy changed the title IDLE Shell: Redesign minimum restart line Refine IDLE Shell restart line Sep 6, 2019
    @terryjreedy terryjreedy changed the title Refine IDLE Shell restart line IDLE Shell: Refine restart line Sep 6, 2019
    @terryjreedy
    Copy link
    Member Author

    New changeset 38da805 by Terry Jan Reedy in branch 'master':
    bpo-38041: Refine IDLE Shell restart lines. (GH-15709)
    38da805

    @miss-islington
    Copy link
    Contributor

    New changeset 4009a85 by Miss Islington (bot) in branch '3.8':
    bpo-38041: Refine IDLE Shell restart lines. (GH-15709)
    4009a85

    @miss-islington
    Copy link
    Contributor

    New changeset 084ba33 by Miss Islington (bot) in branch '3.7':
    bpo-38041: Refine IDLE Shell restart lines. (GH-15709)
    084ba33

    @iritkatriel
    Copy link
    Member

    Can this be closed?

    @terryjreedy
    Copy link
    Member Author

    Yes, the further changes I am thinking about should be a new issue.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants