Author terry.reedy
Recipients cheryl.sabella, gvanrossum, rhettinger, taleinat, terry.reedy
Date 2019-08-27.05:02:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In this post, I slightly expand the terminal mode proposal and define the context in which I will accept it.  The context will be the subject of other issues.  In the next post (tomorrow) I will try to define a reviewable specification for the terminal mode.

The proposal that IDLE's should *always* respond to \b and \r "properly
, like terminals" is the combined proposal of #24572 and the original proposal of #23220.  The combined proposal was rejected in the latter,  for reasons best given by Serhiy in msg246602.  More is given below. #23220 was then redefined as a doc issue.

I noted in #23220 that one solution for people who wanted terminal-like behavior would be to add an option to execute code being edited to the system terminal.  However, this a) throws away the benefits of running in Shell and b) would not apply to interactive exploration.  While running in a terminal is needed for certain use cases, it is not needed  for handling control of line output.

What Shell should do with control characters in output depends on the users goal.  I propose that Shell should have 3 display modes that treat ascii control codes differently for different use cases.

1) Raw mode (the current mode). IDLE inserts all BMP chars into the tk Text.  This is needed if one is using a font that has glyphs associated with control codes.  On Windows 10, the 8514oem font (the MSDOS font) has symbols for all control codes except NUL and newline.  This is a rare need; this mode should not be the default.

2) Development mode (my proposed new default).  To the extent possible, developers should be able to see the characters their program produces without adding repr() to all their print and write statements (and later deleting them).  Control chars would be replaced with unique glyphs, such as 'Control Pictures', \u2400-\u241f,
  ␀ ␁ ␂ ␃ ␄ ␅ ␆ ␇ ␈␉␊␋␌␍␎␏␐ ␑ ␒ ␓ ␔ ␕ ␖ ␗ ␘ ␙ ␚ ␛ ␜ ␞ ␟.
or maybe circled letters, \u24d0-\u24df,\u24b6-\u24c5, ⓐ-ⓟ, Ⓐ-Ⓟ.  Replacements would be tagged as such and get distinct highlight colors. The purpose of a visible tag is to differentiate replacements from characters actually output by the users program.

To fulfill the goal of Development mode, more is needed. Astral chars, instead of causing an exception, should be replaced by a string consisting of their \U escape and tagged as a replacement.  This is needed anywhere astral chars can appear.  It would also be nice to get the codepoint and name of any displayed character. If implemented, this should be added to the base editor class.

3) Terminal mode. Tk interprets \n and \t.  Also interpret (to begin with) \a, \b, and \r.  The motivation for the latter two has already been given. As said above, the specification is deferred to another post.
Date User Action Args
2019-08-27 05:02:12terry.reedysetrecipients: + terry.reedy, gvanrossum, rhettinger, taleinat, cheryl.sabella
2019-08-27 05:02:12terry.reedysetmessageid: <>
2019-08-27 05:02:12terry.reedylinkissue37827 messages
2019-08-27 05:02:11terry.reedycreate