From 45f7925894a6b87fe305f825903d9a6e2c958663 Mon Sep 17 00:00:00 2001 From: Florent Xicluna Date: Thu, 21 May 2026 20:21:05 +0200 Subject: [PATCH] Fix readline support on Linux bug #4135 --- CHANGELOG.md | 6 ++++++ CONTRIBUTORS.md | 1 + rich/console.py | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b016d4846..7629d626bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed + +- Fixed `readline` support: correct cursor position https://github.com/Textualize/rich/pull/4135 + ## [15.0.0] - 2026-04-12 ### Changed diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 2155a42a4d..a77cd978c0 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -98,6 +98,7 @@ The following people have contributed to the development of Rich: - [chthollyphile](https://github.com/chthollyphile) - [Jonathan Helmus](https://github.com/jjhelmus) - [Brandon Capener](https://github.com/bcapener) +- [Florent Xicluna](https://github.com/florentx) - [Alex Zheng](https://github.com/alexzheng111) - [Sebastian Speitel](https://github.com/SebastianSpeitel) - [Kevin Turcios](https://github.com/KRRT7) diff --git a/rich/console.py b/rich/console.py index 0bdce76987..c93b0dbe4a 100644 --- a/rich/console.py +++ b/rich/console.py @@ -2186,7 +2186,8 @@ def input( if stream: result = stream.readline() else: - result = input() + # Fix readline support: pass a non-empty string + result = input(" \b") # SPACE + BACKSPACE return result def export_text(self, *, clear: bool = True, styles: bool = False) -> str: