This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: backspace character \b not processed by IDLE
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.8
process
Status: closed Resolution: duplicate
Dependencies: Superseder: IDLE: Document how Shell displays user code output
View: 23220
Assigned To: terry.reedy Nosy List: stanhx, terry.reedy
Priority: normal Keywords:

Created on 2020-05-23 01:59 by stanhx, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg369685 - (view) Author: Stan Hendryx (stanhx) Date: 2020-05-23 01:59
The backspace character \b is not processed correctly in IDLE 3.8.2:
>>> print("deleted\b file")
deleted file

Running the interpreter from Terminal, it works:
>>> print("deleted\b file")
delete file

Same result on two systems: MacBook Pro, one on OSX 10.14.6 and another on 10.13.6.
msg369689 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-23 02:29
I am considering terminal simulation as an option, but there is not exactly a standard to emulate.  \b originally meant the same as the typewrite backspace and modern US computer keyboard left arrow key <- (move cursor left without erasing), which would result in 'delete filed' in insert mode, but sometimes now is interpreted the same as modern US computer keyboard backspace (erase and move left), as you expect.
msg369727 - (view) Author: Stan Hendryx (stanhx) Date: 2020-05-23 16:24
Hello Terry,

Thank you for your reply. I understand there are different interpretations of \b. IMHO, since IDLE is part of a python distribution, IDLE needs to be consistent with the native python interpreter on each platform. On Mac, IDLE gives
>>> print("deleted\b file")
deleted file

whereas on mac Terminal we get 
>>> print("deleted\b file")
delete file

JetBrains gives another vote for the native interpretation. I’ve been tutoring my grandson on python using JetBrains Academy’s python tutorials. 
They teach 
>>> print("deleted\b file")
delete file

That’s how I discovered the inconsistency.

Thank you,

Stan Hendryx

> On May 22, 2020, at 7:29 PM, Terry J. Reedy <report@bugs.python.org> wrote:
> 
> 
> Terry J. Reedy <tjreedy@udel.edu> added the comment:
> 
> I am considering terminal simulation as an option, but there is not exactly a standard to emulate.  \b originally meant the same as the typewrite backspace and modern US computer keyboard left arrow key <- (move cursor left without erasing), which would result in 'delete filed' in insert mode, but sometimes now is interpreted the same as modern US computer keyboard backspace (erase and move left), as you expect.
> 
> ----------
> resolution:  -> duplicate
> stage:  -> resolved
> status: open -> closed
> superseder:  -> IDLE: Document how Shell displays user code output
> 
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue40738>
> _______________________________________
History
Date User Action Args
2022-04-11 14:59:31adminsetgithub: 84915
2020-05-23 16:24:14stanhxsetmessages: + msg369727
2020-05-23 02:29:24terry.reedysetstatus: open -> closed
superseder: IDLE: Document how Shell displays user code output
messages: + msg369689

resolution: duplicate
stage: resolved
2020-05-23 01:59:11stanhxcreate