GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Editing the last line in a block in the new REPL is buggy · Issue #118911 · python/cpython

Editing the last line in a block in the new REPL is buggy #118911

New issue
Copy link
New issue
Copy link
Closed
Closed
Editing the last line in a block in the new REPL is buggy#118911
Copy link
Labels
3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixestopic-replRelated to the interactive shellRelated to the interactive shelltype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@treyhunner
treyhunner
opened on May 10, 2024
Issue body actions

Bug report

Bug description:

When editing the last line in a function in the new REPL, hitting Enter doesn't end the block if the last line has indentation on it.

658451

Demo of the bug, demo of what IPython does

Originally posted in #111201 (comment)

Here are the noticeable differences in how IPython handles this situation:

  1. When hitting the up arrow key to edit the block, the final blank line isn't included (the default cursor position is at the end of the last non-empty line.

image

  1. In IPython I tried purposely adding extra whitespace-only lines (not fully blank but instead containing 4 spaces) by hitting Enter, up arrow, End, Enter, up arrow, End, repeatedly. If I then hit Enter on the first line-followed-by-whitespace-only-lines it ends the block.

image

  1. Hitting up arrow again, will strip whitespace from the end of the block (maybe this is how 1 above is implemented)

image

Implementing the behavior of 1 (or 3) above might be enough, though 2 seems like it would be even better.

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

  • gh-118911: Trailing whitespace in a block shouldn't prevent the user from terminating the code block #119355
  • [3.13] gh-118911: Trailing whitespace in a block shouldn't prevent the user from terminating the code block (GH-119355) #119404
Reacted by Daniel Hollas, Aya Elsayed and Savannah Ostrowski

Activity

  1. treyhunner
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on May 10, 2024
  2. hugovk
    added
    3.13only security fixesonly security fixes
    3.14bugs and security fixesbugs and security fixes
    topic-replRelated to the interactive shellRelated to the interactive shell
    on May 10, 2024
  3. aelsayed95 commented on May 20, 2024

    @aelsayed95
    aelsayed95
    on May 20, 2024
    Contributor
    More actions

    I'll give this a go

    Reacted by Trey Hunner, Łukasz Langa and Lysandros Nikolaou
  4. aelsayed95
    added a commit that references this issue on May 21, 2024

    pythongh-118911: Trailing whitespace in a block shouldnt prevent the …

    77ca92a
  5. ambv
    added a commit that references this issue on May 22, 2024

    gh-118911: Trailing whitespace in a block shouldn't prevent the user …

    5091c44
  6. lysnikolaou
    added 2 commits that reference this issue on May 22, 2024

    [3.13] pythongh-118911: Trailing whitespace in a block shouldn't prev…

    13c31f1

    [3.13] gh-118911: Trailing whitespace in a block shouldn't prevent th…

    9fa1b4f
  7. lysnikolaou commented on May 23, 2024

    @lysnikolaou
    lysnikolaou
    on May 23, 2024
    Member
    More actions

    This has been fixed! Congrats @aelsayed95! 🎉

    I'm closing this, but feel free to reopen in case something's off.

    Reacted by Trey Hunner and Hugo van Kemenade
  8. lysnikolaou
    closed this as completedon May 23, 2024
  9. estyxx
    added a commit that references this issue on Jul 17, 2024

    pythongh-118911: Trailing whitespace in a block shouldn't prevent the…

    0d1ccbb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixestopic-replRelated to the interactive shellRelated to the interactive shelltype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.