python / python/cpython

REPL import tab completion moves cursor backward

Abierto
#145,448 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

pending stdlib topic-repl type-bug
Lenguaje dominante
Python
Estrellas
77.2k
Forks
35.9k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

Bug report

Bug description:

When tab completing ambiguous imports in the Python REPL, pressing tab once will insert the longest unambiguous completion and display "[ complete but not unique ]". Pressing tab a second time will show all the possibilities.

In Ghostty, when you press tab the second time, the cursor moves one cell to the left. This happens with cursor-style = bar as well as the default block cursor.

I reproduced this in Ghostty with both fish shell and bash. I could not reproduce this in Zed's integrated terminal (with a bar cursor) or Terminal.app (with a block cursor).

Originally posted by @injust in https://github.com/ghostty-org/ghostty/discussions/11131


I initially reported this issue to Ghostty, and the maintainer's response was:

This is a bug in Terminal.app in how it handles CUB with the cursor in the pending wrap state. Or, a bug in Python's readline in how it calculates the amount to move the cursor back. Your bug reproduces on xterm, and Ghostty matches xterm. Specifically, CUB moves exactly n cells back ignoring pending wrap in xterm and Ghostty matches this. In Terminal.app, CUB subtracts one when it is in the pending wrap state.

Since the bug reproduces in both Ghostty and xterm, it might be a bug in the Python REPL.

I captured the bug in this asciicast: https://github.com/user-attachments/files/25683940/ascii.cast.json

CPython versions tested on:

3.14

Operating systems tested on:

macOS

Linked PRs
  • gh-145727

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con el comportamiento de completado de importaciones de readline en el Python REPL y revisa el asciicast enlazado para reproducir el movimiento del cursor al pulsar Tab por segunda vez. Compara la posición del cursor antes y después de un completado ambiguo en un terminal; se considera terminado cuando el completado repetido con Tab ya no mueve el cursor hacia atrás.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
cli
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.