Visitar URL original
pyrepl: Cursor behaviour during tab-completion · Issue #119257 · python/cpython · GitHub
Skip to content

pyrepl: Cursor behaviour during tab-completion #119257

Description

@danielhollas

Pressing the Left arrow after the completions are shown moves the cursor three positions to the left.

It turns out reader.pos2xy uses reader.screen and reader.screeninfo to compute the position in the screen. Both of these include the two lines with completions. However, reader.pos and reader.buffer only include the things actually typed by the user (i.e. the third line datetime.). This leads to the new cursor position calculation being faulty. We'll have to think more about how to fix this.

Originally posted by @lysnikolaou in #118877 (comment)

Activity

  1. danielhollas commented on May 20, 2024

    @danielhollas
    ContributorAuthor

    @lysnikolaou I've taken the liberty of creating the issue for your observation in #118877, I hope that is okay.

    I believe I have a fix for this in #118939, in case you want to take a look. Thanks!

  2. cfbolz commented on Aug 24, 2024

    @cfbolz
    Contributor

    I just hit this bug too, here's a recording (just before the cursor jumped, I pressed left arrow):
    asciicast

  3. danielhollas commented on Aug 27, 2024

    @danielhollas
    ContributorAuthor

    @cfbolz thanks for confirming the issue! It would be great if you could test if #118939 solves the problem for you.

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

    topic-replRelated to the interactive shell

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions